Skip to content

Commit

Permalink
Initialize Tizen.Applications.ToastMessage
Browse files Browse the repository at this point in the history
Signed-off-by: seungha.son <[email protected]>
Change-Id: I9a8ed7dc5f20b7fbae5fe6224d1592b982209a51
  • Loading branch information
linuxias committed Mar 19, 2017
1 parent f894412 commit f0e6c7d
Show file tree
Hide file tree
Showing 15 changed files with 322 additions and 25 deletions.
8 changes: 7 additions & 1 deletion Tizen.Applications.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
Expand All @@ -21,6 +21,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.UI", "Ti
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications", "Tizen.Applications\Tizen.Applications.csproj", "{6209641F-4B03-4DAD-84D8-4775AD72AD75}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tizen.Applications.ToastMessage", "Tizen.Applications.ToastMessage\Tizen.Applications.ToastMessage.csproj", "{C35F85FC-A095-4356-8F17-DD248FB1C9AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -63,6 +65,10 @@ Global
{6209641F-4B03-4DAD-84D8-4775AD72AD75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6209641F-4B03-4DAD-84D8-4775AD72AD75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6209641F-4B03-4DAD-84D8-4775AD72AD75}.Release|Any CPU.Build.0 = Release|Any CPU
{C35F85FC-A095-4356-8F17-DD248FB1C9AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C35F85FC-A095-4356-8F17-DD248FB1C9AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C35F85FC-A095-4356-8F17-DD248FB1C9AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C35F85FC-A095-4356-8F17-DD248FB1C9AA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions Tizen.Applications/Interop/Interop.Libraries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ internal static partial class Libraries
public const string Notification = "libnotification.so.0";
public const string Preference = "libcapi-appfw-preference.so.0";
public const string Alarm = "libcapi-appfw-alarm.so.0";
public const string ToastMessage = "libnotification.so.0";
}
}
3 changes: 3 additions & 0 deletions Tizen.Applications/Tizen.Applications.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
<Compile Include="../Tizen.Applications.PackageManager/Interop/Interop.PackageManager.cs" />
<Compile Include="../Tizen.Applications.Preference/Interop/Interop.Preference.cs" />
<Compile Include="../Tizen.Applications.Service/Interop/Interop.Service.cs" />
<Compile Include="../Tizen.Applications.ToastMessage/Interop/Interop.ToastMessage.cs" />
<Compile Include="../Tizen.Applications.Common/Tizen.Applications/LocaleChangedEventArgs.cs" />
<Compile Include="../Tizen.Applications.Common/Tizen.Applications/LowBatteryEventArgs.cs" />
<Compile Include="../Tizen.Applications.Common/Tizen.Applications/LowBatteryStatus.cs" />
Expand Down Expand Up @@ -134,6 +135,8 @@
<Compile Include="../Tizen.Applications.UI/Tizen.Applications.CoreBackend/UICoreBackend.cs" />
<Compile Include="../Tizen.Applications.Common/Tizen.Applications/DeviceOrientationEventArgs.cs" />
<Compile Include="../Tizen.Applications.Common/Tizen.Applications/DeviceOrientation.cs" />
<Compile Include="../Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessage.cs" />
<Compile Include="../Tizen.Applications.ToastMessage/Tizen.Applications/ToastMessageErrorFactory.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Tizen.Applications.project.json" />
Expand Down
26 changes: 25 additions & 1 deletion packaging/csapi-application.spec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ BuildRequires: dotnet-build-tools
# C# API Requires
BuildRequires: csapi-tizen-nuget

%define Assemblies Tizen.Applications.Common Tizen.Applications.MessagePort Tizen.Applications.Service Tizen.Applications.PackageManager Tizen.Applications.Notification Tizen.Applications.Preference Tizen.Applications.Alarm Tizen.Applications.UI Tizen.Applications
%define Assemblies Tizen.Applications.Common Tizen.Applications.MessagePort Tizen.Applications.Service Tizen.Applications.PackageManager Tizen.Applications.Notification Tizen.Applications.Preference Tizen.Applications.Alarm Tizen.Applications.UI Tizen.Applications Tizen.Applications.ToastMessage

%description
%{summary}
Expand Down Expand Up @@ -92,6 +92,22 @@ Group: Development/Libraries
%description -n csapi-application-notification-nuget
A notification library in Tizen C# API package.

%package -n csapi-application-toastmessage
Summary: A toastmessage library in Tizen C# API
Group: Development/Libraries
AutoReqProv: no
ExcludeArch: aarch64

%description -n csapi-application-toastmessage
A toastmessage library in Tizen C# API package.

%package -n csapi-application-toastmessage-nuget
Summary: A toastmessage library in Tizen C# API
Group: Development/Libraries

%description -n csapi-application-toastmessage-nuget
A toastmessage library in Tizen C# API package.

%package -n csapi-application-preference
Summary: A preference library in Tizen C# API
Group: Development/Libraries
Expand Down Expand Up @@ -210,6 +226,14 @@ done
%files -n csapi-application-notification-nuget
/nuget/Tizen.Applications.Notification.%{version}.nupkg

%files -n csapi-application-toastmessage
%manifest %{name}.manifest
%license LICENSE
%attr(644,root,root) %{_dotnet_assembly_path}/Tizen.Applications.ToastMessage.dll

%files -n csapi-application-toastmessage-nuget
/nuget/Tizen.Applications.ToastMessage.%{version}.nupkg

%files -n csapi-application-preference
%manifest %{name}.manifest
%license LICENSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ internal static class Notification
[DllImport(Libraries.Notification, EntryPoint = "notification_get_tag")]
internal static extern int GetTag(SafeNotificationHandle handle, out IntPtr tag);

[DllImport(Libraries.Notification, EntryPoint = "notification_status_message_post")]
internal static extern int PostMessage(string text);

[DllImport(Libraries.Notification, EntryPoint = "notification_load_by_tag")]
internal static extern SafeNotificationHandle Load(string text);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,6 @@ public static void DeleteAll()
DeleteAll(NotificationType.Event);
}

/// <summary>
/// Posts a message on a toast popup
/// </summary>
/// <param name="text">Text to display on popup</param>
/// <exception cref="ArgumentNullException">Thrown when argument is null</exception>
/// <example>
/// <code>
/// string msg = "hey there!!";
/// NotificationManager.PostToastMessage(msg);
/// </code>
/// </example>
public static void PostToastMessage(string text)
{
int ret = Interop.Notification.PostMessage(text);
if(ret != (int)NotificationError.None)
{
throw NotificationErrorFactory.GetException((NotificationError)ret, "post toast message failed");
}
}

/// <summary>
/// Searches for a posted notification which has the inputted tag
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions src/Tizen.Applications.ToastMessage/Interop/Interop.Libraries.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

internal static partial class Interop
{
internal static partial class Libraries
{
public const string ToastMessage = "libnotification.so.0";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Runtime.InteropServices;
using Tizen.Applications;

internal static partial class Interop
{
internal static class ToastMessage
{
[DllImport(Libraries.ToastMessage, EntryPoint = "notification_status_message_post")]
internal static extern int ToastMessagePost(string message);
}
}
20 changes: 20 additions & 0 deletions src/Tizen.Applications.ToastMessage/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyTitle("Tizen.Applications.ToastMessage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Samsung Electronics")]
[assembly: AssemblyProduct("Tizen.Applications")]
[assembly: AssemblyCopyright("Copyright (c) 2017 Samsung Electronics Co., Ltd")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]

[assembly: Guid("d2d1a3ce-000e-4ab3-81c4-a8a44a008989")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C35F85FC-A095-4356-8F17-DD248FB1C9AA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>
</RootNamespace>
<AssemblyName>Tizen.Applications.ToastMessage</AssemblyName>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworkIdentifier>.NETStandard</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v1.3</TargetFrameworkVersion>
<NuGetTargetMoniker>.NETStandard,Version=v1.3</NuGetTargetMoniker>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<NoStdLib>true</NoStdLib>
<NoWarn>$(NoWarn);1701;1702</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>Tizen.Applications.ToastMessage.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="Interop\Interop.Libraries.cs" />
<Compile Include="Interop\Interop.ToastMessage.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Tizen.Applications\ToastMessage.cs" />
<Compile Include="Tizen.Applications\ToastMessageErrorFactory.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Tizen.Applications.ToastMessage.project.json" />
<None Include="Tizen.Applications.ToastMessage.snk" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tizen.Applications.Common\Tizen.Applications.Common.csproj">
<Project>{663c5a3d-e631-4987-aee7-f498c56a40fc}</Project>
<Name>Tizen.Applications.Common</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<!-- https://github.com/dotnet/corefxlab/tree/master/samples/NetCoreSample and
https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/target-dotnetcore-with-msbuild
-->
<!-- We don't use any of MSBuild's resolution logic for resolving the framework, so just set these two
properties to any folder that exists to skip the GetReferenceAssemblyPaths task (not target) and
to prevent it from outputting a warning (MSB3644).
-->
<_TargetFrameworkDirectories>$(MSBuildThisFileDirectory)</_TargetFrameworkDirectories>
<_FullFrameworkReferenceAssemblyPaths>$(MSBuildThisFileDirectory)</_FullFrameworkReferenceAssemblyPaths>
<AutoUnifyAssemblyReferences>true</AutoUnifyAssemblyReferences>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<package>
<metadata>
<id>Tizen.Applications.ToastMessage</id>
<version>$version$</version>
<authors>Samsung Electronics</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
<projectUrl>https://www.tizen.org/</projectUrl>
<iconUrl>https://developer.tizen.org/sites/default/files/images/tizen-pinwheel-on-light-rgb_64_64.png</iconUrl>
<copyright>© Samsung Electronics Co., Ltd All Rights Reserved</copyright>
<description>Provides the Application Frameworks API for Tizen.Net</description>
<dependencies>
<dependency id="Tizen" version="1.0.2" />
<dependency id="Tizen.Applications.Common" version="1.2.0" />
</dependencies>
</metadata>
<files>
<file src="bin/$Configuration$/Tizen.Applications.ToastMessage.dll" target="lib/netstandard1.3" />
</files>
</package>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"dependencies": {
"NETStandard.Library": "1.6.0",
"Tizen": "1.0.2"
},
"frameworks": {
"netstandard1.3": {}
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the License);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an AS IS BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tizen.Applications
{
public sealed class ToastMessage
{

/// <summary>
/// Gets and sets message to post ToastMessage
/// </summary>
public string Message { get; set; }

/// <summary>
/// Posts a message on a toast popup
/// </summary>
/// <exception cref="ArgumentNullException">Thrown when Message is null</exception>
/// <example>
/// <code>
/// ToastMessage toast = new ToastMessage
/// {
/// Message = "Hello TIzen"
/// };
/// toast.Post();
/// </code>
/// </example>
public void Post()
{
int ret = Interop.ToastMessage.ToastMessagePost(Message);
if (ret != (int)ToastMessageError.None)
{
throw ToastMessageErrorFactory.GetException((ToastMessageError)ret, "post toast message failed");
}
}
}

}
Loading

0 comments on commit f0e6c7d

Please sign in to comment.