public static DialogControl <T> ShowDialog(ScrumSurface surface, MessageDialog.OptionTypes opts) { Func <DialogControl <T> > f = new Func <DialogControl <T> >(() => { DialogControl <T> dia = new DialogControl <T>(surface, opts); return(dia); }); if (Application.Current.Dispatcher.CheckAccess()) { return(f.Invoke()); } else { return((DialogControl <T>)Application.Current.Dispatcher.Invoke(f)); } }
/// <summary> /// Zeigt ein Meldungsdialog mit den angegebenen Button-Optionen an /// </summary> /// <param name="surface">Die Oberfläche</param> /// <param name="dia">Die Buttons, die angezeigt werden sollen (im Nachrichten dialog)</param> public DialogControl(ScrumSurface surface, MessageDialog.OptionTypes dia) : base(surface) { InstantClosing = false; ConstructorInfo info = typeof(T).GetConstructor(new Type[2] { typeof(SurfaceObject), typeof(MessageDialog.OptionTypes) }); _dialog = (T)info.Invoke(new object[2] { this, dia }); this.Root.Children.Add(_dialog); _dialog.DialogFinished += _dialog_DialogFinished; _layer = new NoTouchLayer(surface); Surface.SizeChanged += Surface_SizeChanged; BringToFront(); this.Loaded += (s, e) => { this.MoveCenter(surface.ActualWidth / 2, surface.ActualHeight / 2); }; }
public static DialogControl <T> ShowDialog(ScrumSurface surface, DialogInfo info, MessageDialog.OptionTypes types) { DialogControl <T> dia = ShowDialog(surface, types); dia.InitializeDialog(info); return(dia); }