-
+
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
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
{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
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";
}
}
<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" />
<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" />
# 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}
%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
%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
[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);
}
/// <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>
/// <remarks>
--- /dev/null
+/*
+ * 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";
+ }
+}
--- /dev/null
+/*
+ * 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);
+ }
+}
--- /dev/null
+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")]
--- /dev/null
+<?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>
--- /dev/null
+<?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>
--- /dev/null
+{
+ "dependencies": {
+ "NETStandard.Library": "1.6.0",
+ "Tizen": "1.0.2"
+ },
+ "frameworks": {
+ "netstandard1.3": {}
+ }
+}
--- /dev/null
+/*
+ * 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");
+ }
+ }
+ }
+
+}
--- /dev/null
+/*
+ * 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;
+
+namespace Tizen.Applications
+{
+ internal enum ToastMessageError
+ {
+ None = Tizen.Internals.Errors.ErrorCode.None,
+ InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
+ DBusError = -0x01140000 | 0x03,
+ }
+
+ internal class ToastMessageErrorFactory
+ {
+ private const string _logTag = "Tizen.Applications.ToastMessage";
+
+ internal static Exception GetException(ToastMessageError ret, string msg)
+ {
+ switch (ret)
+ {
+ case ToastMessageError.InvalidParameter:
+ Log.Error(_logTag, msg);
+ return new ArgumentException(ret + " error occurred.");
+ default:
+ Log.Error(_logTag, msg);
+ return new InvalidOperationException(ret + " error occurred.");
+ }
+ }
+ }
+}