public void ShowWindow <T>(T windowContext) where T : IWindowContext { var window = new ContentWindow(); windowContext.SetCloseAction(() => RunOnUi(window.Close)); window.DataContext = windowContext; window.Owner = CurrentWindow; _windows.Push(window); OnPropertyChanged(nameof(CurrentWindow)); window.ShowDialog(); _windows.Pop(); OnPropertyChanged(nameof(CurrentWindow)); }
private void Button_Add_Click(object sender, RoutedEventArgs e) { try { AddNoteVM addVM = new AddNoteVM(this.connector); AddNoteVC addNote = new AddNoteVC(addVM); ContentWindow window = new ContentWindow("Add Note", addNote); window.SetIcon("addIcon"); window.SetSize(500, 500); window.ShowDialog(); this.mainVM.RefreshNotes(); } catch (Exception ex) { MainVC.logFile.Error(ex); MessageBox.Show(ex.Message); } }