public T ShowDialog <T>(BaseModelView modelView = null) where T : Window { T window = Activator.CreateInstance <T>(); window.Owner = Application.Current.MainWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.DataContext = modelView; window.Show(); return(window); }
public MainWindow() { viewProfile = new BaseModelView(); InitializeComponent(); this.DataContext = viewProfile; Main.Content = new InfoError("Hello! Use the panel above to search for the summoner"); MenuBar.Visibility = Visibility.Hidden; GeneralButton.Foreground = Brushes.Purple; }
public void ShowDialogThreadSafe(Window window, BaseModelView modelView = null) { window.Owner = Application.Current.MainWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.DataContext = modelView; //window.ShowDialog(); //wizard.CreateUi(); //bool? dialogResult = wizard.ShowDialog(); window.Dispatcher.Invoke(DispatcherPriority.Normal, new ThreadStart(window.Show)); //if (dialogResult.HasValue) //{ // return dialogResult.Value; //} //return false; }
public bool ShowWizard <T>(BaseModelView modelView = null) where T : Wizard { T wizard = Activator.CreateInstance <T>(); wizard.Owner = Application.Current.MainWindow; wizard.WindowStartupLocation = WindowStartupLocation.CenterOwner; wizard.DataContext = modelView; wizard.CreateUi(); bool?dialogResult = wizard.ShowDialog(); if (dialogResult.HasValue) { return(dialogResult.Value); } return(false); }