summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrina6350.you <rina6350.you@samsung.com>2017-07-26 11:05:44 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-10-23 04:34:39 (GMT)
commitba1e535be00c66532bcdd3005d058b36e3b9ea66 (patch)
treea060a334489795031e9aaa073801c140e1c2f1d7
parent20222583e2d4dd5f96f547974ac4e23ebcc82716 (diff)
downloadxamarin-forms-ba1e535be00c66532bcdd3005d058b36e3b9ea66.zip
xamarin-forms-ba1e535be00c66532bcdd3005d058b36e3b9ea66.tar.gz
xamarin-forms-ba1e535be00c66532bcdd3005d058b36e3b9ea66.tar.bz2
Convert delegate to static method for MessagingCenter
Change-Id: I09598eed4c222f10d387bc3dafa0af227107830a
-rwxr-xr-x[-rw-r--r--]Xamarin.Forms.Platform.Tizen/FormsApplication.cs203
1 files changed, 104 insertions, 99 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/FormsApplication.cs b/Xamarin.Forms.Platform.Tizen/FormsApplication.cs
index cae21e2..b725443 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("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").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("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").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)