public Task <bool> ConfirmAsync( string message, string title = null, string trueText = null, BorderStyle?trueStyle = null, string falseText = null, BorderStyle?falseStyle = null) { LogInformation("ConfirmAsync(\"{0}\")", message); var task = Interaction.ConfirmAsync( this, message, GetDefaultMessageTitle(title), trueText, trueStyle, falseText, falseStyle); task.ContinueWith(t => { if (t.Status == TaskStatus.RanToCompletion) { LogInformation("ConfirmAsync(\"{0}\") result={1}", message, t.Result); } else if (t.Exception != null) { LogError("ConfirmAsync(\"{0}\") Exception={1}", message, t.Exception); } }); return(task); }
public Task AlertAsync( string message, string title = null, string buttonText = null, BorderStyle?buttonStyle = null) { LogInformation("AlertAsync(\"{0}\")", message); var task = Interaction.AlertAsync( this, message, GetDefaultMessageTitle(title), buttonText, buttonStyle); task.ContinueWith(t => { if (t.Status == TaskStatus.RanToCompletion) { LogInformation("AlertAsync(\"{0}\") closed", message); } else if (t.Exception != null) { LogError("AlertAsync(\"{0}\") Exception={1}", message, t.Exception); } }); return(task); }
/// <summary> /// Initializes a new instance of the BorderStyle class. /// </summary> public BorderStyle(BorderStyle?parent) { _parent = parent; Left = new BorderSideStyle(_parent?.Left); Top = new BorderSideStyle(_parent?.Top); Right = new BorderSideStyle(_parent?.Right); Bottom = new BorderSideStyle(_parent?.Bottom); }
public static T SetStyle <T>(this T builder, BorderStyle?style, bool isOverride = true) where T : CommandBuilderBase { builder.Style = style; if (isOverride) { builder.StyleGetter = null; } return(builder); }
public BorderSide copyWith( Color color = null, float?width = null, BorderStyle?style = null ) { D.assert(width == null || width >= 0.0); return(new BorderSide( color: color ?? this.color, width: width ?? this.width, style: style ?? this.style )); }
private void SetUpBorder(ExcelStyle excelStyle, Color?color, BorderStyle?style) { if (color == null && style == null) { return; } style = style ?? BorderStyle.Thin; if (style == BorderStyle.None) { excelStyle.Border.BorderAround(ExcelBorderStyle.None); return; } if (color == null) { excelStyle.Border.BorderAround((ExcelBorderStyle)((int)style.Value)); return; } excelStyle.Border.BorderAround((ExcelBorderStyle)((int)style.Value), color.Value); }
internal static Tuple <ConsoleColor?, BorderStyle?> ParseBorderNotation(string borderNotation) { ConsoleColor?color = null; BorderStyle? style = null; var split = borderNotation.Split(' '); if (split.Length > 0) { color = StringToConsoleColor(split[0]); } if (split.Length > 1) { style = StringToBorderStyle(split[1]); } else { style = BorderStyle.Solid; } return(Tuple.Create(color, style)); }
public override Task <MessageBoxResult> ShowMessageBoxAsync(object context, string message, string title, string trueText, BorderStyle?trueStyle, string falseText, BorderStyle?falseStyle, MessageBoxButton button, MessageBoxImage icon) { if (GetWindow(context) is MetroWindow mw) { Task <MessageBoxResult> showCore() { if (DialogParticipation.GetRegister(mw) != null) { switch (button) { case MessageBoxButton.YesNo: return(mw.ShowMessageAsync(title, message, MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings { AffirmativeButtonText = !string.IsNullOrEmpty(trueText) ? trueText : "はい", NegativeButtonText = !string.IsNullOrEmpty(falseText) ? falseText : "いいえ", OwnerCanCloseWithDialog = true }).ContinueWith(t => t.Status != TaskStatus.RanToCompletion ? MessageBoxResult.None : t.Result == MessageDialogResult.Affirmative ? MessageBoxResult.Yes : MessageBoxResult.No)); case MessageBoxButton.OK: return(mw.ShowMessageAsync(title, message, MessageDialogStyle.Affirmative, new MetroDialogSettings { AffirmativeButtonText = !string.IsNullOrEmpty(trueText) ? trueText : "OK", OwnerCanCloseWithDialog = true }).ContinueWith(t => t.Status != TaskStatus.RanToCompletion ? MessageBoxResult.None : MessageBoxResult.OK)); } } return(base.ShowMessageBoxAsync(context, message, title, trueText, trueStyle, falseText, falseStyle, button, icon)); } if (mw.Dispatcher.Thread != Thread.CurrentThread) { var tcs = new TaskCompletionSource <MessageBoxResult>(); InvokeAsync(context, () => showCore().ContinueWith(t => { if (t.Status == TaskStatus.RanToCompletion) { tcs.TrySetResult(t.Result); } else if (t.Exception != null) { tcs.TrySetException(t.Exception); } else { tcs.TrySetCanceled(); } }, TaskScheduler.FromCurrentSynchronizationContext())); return(tcs.Task); } return(showCore()); } return(base.ShowMessageBoxAsync(context, message, title, trueText, trueStyle, falseText, falseStyle, button, icon)); }
public void setBorderStyle(BorderStyle borderStyle) { this.borderStyle = borderStyle; }
public virtual Task <bool> ConfirmAsync(object context, string message, string title, string trueText, BorderStyle?trueStyle, string falseText, BorderStyle?falseStyle) => ResolvePage(context)?.DisplayAlert(title ?? string.Empty, message, trueText ?? "OK", falseText ?? "キャンセル") ?? Task.FromException <bool>(new NotSupportedException());
public virtual Task AlertAsync(object context, string message, string title, string buttonText, BorderStyle?buttonStyle) => ResolvePage(context)?.DisplayAlert(title ?? string.Empty, message, buttonText ?? "OK") ?? Task.FromException(new NotSupportedException());
/// <summary> /// set control /// </summary> /// <typeparam name="T"></typeparam> /// <param name="name"></param> /// <param name="text"></param> /// <param name="ds"></param> /// <param name="bc"></param> /// <param name="enable"></param> /// <param name="visiable"></param> /// <param name="backgroundimg"></param> /// <param name="backgroundimglayout"></param> /// <param name="b">多义bool值:label.autosize,textbox.mutiline,listview.checkboxs</param> /// <param name="bs"></param> /// <param name="fs"></param> /// <param name="ca"></param> /// <returns></returns> protected T setc <T>(string name, string text, Color bc, bool enable, bool visiable, Image backgroundimg, ImageLayout backgroundimglayout, DockStyle?ds, bool?b, bool?readOnly, BorderStyle?bs, FlatStyle?fs, ContentAlignment?ca) where T : Control, new() { T t = default(T); t = new T(); t.Name = name; t.Text = text; if (ds != null) { t.Dock = ds.Value; } t.BackColor = bc; t.Enabled = enable; t.Visible = visiable; t.BackgroundImage = backgroundimg; t.BackgroundImageLayout = backgroundimglayout; if (t is Label) { if (b != null) { (t as Label).AutoSize = b.Value; } if (fs != null) { (t as Label).FlatStyle = fs.Value; } if (ca != null) { (t as Label).TextAlign = ca.Value; } } else if (t is Button) { if (fs != null) { (t as Button).FlatStyle = fs.Value; } } else if (t is TextBox) { if (b != null) { (t as TextBox).Multiline = b.Value; } if (bs != null) { (t as TextBox).BorderStyle = bs.Value; } if (readOnly != null) { (t as TextBox).ReadOnly = readOnly.Value; } } else if (t is ComboBox) { if (fs != null) { (t as ComboBox).FlatStyle = fs.Value; } } else if (t is ListView) { if (b != null) { (t as ListView).CheckBoxes = b.Value; } if (bs != null) { (t as ListView).BorderStyle = bs.Value; } } else if (t is ListBox) { if (bs != null) { (t as ListBox).BorderStyle = bs.Value; } } else if (t is TreeView) { if (bs != null) { (t as TreeView).BorderStyle = bs.Value; } } else if (t is PictureBox) { if (bs != null) { (t as PictureBox).BorderStyle = bs.Value; } } else if (t is ListBox) { if (bs != null) { (t as ListBox).BorderStyle = bs.Value; } } return(t); }