private static void InitializeMainWindow(Gtk.Window window) { RestoreWindowState(window); var mainWindow = window as IMainWindow; var primaryComponents = CompositionHelpers.Container.GetExportedValues <IPrimaryComponent>(); foreach (var component in primaryComponents) { mainWindow.AddPrimaryComponentVisuals(component, component.GetVisuals()); } var commandProviders = Instance.CommandProviders; window.AddCommandsToMainWindow(commandProviders.Select(c => c.Value)); Instance.ReadyState |= AppReadyState.MainWindowLoaded; window.ConfigureEvent += HandleConfigureEvent; window.Shown += HandleWindowShown; window.DeleteEvent += HandleMainWindowClosed; window.Destroyed += HandleMainWindowDestroyed; window.WindowStateEvent += HandleMainWindowStateChanged; window.ShowAll(); }