Example #1
0
        void OnClicked(object sender, EventArgs e)
        {
            int i = 0;

            _dialog            = new Native.Dialog(Forms.NativeParent);
            _list              = new List(_dialog);
            _dialog.AlignmentX = -1;
            _dialog.AlignmentY = -1;

            _dialog.Title              = Element.Title;
            _dialog.Dismissed         += OnDialogDismissed;
            _dialog.BackButtonPressed += (object senders, EventArgs es) =>
            {
                _dialog.Dismiss();
            };

            foreach (var s in Element.Items)
            {
                ListItem item = _list.Append(s);
                _itemToItemNumber[item] = i;
                i++;
            }
            _list.ItemSelected += OnItemSelected;
            _dialog.Content     = _list;

            _dialog.Show();
            _list.Show();
        }
Example #2
0
        void ShowActivityIndicatorDialog(bool enabled)
        {
            if (null == _pageBusyDialog)
            {
                _pageBusyDialog = new Native.Dialog(Forms.Context.MainWindow)
                {
                    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;
            }
        }
Example #3
0
 void CleanView()
 {
     if (null != _list)
     {
         _list.Unrealize();
         _itemToItemNumber.Clear();
         _list = null;
     }
     if (null != _dialog)
     {
         _dialog.Unrealize();
         _dialog = null;
     }
 }
Example #4
0
        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 = new Native.Dialog(Forms.NativeParent);
            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();
        }
Example #5
0
        void OnBusySetRequest(Page sender, bool enabled)
        {
            // Verify that the page making the request is child of this platform
            if (!_platform.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;
            }
        }
Example #6
0
        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();
        }
Example #7
0
        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(XPage sender, ActionSheetArguments arguments)
        {
            Native.Dialog dialog = Native.Dialog.CreateDialog(Forms.NativeParent);
            dialog.Title = arguments.Title;

            Box box = new Box(dialog);

            if (null != arguments.Destruction)
            {
                Native.Button destruction = new Native.Button(dialog)
                {
                    Text       = arguments.Destruction,
                    Style      = ButtonStyle.Text,
                    TextColor  = EColor.Red,
                    AlignmentX = -1
                };
                destruction.Clicked += (s, evt) =>
                {
                    arguments.SetResult(arguments.Destruction);
                    dialog.Dismiss();
                };
                destruction.Show();
                box.PackEnd(destruction);
            }

            foreach (string buttonName in arguments.Buttons)
            {
                Native.Button button = new Native.Button(dialog)
                {
                    Text            = buttonName,
                    BackgroundColor = buttonName.ToColor(),
                    AlignmentX      = -1,
                    MinimumWidth    = 400
                };

                if (button.BackgroundColor == EColor.White || button.BackgroundColor == ColorExtensions.Azure)
                {
                    button.TextColor = EColor.Black;
                }

                button.Clicked += (s, evt) =>
                {
                    arguments.SetResult(buttonName);
                    dialog.Dismiss();
                };
                button.Show();
                box.PackEnd(button);
            }

            box.Show();
            dialog.Content = box;

            if (null != arguments.Cancel)
            {
                EButton cancel = new EButton(dialog)
                {
                    Text = arguments.Cancel
                };
                dialog.NegativeButton = cancel;
                cancel.Clicked       += (s, evt) =>
                {
                    dialog.Dismiss();
                };
            }

            dialog.BackButtonPressed += (s, evt) =>
            {
                dialog.Dismiss();
            };

            dialog.Show();
        }
Example #9
0
        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 = new Native.Dialog(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,
                    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.NativeParent)
                {
                    Text = arguments.Cancel
                };
                alert.NegativeButton = cancel;
                cancel.Clicked      += (s, evt) =>
                {
                    alert.Dismiss();
                };
            }

            alert.BackButtonPressed += (s, evt) =>
            {
                alert.Dismiss();
            };

            alert.Show();
        }
Example #10
0
        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();
        }