Skip to content
This repository has been archived by the owner on Dec 28, 2023. It is now read-only.

Add CircularShell #226

Merged
merged 14 commits into from
Jan 29, 2020
Merged
33 changes: 33 additions & 0 deletions sample/ShellExamples/FlyoutExample/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Xamarin.Forms;
using Tizen.Wearable.CircularUI.Forms;

namespace FlyoutExample
{
public class App : Application
{
public App()
{
MainPage = new AppShell();
}

protected override void OnStart()
{
// Handle when your app starts
}

protected override void OnSleep()
{
// Handle when your app sleeps
}

protected override void OnResume()
{
// Handle when your app resumes
}
}
}
36 changes: 36 additions & 0 deletions sample/ShellExamples/FlyoutExample/AppShell.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<w:CircularShell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:w="clr-namespace:Tizen.Wearable.CircularUI.Forms;assembly=Tizen.Wearable.CircularUI.Forms"
xmlns:local="clr-namespace:FlyoutExample"
x:Class="FlyoutExample.AppShell" FlyoutIcon="favorite.png">
<ShellItem Route="Main" Title="Main" Icon="home.png">
<ShellContent Route="content" ContentTemplate="{DataTemplate local:SimplePage}"/>
</ShellItem>
<ShellItem Route="Config" Title="Config" Icon="play.png">
<ShellContent Route="content" ContentTemplate="{DataTemplate local:ConfigPage}"/>
</ShellItem>
<ShellItem Route="Level0" FlyoutDisplayOptions="AsMultipleItems">
<ShellSection Route="Level1-1" Title="Level1-1" Icon="favorite.png">
<ShellContent Route="Level2" ContentTemplate="{DataTemplate local:SimplePage}"/>
</ShellSection>
<ShellSection Route="Level1-2" Title="Level1-2" FlyoutDisplayOptions="AsMultipleItems">
<ShellContent Route="Level2-0" Title="Level2-0" Icon="work.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-1" Title="Level2-1" Icon="play.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-2" Title="Level2-2" Icon="inbox.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-3" Title="Level2-3" Icon="work.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-4" Title="Level2-4" Icon="play.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-5" Title="Level2-5" Icon="inbox.png" ContentTemplate="{DataTemplate local:RandomColorPage}"/>
<ShellContent Route="Level2-6" Title="Level2-6" Icon="inbox.png">
<ContentPage>
<StackLayout>
<Button Text="Click"/>
</StackLayout>
</ContentPage>
</ShellContent>
</ShellSection>
<ShellContent Route="Level1-3" Title="Level1-3" ContentTemplate="{DataTemplate local:SimplePage}"/>
</ShellItem>
<MenuItem Text="Menu1" Command="{Binding OnMenu1}"/>
<MenuItem Text="Menu2" Command="{Binding OnMenu2}"/>
</w:CircularShell>
28 changes: 28 additions & 0 deletions sample/ShellExamples/FlyoutExample/AppShell.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Tizen.Wearable.CircularUI.Forms;

namespace FlyoutExample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class AppShell : CircularShell
{
public AppShell()
{
InitializeComponent();
BindingContext = this;
}


public Command OnMenu1 => new Command(() =>
{
DisplayAlert("menu", "Menu1 clicked", "Ok");
});

public Command OnMenu2 => new Command(() =>
{
DisplayAlert("menu", "Menu2 clicked", "Ok");
});
}
}
16 changes: 16 additions & 0 deletions sample/ShellExamples/FlyoutExample/ConfigPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="FlyoutExample.ConfigPage">
<ContentPage.Content>
<StackLayout VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand">
<StackLayout Orientation="Horizontal">
<Label> Flyout enable</Label>
<Switch x:Name="FlyoutSwitch" Toggled="Switch_Toggled"/>
</StackLayout>
<Button Text="Change Icon" Clicked="Button_Clicked"/>
<Button Text="Set Default" Clicked="Button_Clicked_1"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
45 changes: 45 additions & 0 deletions sample/ShellExamples/FlyoutExample/ConfigPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace FlyoutExample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ConfigPage : ContentPage
{
ImageSource _imgSource1 = ImageSource.FromFile("home.png");
ImageSource _imgSource2 = ImageSource.FromFile("play.png");
public ConfigPage ()
{
InitializeComponent();
FlyoutSwitch.IsToggled = Shell.Current.FlyoutBehavior == FlyoutBehavior.Flyout;
}

void Switch_Toggled(object sender, ToggledEventArgs e)
{
Shell.Current.FlyoutBehavior = e.Value ? FlyoutBehavior.Flyout : FlyoutBehavior.Disabled;
}

void Button_Clicked(object sender, EventArgs e)
{
if (Shell.Current.FlyoutIcon != _imgSource1)
{
Shell.Current.FlyoutIcon = _imgSource1;
}
else
{
Shell.Current.FlyoutIcon = _imgSource2;
}
}

void Button_Clicked_1(object sender, EventArgs e)
{
Shell.Current.FlyoutIcon = null;
}
}
}
23 changes: 23 additions & 0 deletions sample/ShellExamples/FlyoutExample/FlyoutExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using Xamarin.Forms;

namespace FlyoutExample
{
class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
{
protected override void OnCreate()
{
base.OnCreate();

LoadApplication(new App());
}

static void Main(string[] args)
{
var app = new Program();
Forms.Init(app);
global::Tizen.Wearable.CircularUI.Forms.Renderer.FormsCircularUI.Init();
app.Run(args);
}
}
}
32 changes: 32 additions & 0 deletions sample/ShellExamples/FlyoutExample/FlyoutExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Project Sdk="Tizen.NET.Sdk/1.0.8">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>tizen40</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<Folder Include="lib\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.4.0.991265" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Tizen.Wearable.CircularUI.Forms.Renderer\Tizen.Wearable.CircularUI.Forms.Renderer.csproj" />
<ProjectReference Include="..\..\..\src\Tizen.Wearable.CircularUI.Forms\Tizen.Wearable.CircularUI.Forms.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="ConfigPage.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
</ItemGroup>
</Project>

37 changes: 37 additions & 0 deletions sample/ShellExamples/FlyoutExample/FlyoutExample.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.902
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FlyoutExample", "FlyoutExample.csproj", "{C4EB5189-112A-4FDD-8691-C70051EEDAD7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Wearable.CircularUI.Forms", "..\..\..\src\Tizen.Wearable.CircularUI.Forms\Tizen.Wearable.CircularUI.Forms.csproj", "{FE06EF64-B2D7-4ACE-8282-C030261A3B72}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Wearable.CircularUI.Forms.Renderer", "..\..\..\src\Tizen.Wearable.CircularUI.Forms.Renderer\Tizen.Wearable.CircularUI.Forms.Renderer.csproj", "{AE954347-4639-4071-9FE1-8DBD881EE848}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C4EB5189-112A-4FDD-8691-C70051EEDAD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4EB5189-112A-4FDD-8691-C70051EEDAD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4EB5189-112A-4FDD-8691-C70051EEDAD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4EB5189-112A-4FDD-8691-C70051EEDAD7}.Release|Any CPU.Build.0 = Release|Any CPU
{FE06EF64-B2D7-4ACE-8282-C030261A3B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE06EF64-B2D7-4ACE-8282-C030261A3B72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE06EF64-B2D7-4ACE-8282-C030261A3B72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE06EF64-B2D7-4ACE-8282-C030261A3B72}.Release|Any CPU.Build.0 = Release|Any CPU
{AE954347-4639-4071-9FE1-8DBD881EE848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE954347-4639-4071-9FE1-8DBD881EE848}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE954347-4639-4071-9FE1-8DBD881EE848}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE954347-4639-4071-9FE1-8DBD881EE848}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {71F3DB88-4479-4179-8FED-E60F9A0D131A}
EndGlobalSection
EndGlobal
49 changes: 49 additions & 0 deletions sample/ShellExamples/FlyoutExample/RandomColorPage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xamarin.Forms;

namespace FlyoutExample
{
public class RandomColorPage : ContentPage
{
Label Title;
public RandomColorPage()
{
Console.WriteLine("Create RandomColorPage");
var rand = new Random();
Title = new Label()
{
HorizontalOptions = LayoutOptions.CenterAndExpand,
VerticalOptions = LayoutOptions.CenterAndExpand,
};
var color = Color.FromRgb(rand.Next(255), rand.Next(255), rand.Next(255));
Content = new StackLayout
{
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = color,
Children =
{
new Label
{
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.Center,
Text = $"Color : {color.ToHex()}"
},
Title,
}
};
}

protected override void OnAppearing()
{
base.OnAppearing();
Device.BeginInvokeOnMainThread(() =>
{
Title.Text = Shell.Current.CurrentState.Location.ToString();
});
}
}
}
14 changes: 14 additions & 0 deletions sample/ShellExamples/FlyoutExample/SimplePage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<w:CirclePage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:w="clr-namespace:Tizen.Wearable.CircularUI.Forms;assembly=Tizen.Wearable.CircularUI.Forms"
BackgroundImageSource="bg.jpg"
x:Class="FlyoutExample.SimplePage">
<ContentPage.Content>
<StackLayout BackgroundColor="White" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label x:Name="Title"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage.Content>
</w:CirclePage>
29 changes: 29 additions & 0 deletions sample/ShellExamples/FlyoutExample/SimplePage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tizen.Wearable.CircularUI.Forms;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace FlyoutExample
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class SimplePage : CirclePage
{
public SimplePage()
{
InitializeComponent();
}

protected override void OnAppearing()
{
base.OnAppearing();
Device.BeginInvokeOnMainThread(() =>
{
Title.Text = Shell.Current.CurrentState.Location.ToString();
});
}
}
}
Binary file added sample/ShellExamples/FlyoutExample/res/favorite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/ShellExamples/FlyoutExample/res/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/ShellExamples/FlyoutExample/res/inbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/ShellExamples/FlyoutExample/res/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added sample/ShellExamples/FlyoutExample/res/work.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions sample/ShellExamples/FlyoutExample/tizen-manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="4" package="org.tizen.example.FlyoutExample" version="1.0.0">
<profile name="wearable" />
<ui-application appid="org.tizen.example.FlyoutExample"
exec="FlyoutExample.dll"
type="dotnet"
multiple="false"
taskmanage="true"
nodisplay="false"
launch_mode="single">
<label>FlyoutExample</label>
<icon>FlyoutExample.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
</ui-application>
</manifest>
Loading