private void Draw() { textView = new TextView() { X = 1, Y = 1, Width = Dim.Fill(), Height = Dim.Fill() - 1, ReadOnly = true }; textView.Text = @$ "Grimoire Automation Script Helper. Open source by Kelvys B. Visit the project repository at https://github.com/Kelvysb/Grimoire Version = {Assembly.GetEntryAssembly().GetName().Version} "; Add(textView); btnOk = new Button("Ok", true) { X = Pos.Right(this) - 64, Y = Pos.Bottom(this) - 4 }; btnOk.Clicked = () => Ok.Invoke(); Add(btnOk); }
private void BtnOk_Click(object sender, EventArgs e) { if (CheckedInputDataRow() != true) { return; } Ok?.Invoke(sender, e); }
public void OnOk(AmbilWarnaDialog dialog, int color) { Ok?.Invoke(this, new OnOkEventArgs { Dialog = dialog, Color = color }); }
public ResultScreen(Settings settings) : base(200, 20, ConsoleColor.Black, settings.Color) { ContentPanel.ForeColor = ConsoleColor.DarkGray; Title = "Lemonade - Daily financial report"; lab = new Label(""); ContentPanel.Controls.Add(lab); Input += (screen, args) => Ok?.Invoke(); Close += (screen, args) => Ok?.Invoke(); }
public AnimationScreen(Settings settings) : base(100, 20, Black, settings.Color) { ContentPanel.ForeColor = DarkGray; Title = "Lemonade - Anim"; imgControl = new Image(new Pixel[0, 0]); SetWeather(new Weather(settings)); ContentPanel.Controls.Add(imgControl); Input += (screen, args) => Ok?.Invoke(); Close += (screen, args) => Ok?.Invoke(); }
protected override bool ProcessKeyPressed(AsciiKey key) { switch (key.Key) { case Keys.Enter: Ok?.Invoke(this, EventArgs.Empty); return(true); } return(base.ProcessKeyPressed(key)); }
// Handle Input /// Responds to user input, accepting or cancelling the message box. public override void HandleInput() { if (InputManager.IsActionTriggered(InputManager.Action.Ok)) { // Raise the accepted event, then exit the message box. Ok?.Invoke(this, EventArgs.Empty); AudioManager.PlayCue("closeWindow"); ExitScreen(); } }
private void InitializeControls() { okButton = new StandardButton(20) { Position = new Point(3, Height - 4), Text = "OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); cancelButton = new StandardButton(20) { Position = new Point(27, Height - 4), Text = "Cancel" }; cancelButton.Click += (sender, args) => Cancel?.Invoke(this, EventArgs.Empty); Add(cancelButton); launchEditorButton = new StandardButton(40) { Position = new Point(3, 12), Text = "Launch Code Editor" }; launchEditorButton.Click += (sender, args) => LaunchEditor?.Invoke(this, EventArgs.Empty); Add(launchEditorButton); var textBoxTheme = new TextBoxTheme { Normal = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)), Focused = new Cell(Color.White, Color.FromNonPremultiplied(66, 66, 66, 255)) }; spellNameTextBox = new TextBox(60) { Position = new Point(3, 5), Theme = textBoxTheme, MaxLength = 50 }; Add(spellNameTextBox); manaCostTextBox = new TextBox(15) { Position = new Point(3, 8), IsNumeric = true, AllowDecimal = false, Theme = textBoxTheme, MaxLength = 10 }; Add(manaCostTextBox); }
private void InitializeControls() { okButton = new StandardButton(20) { Position = new Point(3, Height - 4), Text = "OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); DoForAllStats((y, stat) => { AddStatSelector(6, y, stat); }); }
private void InitializeControls() { closeButton = new StandardButton(15) { Position = new Point(Width - 17, Height - 4), Text = "[ESC] Cancel" }; closeButton.Click += (sender, args) => OnExit(); Add(closeButton); okButton = new StandardButton(15) { Position = new Point(Width - 37, Height - 4), Text = "[ENTER] OK" }; okButton.Click += (sender, args) => Ok?.Invoke(this, EventArgs.Empty); Add(okButton); }
private void ok_Click(object sender, System.EventArgs e) { ret.Clear(); List <string> _ret = new List <string>(); foreach (CheckBox box in GetAnswers()) { var itm = item.Answers.FirstOrDefault(a => a.Text == box.Text); if (itm == null) { ret.Add(false); } else { ret.Add(box.Checked == itm.IsCorrect); if (itm.IsCorrect && !box.Checked) { _ret.Add(itm.Text); } } } BackColor = (!ret.All(b => b)) ? Color.IndianRed : Color.LightGreen; var disc = Configuration.Disciplines[0].Tests.FirstOrDefault(t => t.Items.Contains(item)); if (disc?.Type == Type.Обучение && !ret.All(b => b)) { string rt = string.Empty; foreach (string s in _ret) { rt += (rt == string.Empty?"":" и ") + s; } MessageBox.Show($"Ответ не верный. Изучите материал по данной теме.\r\n\r\nПравильны{(_ret.Count>1?"e":"й")} ответ{(_ret.Count > 1 ? "ы" : "")} : {rt}", @"Не верный ответ"); return; } Ok?.Invoke(sender, e); Collapse(); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.View.BackgroundColor = UIColor.Clear; #if __IOS__ var datePicker = new UIDatePicker { TranslatesAutoresizingMaskIntoConstraints = false, Date = this.SelectedDateTime.ToNSDate(), BackgroundColor = BackgroundColor, Mode = Mode, MinuteInterval = MinuteInterval }; if (Use24HourClock == true) { datePicker.Locale = NSLocale.FromLocaleIdentifier("NL"); } if (MinimumDateTime != null) { datePicker.MinimumDate = MinimumDateTime.Value.ToNSDate(); } if (MaximumDateTime != null) { datePicker.MaximumDate = MaximumDateTime.Value.ToNSDate(); } #elif __TVOS__ var datePicker = new UIControl(); //TODO: Fake Date picker on tvOS #endif dimmedView = new UIView(this.View.Bounds) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, TintAdjustmentMode = UIViewTintAdjustmentMode.Dimmed, BackgroundColor = UIColor.Black, Alpha = 0.7F }; var dismissButton = new UIButton { TranslatesAutoresizingMaskIntoConstraints = false, UserInteractionEnabled = true }; dismissButton.TouchUpInside += async(s, e) => { await this.DismissViewControllerAsync(true); this.Cancel?.Invoke(this); }; this.View.AddSubview(dismissButton); var containerView = new UIView { ClipsToBounds = true, BackgroundColor = BackgroundColor, TranslatesAutoresizingMaskIntoConstraints = false }; containerView.Layer.CornerRadius = 5.0f; this.View.AddSubview(containerView); containerView.AddSubview(datePicker); var buttonContainerView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = BackgroundColor }; buttonContainerView.Layer.CornerRadius = 5.0f; this.View.AddSubview(buttonContainerView); var buttonDividerView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.FromRGBA(205 / 255, 205 / 255, 205 / 255, 1) }; this.View.AddSubview(buttonDividerView); var cancelButton = new UIButton(); cancelButton.TranslatesAutoresizingMaskIntoConstraints = false; cancelButton.SetTitle(this.CancelText, UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Red, UIControlState.Normal); cancelButton.TitleLabel.Font = UIFont.SystemFontOfSize(this.FontSize); cancelButton.TouchUpInside += async(s, e) => { await this.DismissViewControllerAsync(true); this.Cancel?.Invoke(this); }; buttonContainerView.AddSubview(cancelButton); var button = new UIButton(UIButtonType.System); button.TranslatesAutoresizingMaskIntoConstraints = false; button.TitleLabel.Font = UIFont.BoldSystemFontOfSize(this.FontSize); button.SetTitle(this.OkText, UIControlState.Normal); button.TouchUpInside += async(s, e) => { #if __IOS__ this.SelectedDateTime = datePicker.Date.ToDateTime(); #endif await this.DismissViewControllerAsync(true); Ok?.Invoke(this); }; buttonContainerView.AddSubview(button); var views = NSDictionary.FromObjectsAndKeys( new NSObject[] { dismissButton, containerView, datePicker, buttonContainerView, buttonDividerView, cancelButton, button }, new NSObject[] { new NSString("DismissButton"), new NSString("DatePickerContainerView"), new NSString("datePicker"), new NSString("ButtonContainerView"), new NSString("ButtonDividerView"), new NSString("CancelButton"), new NSString("SelectButton") } ); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[CancelButton][ButtonDividerView(0.5)][SelectButton(CancelButton)]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[CancelButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[ButtonDividerView]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[SelectButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[datePicker]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[datePicker]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[DismissButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-5-[DatePickerContainerView]-5-|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-5-[ButtonContainerView]-5-|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat($"V:|[DismissButton][DatePickerContainerView]-10-[ButtonContainerView(40)]-{5 + safeAreaInsets.Bottom}-|", 0, null, views)); }
protected virtual void OnOk() { Ok?.Invoke(this, EventArgs.Empty); }
private void Ok_Click(object sender, RoutedEventArgs e) { Ok?.Invoke(); Close(); }
public override void ViewDidLoad() { base.ViewDidLoad(); this.ModalPresentationStyle = UIModalPresentationStyle.Custom; this.TransitioningDelegate = this; this.View.BackgroundColor = UIColor.Clear; // Date Picker var datePicker = new UIDatePicker { TranslatesAutoresizingMaskIntoConstraints = false, Date = this.SelectedDateTime.ToNSDate(), BackgroundColor = BackgroundColor, Mode = Mode, MinuteInterval = MinuteInterval }; if (MinimumDateTime != null) { datePicker.MinimumDate = MinimumDateTime.Value.ToNSDate(); } if (MaximumDateTime != null) { datePicker.MaximumDate = MaximumDateTime.Value.ToNSDate(); } dimmedView = new UIView(this.View.Bounds) { AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight, TintAdjustmentMode = UIViewTintAdjustmentMode.Dimmed, BackgroundColor = UIColor.Black }; var dismissButton = new UIButton { TranslatesAutoresizingMaskIntoConstraints = false, UserInteractionEnabled = true }; dismissButton.TouchUpInside += (s, e) => { Cancel?.Invoke(this); }; this.View.AddSubview(dismissButton); var containerView = new UIView { ClipsToBounds = true, BackgroundColor = UIColor.White, TranslatesAutoresizingMaskIntoConstraints = false }; containerView.Layer.CornerRadius = 5.0f; this.View.AddSubview(containerView); containerView.AddSubview(datePicker); var buttonContainerView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.White }; buttonContainerView.Layer.CornerRadius = 5.0f; this.View.AddSubview(buttonContainerView); var buttonDividerView = new UIView { TranslatesAutoresizingMaskIntoConstraints = false, BackgroundColor = UIColor.FromRGBA(205 / 255, 205 / 255, 205 / 255, 1) }; this.View.AddSubview(buttonDividerView); var cancelButton = new UIButton(); cancelButton.TranslatesAutoresizingMaskIntoConstraints = false; cancelButton.SetTitle(CancelText, UIControlState.Normal); cancelButton.SetTitleColor(UIColor.Red, UIControlState.Normal); cancelButton.TitleLabel.Font = UIFont.SystemFontOfSize(FontSize); cancelButton.TouchUpInside += (s, e) => { Cancel?.Invoke(this); }; buttonContainerView.AddSubview(cancelButton); var button = new UIButton(UIButtonType.System); button.TranslatesAutoresizingMaskIntoConstraints = false; button.TitleLabel.Font = UIFont.BoldSystemFontOfSize(FontSize); button.SetTitle(this.OkText, UIControlState.Normal); button.TouchUpInside += (s, e) => { Ok?.Invoke(this); }; buttonContainerView.AddSubview(button); var views = NSDictionary.FromObjectsAndKeys( new NSObject[] { dismissButton, containerView, datePicker, buttonContainerView, buttonDividerView, cancelButton, button }, new NSObject[] { new NSString("DismissButton"), new NSString("DatePickerContainerView"), new NSString("datePicker"), new NSString("ButtonContainerView"), new NSString("ButtonDividerView"), new NSString("CancelButton"), new NSString("SelectButton") } ); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[CancelButton][ButtonDividerView(0.5)][SelectButton(CancelButton)]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[CancelButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[ButtonDividerView]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[SelectButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[datePicker]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[datePicker]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[DismissButton]|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-5-[DatePickerContainerView]-5-|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-5-[ButtonContainerView]-5-|", 0, null, views)); this.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[DismissButton][DatePickerContainerView]-10-[ButtonContainerView(40)]-5-|", 0, null, views)); }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnOk_OnClick(object sender, RoutedEventArgs e) { Ok?.Invoke(sender, e); }
private void buttonOk_Click(object sender, EventArgs e) => Ok?.Invoke(this, EventArgs.Empty);