diff options
-rwxr-xr-x[-rw-r--r--] | Xamarin.Forms.Platform.Tizen/FormsApplication.cs | 203 |
1 files changed, 104 insertions, 99 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs index cae21e27..b725443f 100644..100755 --- a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs +++ b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs @@ -118,6 +118,102 @@ namespace Xamarin.Forms.Platform.Tizen SetPage(_application.MainPage); } + static void ActionSheetSignalNameHandler(Page sender, ActionSheetArguments arguments) + { + Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow); + + alert.Title = arguments.Title; + Box box = new Box(alert); + + if (null != arguments.Destruction) + { + Native.Button destruction = new Native.Button(alert) + { + Text = arguments.Destruction, + TextColor = EColor.Red, + AlignmentX = -1 + }; + destruction.Clicked += (s, evt) => + { + arguments.SetResult(arguments.Destruction); + alert.Dismiss(); + }; + destruction.Show(); + box.PackEnd(destruction); + } + + foreach (string buttonName in arguments.Buttons) + { + Native.Button button = new Native.Button(alert) + { + Text = buttonName, + AlignmentX = -1 + }; + button.Clicked += (s, evt) => + { + arguments.SetResult(buttonName); + alert.Dismiss(); + }; + button.Show(); + box.PackEnd(button); + } + + box.Show(); + alert.Content = box; + + if (null != arguments.Cancel) + { + EButton cancel = new EButton(Forms.Context.MainWindow) { Text = arguments.Cancel }; + alert.NegativeButton = cancel; + cancel.Clicked += (s, evt) => + { + alert.Dismiss(); + }; + } + + alert.BackButtonPressed += (s, evt) => + { + alert.Dismiss(); + }; + + alert.Show(); + } + + static void AlertSignalNameHandler(Page sender, AlertArguments arguments) + { + Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow); + alert.Title = arguments.Title; + var message = arguments.Message.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(Environment.NewLine, "<br>"); + alert.Text = message; + + EButton cancel = new EButton(alert) { Text = arguments.Cancel }; + alert.NegativeButton = cancel; + cancel.Clicked += (s, evt) => + { + arguments.SetResult(false); + alert.Dismiss(); + }; + + if (arguments.Accept != null) + { + EButton ok = new EButton(alert) { Text = arguments.Accept }; + alert.NeutralButton = ok; + ok.Clicked += (s, evt) => + { + arguments.SetResult(true); + alert.Dismiss(); + }; + } + + alert.BackButtonPressed += (s, evt) => + { + arguments.SetResult(false); + alert.Dismiss(); + }; + + alert.Show(); + } + void AppOnPropertyChanged(object sender, PropertyChangedEventArgs args) { if ("MainPage" == args.PropertyName) @@ -158,6 +254,11 @@ namespace Xamarin.Forms.Platform.Tizen } } + void BusySetSignalNameHandler(Page sender, bool enabled) + { + ShowActivityIndicatorDialog(enabled); + } + void SetPage(Page page) { if (!Forms.IsInitialized) @@ -169,106 +270,10 @@ namespace Xamarin.Forms.Platform.Tizen _platform.SetPage(page); return; } - MessagingCenter.Subscribe<Page, bool>(this, Page.BusySetSignalName, delegate (Page sender, bool enabled) - { - ShowActivityIndicatorDialog(enabled); - }, null); - - MessagingCenter.Subscribe<Page, AlertArguments>(this, Page.AlertSignalName, delegate (Page sender, AlertArguments arguments) - { - Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow); - alert.Title = arguments.Title; - var message = arguments.Message.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(Environment.NewLine, "<br>"); - alert.Text = message; - - EButton cancel = new EButton(alert) { Text = arguments.Cancel }; - alert.NegativeButton = cancel; - cancel.Clicked += (s, evt) => - { - arguments.SetResult(false); - alert.Dismiss(); - }; - - if (arguments.Accept != null) - { - EButton ok = new EButton(alert) { Text = arguments.Accept }; - alert.NeutralButton = ok; - ok.Clicked += (s, evt) => - { - arguments.SetResult(true); - alert.Dismiss(); - }; - } - - alert.BackButtonPressed += (s, evt) => - { - arguments.SetResult(false); - alert.Dismiss(); - }; - - alert.Show(); - }, null); - - MessagingCenter.Subscribe<Page, ActionSheetArguments>(this, Page.ActionSheetSignalName, delegate (Page sender, ActionSheetArguments arguments) - { - Native.Dialog alert = new Native.Dialog(Forms.Context.MainWindow); - - alert.Title = arguments.Title; - Box box = new Box(alert); - - if (null != arguments.Destruction) - { - Native.Button destruction = new Native.Button(alert) - { - Text = arguments.Destruction, - TextColor = EColor.Red, - AlignmentX = -1 - }; - destruction.Clicked += (s, evt) => - { - arguments.SetResult(arguments.Destruction); - alert.Dismiss(); - }; - destruction.Show(); - box.PackEnd(destruction); - } - - foreach (string buttonName in arguments.Buttons) - { - Native.Button button = new Native.Button(alert) - { - Text = buttonName, - AlignmentX = -1 - }; - button.Clicked += (s, evt) => - { - arguments.SetResult(buttonName); - alert.Dismiss(); - }; - button.Show(); - box.PackEnd(button); - } - - box.Show(); - alert.Content = box; - - if (null != arguments.Cancel) - { - EButton cancel = new EButton(Forms.Context.MainWindow) { Text = arguments.Cancel }; - alert.NegativeButton = cancel; - cancel.Clicked += (s, evt) => - { - alert.Dismiss(); - }; - } - - alert.BackButtonPressed += (s, evt) => - { - alert.Dismiss(); - }; - alert.Show(); - }, null); + MessagingCenter.Subscribe<Page, bool>(this, Page.BusySetSignalName, BusySetSignalNameHandler); + MessagingCenter.Subscribe<Page, AlertArguments>(this, Page.AlertSignalName, AlertSignalNameHandler); + MessagingCenter.Subscribe<Page, ActionSheetArguments>(this, Page.ActionSheetSignalName, ActionSheetSignalNameHandler); _platform = new Platform(this); if (_application != null) |