Add Tizen.Xamarin.Forms.Extension project 17/108317/4
authorKangho Hur <kangho.hur@samsung.com>
Wed, 4 Jan 2017 05:10:17 +0000 (14:10 +0900)
committerKangho Hur <kangho.hur@samsung.com>
Wed, 4 Jan 2017 05:46:08 +0000 (14:46 +0900)
- This change include sample extensions (Cells) to guide how to use it

Change-Id: I59775664287cf1ff7def3b65d41b00474b1b8f4c

Tizen.Xamarin.Forms.Extension/Cells/BaseTypeCell.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Cells/DoubleLabelCell.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Cells/MultilineCell.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Cells/Type1Cell.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Cells/Type2Cell.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Properties/AssemblyInfo.cs [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/Tizen.Xamarin.Forms.Extension.csproj [new file with mode: 0644]
Tizen.Xamarin.Forms.Extension/packages.config [new file with mode: 0644]

diff --git a/Tizen.Xamarin.Forms.Extension/Cells/BaseTypeCell.cs b/Tizen.Xamarin.Forms.Extension/Cells/BaseTypeCell.cs
new file mode 100644 (file)
index 0000000..5eeaa37
--- /dev/null
@@ -0,0 +1,97 @@
+using System;
+using Xamarin.Forms;
+
+namespace Tizen.Xamarin.Forms.Extension
+{
+    public abstract class BaseTypeCell : Cell
+    {
+        public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(BaseTypeCell), default(string));
+
+        public static readonly BindableProperty TextEndProperty = BindableProperty.Create("TextEnd", typeof(string), typeof(BaseTypeCell), default(string));
+
+        public static readonly BindableProperty SubProperty = BindableProperty.Create("Sub", typeof(string), typeof(TextCell), default(string));
+
+        public static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(ImageSource), typeof(BaseTypeCell), null,
+            propertyChanged: (bindable, oldvalue, newvalue) => ((BaseTypeCell)bindable).OnSourcePropertyChanged((ImageSource)oldvalue, (ImageSource)newvalue));
+
+        public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create("IsChecked", typeof(bool), typeof(BaseTypeCell), false,
+            propertyChanged: (obj, oldValue, newValue) =>
+            {
+                var baseTypeCell = (BaseTypeCell)obj;
+                baseTypeCell.Toggled?.Invoke(obj, new ToggledEventArgs((bool)newValue));
+            }, defaultBindingMode: BindingMode.TwoWay);
+
+        public static readonly BindableProperty IsCheckVisibleProperty = BindableProperty.Create("IsCheckVisible", typeof(bool), typeof(MultilineCell), false);
+
+        public static readonly BindableProperty IconWidthProperty = BindableProperty.Create("IconWidth", typeof(int), typeof(MultilineCell), 0);
+
+        public static readonly BindableProperty IconHeightProperty = BindableProperty.Create("IconHeight", typeof(int), typeof(MultilineCell), 0);
+
+        public BaseTypeCell()
+        {
+            Disappearing += (sender, e) =>
+            {
+                Icon?.Cancel();
+            };
+        }
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        public string TextEnd
+        {
+            get { return (string)GetValue(TextEndProperty); }
+            set { SetValue(TextEndProperty, value); }
+        }
+
+        public string Sub
+        {
+            get { return (string)GetValue(SubProperty); }
+            set { SetValue(SubProperty, value); }
+        }
+
+        [TypeConverter(typeof(ImageSourceConverter))]
+        public ImageSource Icon
+        {
+            get { return (ImageSource)GetValue(IconProperty); }
+            set { SetValue(IconProperty, value); }
+        }
+
+        public bool IsCheckVisible
+        {
+            get { return (bool)GetValue(IsCheckVisibleProperty); }
+            set { SetValue(IsCheckVisibleProperty, value); }
+        }
+
+        public bool IsChecked
+        {
+            get { return (bool)GetValue(IsCheckedProperty); }
+            set { SetValue(IsCheckedProperty, value); }
+        }
+
+        public int IconWidth
+        {
+            get { return (int)GetValue(IconWidthProperty); }
+            set { SetValue(IconWidthProperty, value); }
+        }
+
+        public int IconHeight
+        {
+            get { return (int)GetValue(IconHeightProperty); }
+            set { SetValue(IconHeightProperty, value); }
+        }
+
+        public event EventHandler<ToggledEventArgs> Toggled;
+
+        void OnSourcePropertyChanged(ImageSource oldvalue, ImageSource newvalue)
+        {
+            if (newvalue != null)
+            {
+                SetInheritedBindingContext(newvalue, BindingContext);
+            }
+        }
+    }
+}
diff --git a/Tizen.Xamarin.Forms.Extension/Cells/DoubleLabelCell.cs b/Tizen.Xamarin.Forms.Extension/Cells/DoubleLabelCell.cs
new file mode 100644 (file)
index 0000000..58d2409
--- /dev/null
@@ -0,0 +1,91 @@
+using Xamarin.Forms;
+
+namespace Tizen.Xamarin.Forms.Extension
+{
+    public class DoubleLabelCell : Cell
+    {
+        public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(DoubleLabelCell), default(string));
+
+        public static readonly BindableProperty SubProperty = BindableProperty.Create("Sub", typeof(string), typeof(DoubleLabelCell), default(string));
+
+        public static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(ImageSource), typeof(DoubleLabelCell), null,
+            propertyChanged: (bindable, oldvalue, newvalue) => ((DoubleLabelCell)bindable).OnSourcePropertyChanged((ImageSource)oldvalue, (ImageSource)newvalue));
+
+        public static readonly BindableProperty IconWidthProperty = BindableProperty.Create("IconWidth", typeof(int), typeof(DoubleLabelCell), 0);
+
+        public static readonly BindableProperty IconHeightProperty = BindableProperty.Create("IconHeight", typeof(int), typeof(DoubleLabelCell), 0);
+
+        public static readonly BindableProperty EndProperty = BindableProperty.Create("End", typeof(ImageSource), typeof(DoubleLabelCell), null,
+            propertyChanged: (bindable, oldvalue, newvalue) => ((DoubleLabelCell)bindable).OnSourcePropertyChanged((ImageSource)oldvalue, (ImageSource)newvalue));
+
+        public static readonly BindableProperty EndWidthProperty = BindableProperty.Create("EndWidth", typeof(int), typeof(DoubleLabelCell), 0);
+
+        public static readonly BindableProperty EndHeightProperty = BindableProperty.Create("EndHeight", typeof(int), typeof(DoubleLabelCell), 0);
+
+        public DoubleLabelCell()
+        {
+            Disappearing += (sender, e) =>
+            {
+                Icon?.Cancel();
+            };
+        }
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        public string Sub
+        {
+            get { return (string)GetValue(SubProperty); }
+            set { SetValue(SubProperty, value); }
+        }
+
+        [TypeConverter(typeof(ImageSourceConverter))]
+        public ImageSource Icon
+        {
+            get { return (ImageSource)GetValue(IconProperty); }
+            set { SetValue(IconProperty, value); }
+        }
+
+        public int IconWidth
+        {
+            get { return (int)GetValue(IconWidthProperty); }
+            set { SetValue(IconWidthProperty, value); }
+        }
+
+        public int IconHeight
+        {
+            get { return (int)GetValue(IconHeightProperty); }
+            set { SetValue(IconHeightProperty, value); }
+        }
+
+        [TypeConverter(typeof(ImageSourceConverter))]
+        public ImageSource End
+        {
+            get { return (ImageSource)GetValue(EndProperty); }
+            set { SetValue(EndProperty, value); }
+        }
+
+        public int EndWidth
+        {
+            get { return (int)GetValue(EndWidthProperty); }
+            set { SetValue(EndWidthProperty, value); }
+        }
+
+        public int EndHeight
+        {
+            get { return (int)GetValue(IconHeightProperty); }
+            set { SetValue(IconHeightProperty, value); }
+        }
+
+        void OnSourcePropertyChanged(ImageSource oldvalue, ImageSource newvalue)
+        {
+            if (newvalue != null)
+            {
+                SetInheritedBindingContext(newvalue, BindingContext);
+            }
+        }
+    }
+}
diff --git a/Tizen.Xamarin.Forms.Extension/Cells/MultilineCell.cs b/Tizen.Xamarin.Forms.Extension/Cells/MultilineCell.cs
new file mode 100644 (file)
index 0000000..f0f03e2
--- /dev/null
@@ -0,0 +1,90 @@
+using System;
+using Xamarin.Forms;
+
+namespace Tizen.Xamarin.Forms.Extension
+{
+    public class MultilineCell : Cell
+    {
+        public static readonly BindableProperty TextProperty = BindableProperty.Create("Text", typeof(string), typeof(MultilineCell), default(string));
+
+        public static readonly BindableProperty MultilineProperty = BindableProperty.Create("Multiline", typeof(string), typeof(TextCell), default(string));
+
+        public static readonly BindableProperty IconProperty = BindableProperty.Create("Icon", typeof(ImageSource), typeof(MultilineCell), null,
+            propertyChanged: (bindable, oldvalue, newvalue) => ((MultilineCell)bindable).OnSourcePropertyChanged((ImageSource)oldvalue, (ImageSource)newvalue));
+
+        public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create("IsChecked", typeof(bool), typeof(MultilineCell), false,
+            propertyChanged: (obj, oldValue, newValue) =>
+            {
+                var multilineCell = (MultilineCell)obj;
+                multilineCell.Toggled?.Invoke(obj, new ToggledEventArgs((bool)newValue));
+            }, defaultBindingMode: BindingMode.TwoWay);
+
+        public static readonly BindableProperty IsCheckVisibleProperty = BindableProperty.Create("IsCheckVisible", typeof(bool), typeof(MultilineCell), false);
+
+        public static readonly BindableProperty IconWidthProperty = BindableProperty.Create("IconWidth", typeof(int), typeof(MultilineCell), 0);
+
+        public static readonly BindableProperty IconHeightProperty = BindableProperty.Create("IconHeight", typeof(int), typeof(MultilineCell), 0);
+
+
+        public MultilineCell()
+        {
+            Disappearing += (sender, e) =>
+            {
+                Icon?.Cancel();
+            };
+        }
+
+        public string Text
+        {
+            get { return (string)GetValue(TextProperty); }
+            set { SetValue(TextProperty, value); }
+        }
+
+        public string Multiline
+        {
+            get { return (string)GetValue(MultilineProperty); }
+            set { SetValue(MultilineProperty, value); }
+        }
+
+        [TypeConverter(typeof(ImageSourceConverter))]
+        public ImageSource Icon
+        {
+            get { return (ImageSource)GetValue(IconProperty); }
+            set { SetValue(IconProperty, value); }
+        }
+
+        public bool IsCheckVisible
+        {
+            get { return (bool)GetValue(IsCheckVisibleProperty); }
+            set { SetValue(IsCheckVisibleProperty, value); }
+        }
+
+        public bool IsChecked
+        {
+            get { return (bool)GetValue(IsCheckedProperty); }
+            set { SetValue(IsCheckedProperty, value); }
+        }
+
+        public int IconWidth
+        {
+            get { return (int)GetValue(IconWidthProperty); }
+            set { SetValue(IconWidthProperty, value); }
+        }
+
+        public int IconHeight
+        {
+            get { return (int)GetValue(IconHeightProperty); }
+            set { SetValue(IconHeightProperty, value); }
+        }
+
+        public event EventHandler<ToggledEventArgs> Toggled;
+
+        void OnSourcePropertyChanged(ImageSource oldvalue, ImageSource newvalue)
+        {
+            if (newvalue != null)
+            {
+                SetInheritedBindingContext(newvalue, BindingContext);
+            }
+        }
+    }
+}
diff --git a/Tizen.Xamarin.Forms.Extension/Cells/Type1Cell.cs b/Tizen.Xamarin.Forms.Extension/Cells/Type1Cell.cs
new file mode 100644 (file)
index 0000000..88e8e50
--- /dev/null
@@ -0,0 +1,8 @@
+using Xamarin.Forms;
+
+namespace Tizen.Xamarin.Forms.Extension
+{
+    public class Type1Cell : BaseTypeCell
+    {
+    }
+}
diff --git a/Tizen.Xamarin.Forms.Extension/Cells/Type2Cell.cs b/Tizen.Xamarin.Forms.Extension/Cells/Type2Cell.cs
new file mode 100644 (file)
index 0000000..b185e48
--- /dev/null
@@ -0,0 +1,8 @@
+using Xamarin.Forms;
+
+namespace Tizen.Xamarin.Forms.Extension
+{
+    public class Type2Cell : BaseTypeCell
+    {
+    }
+}
diff --git a/Tizen.Xamarin.Forms.Extension/Properties/AssemblyInfo.cs b/Tizen.Xamarin.Forms.Extension/Properties/AssemblyInfo.cs
new file mode 100644 (file)
index 0000000..28da6bc
--- /dev/null
@@ -0,0 +1,15 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using Xamarin.Forms;
+
+[assembly: AssemblyVersion("0.0.1")]
+[assembly: AssemblyCompany("Samsung Electronics")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCopyright("Copyright © Samsung Electronics 2016")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyProduct("Tizen")]
+[assembly: AssemblyTitle("Tizen.Xamarin.Forms.Extension")]
+[assembly: AssemblyTrademark("")]
+[assembly: CompilationRelaxations(8)]
+[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
diff --git a/Tizen.Xamarin.Forms.Extension/Tizen.Xamarin.Forms.Extension.csproj b/Tizen.Xamarin.Forms.Extension/Tizen.Xamarin.Forms.Extension.csproj
new file mode 100644 (file)
index 0000000..41a6509
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />\r
+  <PropertyGroup>\r
+    <MinimumVisualStudioVersion>10.0</MinimumVisualStudioVersion>\r
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>\r
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>\r
+    <ProjectGuid>{62531FB2-271B-4669-804E-7287A744CFD0}</ProjectGuid>\r
+    <OutputType>Library</OutputType>\r
+    <AppDesignerFolder>Properties</AppDesignerFolder>\r
+    <RootNamespace>Tizen.Xamarin.Forms.Extension</RootNamespace>\r
+    <AssemblyName>Tizen.Xamarin.Forms.Extension</AssemblyName>\r
+    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+    <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>\r
+    <FileAlignment>512</FileAlignment>\r
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\r
+    <NuGetPackageImportStamp>\r
+    </NuGetPackageImportStamp>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <DebugType>full</DebugType>\r
+    <Optimize>false</Optimize>\r
+    <OutputPath>bin\Debug\</OutputPath>\r
+    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>\r
+    <NoWarn>\r
+    </NoWarn>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
+    <DebugType>pdbonly</DebugType>\r
+    <Optimize>true</Optimize>\r
+    <OutputPath>bin\Release\</OutputPath>\r
+    <DefineConstants>TRACE</DefineConstants>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <WarningLevel>4</WarningLevel>\r
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>\r
+    <NoWarn>\r
+    </NoWarn>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'">\r
+    <DebugSymbols>true</DebugSymbols>\r
+    <OutputPath>bin\Turkey\</OutputPath>\r
+    <DefineConstants>DEBUG;TRACE</DefineConstants>\r
+    <DebugType>full</DebugType>\r
+    <PlatformTarget>AnyCPU</PlatformTarget>\r
+    <ErrorReport>prompt</ErrorReport>\r
+    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\r
+    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>\r
+    <NoWarn>\r
+    </NoWarn>\r
+  </PropertyGroup>\r
+  <ItemGroup>\r
+    <Compile Include="Cells\Type1Cell.cs" />\r
+    <Compile Include="Cells\DoubleLabelCell.cs" />\r
+    <Compile Include="Cells\Type2Cell.cs" />\r
+    <Compile Include="Cells\BaseTypeCell.cs" />\r
+    <Compile Include="Cells\MultilineCell.cs" />\r
+    <Compile Include="Properties\AssemblyInfo.cs" />\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <Reference Include="Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Core.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="Xamarin.Forms.Platform, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Platform.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+    <Reference Include="Xamarin.Forms.Xaml, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">\r
+      <HintPath>..\packages\Xamarin.Forms.2.3.3.175\lib\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Xaml.dll</HintPath>\r
+      <Private>True</Private>\r
+    </Reference>\r
+  </ItemGroup>\r
+  <ItemGroup>\r
+    <None Include="packages.config" />\r
+  </ItemGroup>\r
+  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />\r
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">\r
+    <PropertyGroup>\r
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\r
+    </PropertyGroup>\r
+    <Error Condition="!Exists('..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets'))" />\r
+  </Target>\r
+  <Import Project="..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.3.3.175\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.targets')" />\r
+  <!-- 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>
+  -->\r
+</Project>
\ No newline at end of file
diff --git a/Tizen.Xamarin.Forms.Extension/packages.config b/Tizen.Xamarin.Forms.Extension/packages.config
new file mode 100644 (file)
index 0000000..97f92f4
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<packages>\r
+  <package id="Xamarin.Forms" version="2.3.3.175" targetFramework="portable45-net45+win8+wp8+wpa81" />\r
+</packages>
\ No newline at end of file