public static void Main() { if (!SingleInstanceCheck()) { return; } // If framework is not correct version then quit. if (!FrameworkCheck()) { return; } InitializeParentWindow(); App app = new App(); MenuBarWindow = new MenuBar() { Owner = _parentWindow }; MenuBarWindow.Show(); app.MainWindow = MenuBarWindow; #if (ENABLEFIRSTRUN) FirstRun(app); #endif if (Properties.Settings.Default.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow() { Owner = _parentWindow }; MenuBarShadowWindow.Show(); } if (Properties.Settings.Default.EnableTaskbar) { TaskbarWindow = new Taskbar() { Owner = _parentWindow }; TaskbarWindow.Show(); } if (Properties.Settings.Default.EnableDesktop) { DesktopWindow = new Desktop() { Owner = _parentWindow }; DesktopWindow.Show(); } app.Run(); }
private void EnableDesktop_Click(object sender, RoutedEventArgs e) { bool IsDesktopEnabled = Properties.Settings.Default.EnableDesktop; if (IsDesktopEnabled == true) { Desktop window = new Desktop(); window.Show(); Activate(); } else { if (Startup.DesktopWindow != null) { Startup.DesktopWindow.Close(); } } }
public static void Main(string[] args) { #region Args if (args.Length > 0 && args[0] == "/restart") { isRestart = true; } else { isRestart = false; } if (args.Length > 0 && args[0] == "/tour") { isTour = true; } else { isTour = false; } #endregion #region Single Instance Check bool ok; cairoMutex = new System.Threading.Mutex(true, "CairoShell", out ok); if (!ok && !isRestart) { // Another instance is already running. return; } else if (!ok && isRestart) { // this is a restart so let's wait for the old instance to end System.Threading.Thread.Sleep(2000); } #endregion #region some real shell code int hShellReadyEvent; if (Environment.OSVersion.Platform == PlatformID.Win32NT && Shell.IsWindows2kOrBetter) { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, true, @"Global\msgina: ShellReadyEvent"); } else { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, false, "msgina: ShellReadyEvent"); } if (hShellReadyEvent != 0) { NativeMethods.SetEvent(hShellReadyEvent); NativeMethods.CloseHandle(hShellReadyEvent); } #endregion // an attempt to relaunch explorer it the application gets closed. doesnt work if VS terminates execution // AppDomain.CurrentDomain.ProcessExit += (o, e) => Shutdown(); #region InitializationRoutines SetupLoggingSystem(); WriteApplicationDebugInfoToConsole(); SetupPluginSystem(); #endregion // check if we are the current user's shell // set here as well so that we don't behave differently once user changes setting IsCairoUserShell = Shell.IsCairoUserShell; // Before we do anything, check if settings need to be upgraded if (Settings.IsFirstRun == true) { Settings.Upgrade(); } if (Settings.EnableDesktop) { // hide the windows desktop Shell.ToggleDesktopIcons(false); } App app = new App(); app.InitializeComponent(); // Set custom theme if selected string theme = Settings.CairoTheme; if (theme != "Default") { if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + theme)) { app.Resources.MergedDictionaries.Add((ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme))); } } if (Settings.EnableTaskbar) { // hide Windows taskbar AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.AutoHide); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_HIDEWINDOW); } MenuBarWindow = new MenuBar(System.Windows.Forms.Screen.PrimaryScreen); app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); MenuBarWindows.Add(MenuBarWindow); if (Settings.EnableDesktop) { DesktopWindow = new Desktop(); DesktopWindow.Show(); } if (Settings.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow(MenuBarWindow, System.Windows.Forms.Screen.PrimaryScreen); MenuBarShadowWindow.Show(); MenuBarShadowWindows.Add(MenuBarShadowWindow); } if (Settings.EnableTaskbar) { TaskbarWindow = new Taskbar(System.Windows.Forms.Screen.PrimaryScreen); TaskbarWindow.Show(); TaskbarWindows.Add(TaskbarWindow); } if (Settings.EnableMenuBarMultiMon || Settings.EnableTaskbarMultiMon) { ScreenSetup(true); } else if (IsCairoUserShell) // Set desktop work area for when Explorer isn't running { AppBarHelper.SetWorkArea(System.Windows.Forms.Screen.PrimaryScreen); } // initialize system tray if enabled if (Settings.EnableSysTray == true) { NotificationArea.Instance.Initialize(); } #if (ENABLEFIRSTRUN) FirstRun(); #endif // login items only necessary if Explorer didn't start them if (IsCairoUserShell && !isRestart) { RunStartupApps(); } app.Run(); }
public static void Main(string[] args) { #region Initialization Routines ProcessCommandLineArgs(args); SingleInstanceCheck(); SetShellReadyEvent(); SetupLoggingSystem(); WriteApplicationDebugInfoToConsole(); SetupPluginSystem(); #endregion // check if we are the current user's shell // set here as well so that we don't behave differently once user changes setting IsCairoUserShell = Shell.IsCairoUserShell; // Before we do anything, check if settings need to be upgraded if (Settings.IsFirstRun == true) { Settings.Upgrade(); } if (Settings.EnableDesktop) { // hide the windows desktop Shell.ToggleDesktopIcons(false); } App app = new App(); app.InitializeComponent(); // Set custom theme if selected string theme = Settings.CairoTheme; if (theme != "Default") { if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + theme)) { app.Resources.MergedDictionaries.Add((ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme))); } } if (Settings.EnableTaskbar) { // hide Windows taskbar AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.AutoHide); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_HIDEWINDOW); } MenuBarWindow = new MenuBar(System.Windows.Forms.Screen.PrimaryScreen); app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); MenuBarWindows.Add(MenuBarWindow); if (Settings.EnableDesktop) { DesktopWindow = new Desktop(); DesktopWindow.Show(); } if (Settings.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow(MenuBarWindow, System.Windows.Forms.Screen.PrimaryScreen); MenuBarShadowWindow.Show(); MenuBarShadowWindows.Add(MenuBarShadowWindow); } if (Settings.EnableTaskbar) { TaskbarWindow = new Taskbar(System.Windows.Forms.Screen.PrimaryScreen); TaskbarWindow.Show(); TaskbarWindows.Add(TaskbarWindow); } if (Settings.EnableMenuBarMultiMon || Settings.EnableTaskbarMultiMon) { ScreenSetup(true); } else if (IsCairoUserShell) // Set desktop work area for when Explorer isn't running { AppBarHelper.SetWorkArea(System.Windows.Forms.Screen.PrimaryScreen); } // initialize system tray if enabled if (Settings.EnableSysTray == true) { NotificationArea.Instance.Initialize(); } #if (ENABLEFIRSTRUN) FirstRun(); #endif // login items only necessary if Explorer didn't start them if (IsCairoUserShell && !isRestart) { RunStartupApps(); } app.Run(); }
public static void Main(string[] args) { #region Initialization Routines ProcessCommandLineArgs(args); SingleInstanceCheck(); SetShellReadyEvent(); SetupSettings(); // run this before logging setup so that preferences are always used SetupLoggingSystem(); WriteApplicationDebugInfoToConsole(); SetSystemKeyboardShortcuts(); // Move to App??? app.SetupPluginSystem(); SetupPluginSystem(); // This will Load the Core Plugin and all other, will either reference it as a dependancy or dont need it to be started first #endregion // check if we are the current user's shell // set here as well so that we don't behave differently once user changes setting IsCairoUserShell = Shell.IsCairoUserShell; // Move to CairoDesktop.Plugins.CairoShellCoreServices.... Make this more robust, to account for system-shell or per-user-shell; if (Settings.EnableDesktop) // Future: This should be moved to whatever plugin is responsible for desktop stuff { // hide the windows desktop Shell.ToggleDesktopIcons(false); } App app = new App(); app.InitializeComponent(); // This sets up the Unhandled Exception stuff... // Themes are very UI centric. We should devise a way of having Plugins/Extensions contribute to this. string theme = Settings.CairoTheme; if (theme != "Default") { if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + theme)) { app.Resources.MergedDictionaries.Add((ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme))); } } // Future: This should be moved to whatever plugin is responsible for MenuBar stuff if (Settings.EnableTaskbar) { AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.AutoHide); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_HIDEWINDOW); } // Future: This should be moved to whatever plugin is responsible for MenuBar stuff MenuBarWindow = new MenuBar(System.Windows.Forms.Screen.PrimaryScreen); app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); MenuBarWindows.Add(MenuBarWindow); // Future: This should be moved to whatever plugin is responsible for Desktop stuff if (Settings.EnableDesktop) { DesktopWindow = new Desktop(); DesktopWindow.Show(); } // Future: This should be moved to whatever plugin is responsible for MenuBar stuff if (Settings.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow(MenuBarWindow, System.Windows.Forms.Screen.PrimaryScreen); MenuBarShadowWindow.Show(); MenuBarShadowWindows.Add(MenuBarShadowWindow); } // Future: This should be moved to whatever plugin is responsible for Taskbar stuff if (Settings.EnableTaskbar) { TaskbarWindow = new Taskbar(System.Windows.Forms.Screen.PrimaryScreen); TaskbarWindow.Show(); TaskbarWindows.Add(TaskbarWindow); } // Future: This should be moved to whatever plugin is responsible for Taskbar/MennuBart stuff if (Settings.EnableMenuBarMultiMon || Settings.EnableTaskbarMultiMon) { ScreenSetup(true); } else if (IsCairoUserShell) // Set desktop work area for when Explorer isn't running { AppBarHelper.SetWorkArea(System.Windows.Forms.Screen.PrimaryScreen); } // Future: This should be moved to whatever plugin is responsible for SystemTray stuff. Possibly Core with no UI, then have a plugin that gives the UI? if (Settings.EnableSysTray == true) { NotificationArea.Instance.Initialize(); } #if ENABLEFIRSTRUN FirstRun(); #endif // login items only necessary if Explorer didn't start them if (IsCairoUserShell && !isRestart) { RunStartupApps(); } app.Run(); }
public static void Main(string[] args) { #region Initialization Routines ProcessCommandLineArgs(args); if (!SingleInstanceCheck()) { return; } SetShellReadyEvent(); SetupSettings(); // run this before logging setup so that preferences are always used SetupLoggingSystem(); WriteApplicationDebugInfoToConsole(); SetSystemKeyboardShortcuts(); // Move to App??? app.SetupPluginSystem(); SetupPluginSystem(); // This will Load the Core Plugin and all other, will either reference it as a dependancy or dont need it to be started first #endregion // check if we are the current user's shell // set here as well so that we don't behave differently once user changes setting // First check if there is an existing Shell_TrayWnd. If so, then Explorer is actually running as shell so assume we are not. IntPtr taskbarHwnd = NativeMethods.FindWindow("Shell_TrayWnd", ""); IsCairoRunningAsShell = Shell.IsCairoConfiguredAsShell && taskbarHwnd == IntPtr.Zero; // Move to CairoDesktop.Plugins.CairoShellCoreServices.... Make this more robust, to account for system-shell or per-user-shell; if (Settings.Instance.EnableDesktop) // Future: This should be moved to whatever plugin is responsible for desktop stuff { // hide the windows desktop Shell.ToggleDesktopIcons(false); } App app = new App(); app.InitializeComponent(); // This sets up the Unhandled Exception stuff... // Themes are very UI centric. We should devise a way of having Plugins/Extensions contribute to this. string theme = Settings.Instance.CairoTheme; if (theme != "Default") { string themeFilePath = AppDomain.CurrentDomain.BaseDirectory + theme; if (System.IO.File.Exists(themeFilePath)) { ResourceDictionary newRes = new ResourceDictionary(); newRes.Source = new Uri(themeFilePath, UriKind.RelativeOrAbsolute); app.Resources.MergedDictionaries.Add(newRes); } } Settings.Instance.PropertyChanged += (s, e) => { if (e != null && !string.IsNullOrWhiteSpace(e.PropertyName) && e.PropertyName == "CairoTheme") { App.Current.Resources.MergedDictionaries.Clear(); ResourceDictionary cairoResource = new ResourceDictionary(); // Put our base theme back cairoResource.Source = new Uri("Cairo.xaml", UriKind.RelativeOrAbsolute); App.Current.Resources.MergedDictionaries.Add(cairoResource); string newTheme = Settings.Instance.CairoTheme; if (newTheme != "Default") { string newThemeFilePath = AppDomain.CurrentDomain.BaseDirectory + newTheme; if (System.IO.File.Exists(newThemeFilePath)) { ResourceDictionary newRes = new ResourceDictionary(); newRes.Source = new Uri(newThemeFilePath, UriKind.RelativeOrAbsolute); app.Resources.MergedDictionaries.Add(newRes); } } } }; // Future: This should be moved to whatever plugin is responsible for MenuBar stuff if (Settings.Instance.EnableTaskbar) { AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.AutoHide); AppBarHelper.SetWinTaskbarPos((int)NativeMethods.SetWindowPosFlags.SWP_HIDEWINDOW); } // Future: This should be moved to whatever plugin is responsible for MenuBar stuff MenuBarWindow = new MenuBar(System.Windows.Forms.Screen.PrimaryScreen); app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); MenuBarWindows.Add(MenuBarWindow); // Future: This should be moved to whatever plugin is responsible for Desktop stuff if (Settings.Instance.EnableDesktop) { DesktopWindow = new Desktop(); DesktopWindow.Show(); } // Future: This should be moved to whatever plugin is responsible for MenuBar stuff if (Settings.Instance.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow(MenuBarWindow, System.Windows.Forms.Screen.PrimaryScreen); MenuBarShadowWindow.Show(); MenuBarShadowWindows.Add(MenuBarShadowWindow); } // Future: This should be moved to whatever plugin is responsible for Taskbar stuff if (Settings.Instance.EnableTaskbar) { TaskbarWindow = new Taskbar(System.Windows.Forms.Screen.PrimaryScreen); TaskbarWindow.Show(); TaskbarWindows.Add(TaskbarWindow); } // Future: This should be moved to whatever plugin is responsible for Taskbar/MennuBart stuff if (Settings.Instance.EnableMenuBarMultiMon || Settings.Instance.EnableTaskbarMultiMon) { ScreenSetup(true); } else if (IsCairoRunningAsShell) // Set desktop work area for when Explorer isn't running { AppBarHelper.SetWorkArea(System.Windows.Forms.Screen.PrimaryScreen); } // Future: This should be moved to whatever plugin is responsible for SystemTray stuff. Possibly Core with no UI, then have a plugin that gives the UI? // Don't allow showing both the Windows taskbar and the Cairo tray if (Settings.Instance.EnableSysTray == true && (Settings.Instance.EnableTaskbar == true || IsCairoRunningAsShell)) { NotificationArea.Instance.Initialize(); } #if ENABLEFIRSTRUN FirstRun(); #endif // login items only necessary if Explorer didn't start them if (IsCairoRunningAsShell && !isRestart) { RunStartupApps(); } app.Run(); }
public static void Main() { #region Single Instance Check bool ok; cairoMutex = new System.Threading.Mutex(true, "CairoShell", out ok); if (!ok) { // Another instance is already running. return; } #endregion #region some real shell code int hShellReadyEvent; if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5) { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, true, @"Global\msgina: ShellReadyEvent"); } else { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, false, "msgina: ShellReadyEvent"); } if (hShellReadyEvent != 0) { NativeMethods.SetEvent(hShellReadyEvent); NativeMethods.CloseHandle(hShellReadyEvent); } #endregion #region old code //if (!SingleInstanceCheck()) //{ // return; //} // Causes crash? // If framework is not correct version then quit. //if (!FrameworkCheck()) //{ // return; //} #endregion InitializeParentWindow(); App app = new App(); MenuBarWindow = new MenuBar() { Owner = _parentWindow }; MenuBarWindow.Show(); app.MainWindow = MenuBarWindow; #if (ENABLEFIRSTRUN) FirstRun(app); #endif if (Properties.Settings.Default.EnableDesktop) { DesktopWindow = new Desktop() { Owner = _parentWindow }; DesktopWindow.Show(); WindowInteropHelper f = new WindowInteropHelper(DesktopWindow); int result = NativeMethods.SetShellWindow(f.Handle); DesktopWindow.ShowWindowBottomMost(f.Handle); } if (Properties.Settings.Default.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow() { Owner = _parentWindow }; MenuBarShadowWindow.Show(); } if (Properties.Settings.Default.EnableTaskbar) { TaskbarWindow = new Taskbar() { Owner = _parentWindow }; TaskbarWindow.Show(); } app.Run(); }
public static void Main() { #region Single Instance Check bool ok; cairoMutex = new System.Threading.Mutex(true, "CairoShell", out ok); if (!ok) { // Another instance is already running. return; } #endregion #region some real shell code int hShellReadyEvent; if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5) hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, true, @"Global\msgina: ShellReadyEvent"); else hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, false, "msgina: ShellReadyEvent"); if (hShellReadyEvent != 0) { NativeMethods.SetEvent(hShellReadyEvent); NativeMethods.CloseHandle(hShellReadyEvent); } #endregion #region old code //if (!SingleInstanceCheck()) //{ // return; //} // Causes crash? // If framework is not correct version then quit. //if (!FrameworkCheck()) //{ // return; //} #endregion InitializeParentWindow(); App app = new App(); MenuBarWindow = new MenuBar() { Owner = _parentWindow }; MenuBarWindow.Show(); app.MainWindow = MenuBarWindow; #if (ENABLEFIRSTRUN) FirstRun(app); #endif if (Properties.Settings.Default.EnableDesktop) { DesktopWindow = new Desktop() { Owner = _parentWindow }; DesktopWindow.Show(); WindowInteropHelper f = new WindowInteropHelper(DesktopWindow); int result = NativeMethods.SetShellWindow(f.Handle); DesktopWindow.ShowWindowBottomMost(f.Handle); } if (Properties.Settings.Default.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow() { Owner = _parentWindow }; MenuBarShadowWindow.Show(); } if (Properties.Settings.Default.EnableTaskbar) { TaskbarWindow = new Taskbar() { Owner = _parentWindow }; TaskbarWindow.Show(); } app.Run(); }
public static void Main(string[] args) { if (args.Length > 0 && args[0] == "/restart") { isRestart = true; } else { isRestart = false; } #region Single Instance Check bool ok; cairoMutex = new System.Threading.Mutex(true, "CairoShell", out ok); if (!ok && !isRestart) { // Another instance is already running. return; } else if (!ok && isRestart) { // this is a restart so let's wait for the old instance to end System.Threading.Thread.Sleep(2000); } #endregion // Show a splash screen while WPF inits // not needed any more //SplashScreen splash = new SplashScreen("Resources/loadSplash.png"); //splash.Show(false, true); #region some real shell code int hShellReadyEvent; if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5) { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, true, @"Global\msgina: ShellReadyEvent"); } else { hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, false, "msgina: ShellReadyEvent"); } if (hShellReadyEvent != 0) { NativeMethods.SetEvent(hShellReadyEvent); NativeMethods.CloseHandle(hShellReadyEvent); } #endregion // check if we are the current user's shell object userShell = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon", false).GetValue("Shell"); procName = Process.GetCurrentProcess().ProcessName; if (userShell != null) { IsCairoUserShell = userShell.ToString().ToLower().Contains("cairodesktop"); } else { IsCairoUserShell = false; } // Before we do anything, check if settings need to be upgraded if (Settings.IsFirstRun == true) { Settings.Upgrade(); } if (Settings.EnableTaskbar) { // hide the windows taskbar according to user prefs switch (Settings.WindowsTaskbarMode) { case 0: AppBarHelper.SetWinTaskbarPos(NativeMethods.SWP_HIDEWINDOW); break; case 1: AppBarHelper.SetWinTaskbarState(AppBarHelper.WinTaskbarState.AutoHide); break; case 2: break; default: break; } } if (Settings.EnableDesktop) { // hide the windows desktop Shell.ToggleDesktopIcons(false); } _parentWindow = new Window(); InitializeParentWindow(_parentWindow); _desktopWindow = new Window(); InitializeParentWindow(_desktopWindow); DeskParent = _desktopWindow; App app = new App(); app.InitializeComponent(); // Set custom theme if selected string theme = Settings.CairoTheme; if (theme != "Default") { if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + theme)) { app.Resources.MergedDictionaries.Add((ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme))); } } // Set desktop work area for when Explorer isn't running if (IsCairoUserShell) { AppBarHelper.SetWorkArea(); } MenuBarWindow = new MenuBar() { Owner = _parentWindow }; app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); if (Settings.EnableDesktop) { DesktopWindow = new Desktop() { Owner = _desktopWindow }; DesktopWindow.Show(); } if (Settings.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow() { Owner = _desktopWindow }; MenuBarShadowWindow.Show(); } if (Settings.EnableTaskbar) { TaskbarWindow = new Taskbar() { Owner = _parentWindow }; TaskbarWindow.Show(); } #if (ENABLEFIRSTRUN) FirstRun(); #endif // Close the splash screen //splash.Close(new TimeSpan(0, 0, 0, 0, 800)); // login items only necessary if Explorer didn't start them if (IsCairoUserShell && !isRestart) { RunStartupApps(); } app.Run(); }
public static void Main() { #region Single Instance Check bool ok; cairoMutex = new System.Threading.Mutex(true, "CairoShell", out ok); if (!ok) { // Another instance is already running. return; } #endregion // Show a splash screen while WPF inits SplashScreen splash = new SplashScreen("Resources/loadSplash.png"); splash.Show(false, true); #region some real shell code int hShellReadyEvent; if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5) hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, true, @"Global\msgina: ShellReadyEvent"); else hShellReadyEvent = NativeMethods.OpenEvent(NativeMethods.EVENT_MODIFY_STATE, false, "msgina: ShellReadyEvent"); if (hShellReadyEvent != 0) { NativeMethods.SetEvent(hShellReadyEvent); NativeMethods.CloseHandle(hShellReadyEvent); } #endregion // check if we are the current user's shell object userShell = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon", false).GetValue("Shell"); procName = Process.GetCurrentProcess().ProcessName; if (userShell != null) IsCairoUserShell = userShell.ToString().ToLower().Contains("cairodesktop"); else IsCairoUserShell = false; // Before we do anything, check if settings need to be upgraded if (Properties.Settings.Default.IsFirstRun == true) Properties.Settings.Default.Upgrade(); if (Properties.Settings.Default.EnableTaskbar) { // hide the windows taskbar SupportingClasses.AppBarHelper.SetWinTaskbarState(SupportingClasses.AppBarHelper.WinTaskbarState.AutoHide); } if (Properties.Settings.Default.EnableDesktop) { // hide the windows desktop Interop.Shell.ToggleDesktopIcons(false); } _parentWindow = new Window(); InitializeParentWindow(_parentWindow); _desktopWindow = new Window(); InitializeParentWindow(_desktopWindow); DeskParent = _desktopWindow; App app = new App(); app.InitializeComponent(); // Set custom theme if selected string theme = CairoDesktop.Properties.Settings.Default.CairoTheme; if (theme != "Default") if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + theme)) app.Resources.MergedDictionaries.Add((ResourceDictionary)XamlReader.Load(System.Xml.XmlReader.Create(AppDomain.CurrentDomain.BaseDirectory + theme))); MenuBarWindow = new MenuBar() { Owner = _parentWindow }; app.MainWindow = MenuBarWindow; MenuBarWindow.Show(); if (Properties.Settings.Default.EnableDesktop) { DesktopWindow = new Desktop() { Owner = _desktopWindow }; DesktopWindow.Show(); } if (Properties.Settings.Default.EnableMenuBarShadow) { MenuBarShadowWindow = new MenuBarShadow() { Owner = _desktopWindow }; MenuBarShadowWindow.Show(); } if (Properties.Settings.Default.EnableTaskbar) { TaskbarWindow = new Taskbar() { Owner = _parentWindow }; TaskbarWindow.Show(); } // Set desktop work area for when Explorer isn't running SupportingClasses.AppBarHelper.SetWorkArea(); #if (ENABLEFIRSTRUN) FirstRun(app); #endif // If explorer isn't shell, run startup apps. if(IsCairoUserShell) { RunStartupApps(); } // Close the splash screen splash.Close(new TimeSpan(0, 0, 0, 0, 800)); app.Run(); }