void AlertSignalNameHandler(Page sender, AlertArguments arguments) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } Native.Dialog alert = Native.Dialog.CreateDialog(Forms.NativeParent, (arguments.Accept != null)); alert.Title = arguments.Title; var message = arguments.Message.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(Environment.NewLine, "<br>"); alert.Message = 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(); _alerts.Add(alert); alert.Dismissed += (s, e) => _alerts.Remove(alert); }
void BusySetSignalNameHandler(Page sender, bool enabled) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } if (null == _pageBusyDialog) { _pageBusyDialog = new Native.Dialog(Forms.NativeParent) { Orientation = PopupOrientation.Center, BackgroundColor = EColor.Transparent }; if (Device.Idiom == TargetIdiom.Phone) { _pageBusyDialog.SetPartColor("bg_title", EColor.Transparent); _pageBusyDialog.SetPartColor("bg_content", EColor.Transparent); } else if (Device.Idiom == TargetIdiom.Watch) { _pageBusyDialog.Style = "circle"; } var activity = new EProgressBar(_pageBusyDialog) { Style = "process_large", IsPulseMode = true, }; activity.PlayPulse(); activity.Show(); _pageBusyDialog.Content = activity; } _pageBusyCount = Math.Max(0, enabled ? _pageBusyCount + 1 : _pageBusyCount - 1); if (_pageBusyCount > 0) { _pageBusyDialog.Show(); } else { _pageBusyDialog.Dismiss(); _pageBusyDialog = null; } }
void BusySetSignalNameHandler(Page sender, bool enabled) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } if (null == _pageBusyDialog) { _pageBusyDialog = new Native.Dialog(Forms.NativeParent) { Orientation = PopupOrientation.Top, }; var activity = new EProgressBar(_pageBusyDialog) { Style = "process_large", IsPulseMode = true, }; activity.PlayPulse(); activity.Show(); _pageBusyDialog.Content = activity; } _pageBusyCount = Math.Max(0, enabled ? _pageBusyCount + 1 : _pageBusyCount - 1); if (_pageBusyCount > 0) { _pageBusyDialog.Show(); } else { _pageBusyDialog.Dismiss(); _pageBusyDialog = null; } }
void ActionSheetSignalNameHandler(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is child of this platform if (!PageIsChildOfPlatform(sender)) { return; } Native.Dialog alert = Native.Dialog.CreateDialog(Forms.NativeParent); alert.Title = arguments.Title; Box box = new Box(alert); if (null != arguments.Destruction) { Native.Button destruction = new Native.Button(alert) { Text = arguments.Destruction, Style = ButtonStyle.Text, 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, Style = ButtonStyle.Text, 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.NativeParent) { Text = arguments.Cancel }; alert.NegativeButton = cancel; cancel.Clicked += (s, evt) => { alert.Dismiss(); }; } alert.BackButtonPressed += (s, evt) => { alert.Dismiss(); }; alert.Show(); _alerts.Add(alert); alert.Dismissed += (s, e) => _alerts.Remove(alert); }