private void HideMainWindow() { if (_mainWindow != null) { _mainWindow.Hide(); _mainWindow = null; } }
private void ShowMainWindow() { var host = _appHost; var win = new MainWindow(host.LogManager, host, host.ServerConfigurationManager, host.UserManager, host.LibraryManager, host.JsonSerializer, host.DisplayPreferencesRepository); win.Show(); _mainWindow = win; }
public static void Shutdown() { if (trayIcon != null) { trayIcon.Visible = false; trayIcon.Dispose (); trayIcon = null; } if (_mainWindow != null) { _mainWindow.HideAll (); _mainWindow.Dispose (); _mainWindow = null; } Application.Quit (); }
private static void RunApplication(ServerApplicationPaths appPaths, ILogManager logManager) { // TODO: Show splash here SystemEvents.SessionEnding += SystemEvents_SessionEnding; // Allow all https requests ServicePointManager.ServerCertificateValidationCallback = _ignoreCertificates; _appHost = new ApplicationHost(appPaths, logManager); var task = _appHost.Init(); Task.WaitAll (task); task = _appHost.RunStartupTasks(); Task.WaitAll (task); // TODO: Hide splash here _mainWindow = new MainWindow (); // Creation of the Icon // Creation of the Icon trayIcon = new StatusIcon(new Pixbuf ("tray.png")); trayIcon.Visible = true; // When the TrayIcon has been clicked. trayIcon.Activate += delegate { }; // Show a pop up menu when the icon has been right clicked. trayIcon.PopupMenu += OnTrayIconPopup; // A Tooltip for the Icon trayIcon.Tooltip = "Media Browser Server"; _mainWindow.ShowAll (); _mainWindow.Visible = false; Application.Run (); }
public static void Restart() { // Second instance will start first, so release the mutex and dispose the http server ahead of time ReleaseMutex (_logger); _appHost.Dispose(); if (trayIcon != null) { trayIcon.Visible = false; trayIcon.Dispose (); trayIcon = null; } if (_mainWindow != null) { _mainWindow.HideAll (); _mainWindow.Dispose (); _mainWindow = null; } Application.Quit (); }