/// <summary> /// Handles the event triggered by entry's text being changed. /// </summary> /// <param name="sender">Sender of the event.</param> /// <param name="e">Event arguments.</param> void EntryTextChanged(object sender, TextChangedEventArgs e) { if (string.IsNullOrEmpty(e.NewTextValue)) { _cancelButton.Hide(); } else if (!_cancelButton.IsVisible) { _cancelButton.Show(); } TextChanged?.Invoke(this, e); }
protected void Initialize(EvasObject parent) { SetLayoutCallback(OnLayout); _focusArea = new Button(parent); _focusArea.Color = EColor.Transparent; _focusArea.BackgroundColor = EColor.Transparent; _focusArea.SetEffectColor(EColor.Transparent); _focusArea.Clicked += OnClicked; _focusArea.Focused += OnFocused; _focusArea.Unfocused += OnFocused; _focusArea.KeyUp += OnKeyUp; _focusArea.RepeatEvents = true; _focusArea.Show(); PackEnd(_focusArea); Show(); }
void OnActionSheetRequest(Page sender, ActionSheetArguments arguments) { // Verify that the page making the request is child of this platform if (!_platform.PageIsChildOfPlatform(sender)) { return; } var alert = Native.Dialog.CreateDialog(Forms.NativeParent); alert.Title = arguments.Title; var box = new Box(alert); if (null != arguments.Destruction) { var 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) { var 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) { var 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); }
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(); }
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(); }
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(); }