protected void OpenWindowPage(IPage page) { var gtkPage = (IGtkWindowPage)page; IWindowDialogSettings windowSettings = (IWindowDialogSettings)page.ViewModel; gtkPage.GtkView = viewResolver.Resolve(page.ViewModel); if (gtkPage.GtkView == null) { throw new InvalidOperationException($"View для {page.ViewModel.GetType()} не создано через {viewResolver.GetType()}."); } gtkPage.GtkDialog = new Gtk.Dialog(gtkPage.ViewModel.Title, windowSettings.IsModal ? tdiNotebook.Toplevel as Window : null, windowSettings.IsModal ? DialogFlags.Modal : DialogFlags.DestroyWithParent); var defaultsize = gtkPage.GtkView.GetType().GetAttribute <WindowSizeAttribute>(true); gtkPage.GtkDialog.SetDefaultSize(defaultsize?.DefaultWidth ?? gtkPage.GtkView.WidthRequest, defaultsize?.DefaultHeight ?? gtkPage.GtkView.WidthRequest); gtkPage.GtkDialog.VBox.Add(gtkPage.GtkView); if (windowSettings.EnableMinimizeMaximize) { gtkPage.GtkDialog.TypeHint = Gdk.WindowTypeHint.Normal; } gtkPage.GtkView.Show(); gtkPage.GtkDialog.Show(); MoveWindow(gtkPage.GtkDialog, windowSettings.WindowPosition); gtkPage.GtkDialog.DeleteEvent += GtkDialog_DeleteEvent; gtkPage.ViewModel.PropertyChanged += (sender, e) => gtkPage.GtkDialog.Title = gtkPage.ViewModel.Title; }
protected override void OpenPage(IPage masterPage, IPage page) { //FIXME Временное решение пока не выпилим TDi, и реализуем заполнение этого через конструктор. page.ViewModel.NavigationManager = this; pages.Add(page); var gtkPage = (IGtkWindowPage)page; IWindowDialogSettings windowSettings = page.ViewModel as IWindowDialogSettings; var gtkMasterPage = (IGtkWindowPage)masterPage; gtkPage.GtkView = viewResolver.Resolve(page.ViewModel); if (gtkPage.GtkView == null) { throw new InvalidOperationException($"View для {page.ViewModel.GetType()} не создано через {viewResolver.GetType()}."); } var isModal = windowSettings?.IsModal ?? false; gtkPage.GtkDialog = new Gtk.Dialog(gtkPage.ViewModel.Title, isModal ? gtkMasterPage?.GtkDialog : null, isModal ? DialogFlags.Modal : DialogFlags.DestroyWithParent); var defaultsize = gtkPage.GtkView.GetType().GetAttribute <WindowSizeAttribute>(true); gtkPage.GtkDialog.SetDefaultSize(defaultsize?.DefaultWidth ?? gtkPage.GtkView.WidthRequest, defaultsize?.DefaultHeight ?? gtkPage.GtkView.WidthRequest); gtkPage.GtkDialog.VBox.Add(gtkPage.GtkView); if (windowSettings?.EnableMinimizeMaximize ?? true) { gtkPage.GtkDialog.TypeHint = Gdk.WindowTypeHint.Normal; } gtkPage.GtkView.Show(); gtkPage.GtkDialog.Show(); gtkPage.GtkDialog.DeleteEvent += GtkDialog_DeleteEvent; gtkPage.ViewModel.PropertyChanged += (sender, e) => gtkPage.GtkDialog.Title = gtkPage.ViewModel.Title; }