Exemplo n.º 1
0
        private void OpenLogoffBox(object sender, RoutedEventArgs e)
        {
            bool?LogoffChoice = CairoMessage.ShowOkCancel("You will lose all unsaved documents and be logged off.", "Are you sure you want to log off now?", "Resources/logoffIcon.png", "Log Off", "Cancel");

            if (LogoffChoice.HasValue && LogoffChoice.Value)
            {
                NativeMethods.Logoff();
            }
        }
Exemplo n.º 2
0
        private void OpenShutDownBox(object sender, RoutedEventArgs e)
        {
            bool?ShutdownChoice = CairoMessage.ShowOkCancel("You will lose all unsaved documents and your computer will turn off.", "Are you sure you want to shut down now?", "Resources/shutdownIcon.png", "Shut Down", "Cancel");

            if (ShutdownChoice.HasValue && ShutdownChoice.Value)
            {
                NativeMethods.Shutdown();
            }
        }
Exemplo n.º 3
0
        private void OpenRebootBox(object sender, RoutedEventArgs e)
        {
            bool?RebootChoice = CairoMessage.ShowOkCancel("You will lose all unsaved documents and your computer will restart.", "Are you sure you want to restart now?", "Resources/restartIcon.png", "Restart", "Cancel");

            if (RebootChoice.HasValue && RebootChoice.Value)
            {
                NativeMethods.Reboot();
            }
        }
Exemplo n.º 4
0
        private void OpenLogoffBox(object sender, RoutedEventArgs e)
        {
            bool?LogoffChoice = CairoMessage.ShowOkCancel(Localization.DisplayString.sLogoff_Info, Localization.DisplayString.sLogoff_Title, "Resources/logoffIcon.png", Localization.DisplayString.sLogoff_Logoff, Localization.DisplayString.sInterface_Cancel);

            if (LogoffChoice.HasValue && LogoffChoice.Value)
            {
                NativeMethods.Logoff();
            }
        }
Exemplo n.º 5
0
        private void OpenCloseCairoBox(object sender, RoutedEventArgs e)
        {
            bool?CloseCairoChoice = CairoMessage.ShowOkCancel("You will need to reboot or use the start menu shortcut in order to run Cairo again.", "Are you sure you want to exit Cairo?", "Resources/exitIcon.png", "Exit Cairo", "Cancel");

            if (CloseCairoChoice.HasValue && CloseCairoChoice.Value)
            {
                shutdown();
            }
        }
Exemplo n.º 6
0
        private void OpenRebootBox(object sender, RoutedEventArgs e)
        {
            bool?RebootChoice = CairoMessage.ShowOkCancel(Localization.DisplayString.sRestart_Info, Localization.DisplayString.sRestart_Title, "Resources/restartIcon.png", Localization.DisplayString.sRestart_Restart, Localization.DisplayString.sInterface_Cancel);

            if (RebootChoice.HasValue && RebootChoice.Value)
            {
                NativeMethods.Reboot();
            }
        }
Exemplo n.º 7
0
        private void OpenShutDownBox(object sender, RoutedEventArgs e)
        {
            bool?ShutdownChoice = CairoMessage.ShowOkCancel(Localization.DisplayString.sShutDown_Info, Localization.DisplayString.sShutDown_Title, "Resources/shutdownIcon.png", Localization.DisplayString.sShutDown_ShutDown, Localization.DisplayString.sInterface_Cancel);

            if (ShutdownChoice.HasValue && ShutdownChoice.Value)
            {
                NativeMethods.Shutdown();
            }
        }
Exemplo n.º 8
0
        private static void ShowActionConfirmation(string message, string title, string imageSource, string okButtonText, string cancelButtonText, Action systemAction)
        {
            bool?actionChoice = CairoMessage.ShowOkCancel(message, title, imageSource, okButtonText, cancelButtonText);

            if (actionChoice.HasValue && actionChoice.Value)
            {
                systemAction();
            }
        }
Exemplo n.º 9
0
        private void OpenCloseCairoBox(object sender, RoutedEventArgs e)
        {
            bool?CloseCairoChoice = CairoMessage.ShowOkCancel(Localization.DisplayString.sExitCairo_Info, Localization.DisplayString.sExitCairo_Title, "Resources/exitIcon.png", Localization.DisplayString.sExitCairo_ExitCairo, Localization.DisplayString.sInterface_Cancel);

            if (CloseCairoChoice.HasValue && CloseCairoChoice.Value)
            {
                Startup.Shutdown();
            }
        }
Exemplo n.º 10
0
        public static void PerformAction(string verb, string fileName)
        {
            if (verb == "open")
            {
                if (Startup.DesktopWindow != null)
                    Startup.DesktopWindow.IsOverlayOpen = false;

                Interop.Shell.StartProcess(fileName);

                return;
            }
            else if (verb == "openwith")
            {
                if (Startup.DesktopWindow != null)
                    Startup.DesktopWindow.IsOverlayOpen = false;

                Interop.Shell.ShowOpenWithDialog(fileName);

                return;
            }
            else if (verb == "delete")
            {
                string displayName = Interop.Shell.GetDisplayName(fileName);
                bool? deleteChoice = CairoMessage.ShowOkCancel(String.Format(Localization.DisplayString.sDesktop_DeleteInfo, displayName), Localization.DisplayString.sDesktop_DeleteTitle, "Resources/cairoIcon.png", Localization.DisplayString.sInterface_Delete, Localization.DisplayString.sInterface_Cancel);
                if (deleteChoice.HasValue && deleteChoice.Value)
                {
                    Interop.Shell.SendToRecycleBin(fileName);
                }
                return;
            }
            else if (verb == "properties")
            {
                Interop.Shell.ShowFileProperties(fileName);
                Startup.DesktopWindow.IsOverlayOpen = false;

                return;
            }
            else if (verb == "copy")
            {
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;
            }
            else if (verb == "addStack")
            {
                StacksManager.AddLocation(fileName);
                return;
            }
            else if (verb == "removeStack")
            {
                StacksManager.StackLocations.Remove(new SystemDirectory(fileName, _dispatcher));
                return;
            }
        }
Exemplo n.º 11
0
        private void programsMenu_Remove(object sender, RoutedEventArgs e)
        {
            MenuItem        item         = (MenuItem)sender;
            ApplicationInfo app          = item.DataContext as ApplicationInfo;
            bool?           deleteChoice = CairoMessage.ShowOkCancel("\"" + app.Name + "\" will be removed from the Programs menu. This will not uninstall the program.", "Remove this app from the menu?", "Resources/cairoIcon.png", "Remove", "Cancel");

            if (deleteChoice.HasValue && deleteChoice.Value)
            {
                app.Category.Remove(app);
                appGrabber.Save();
            }
        }
Exemplo n.º 12
0
 private void OpenCloseCairoBox(object sender, RoutedEventArgs e)
 {
     CairoMessage.ShowOkCancel(Localization.DisplayString.sExitCairo_Info, Localization.DisplayString.sExitCairo_Title,
                               CairoMessageImage.Default, Localization.DisplayString.sExitCairo_ExitCairo, Localization.DisplayString.sInterface_Cancel,
                               result =>
     {
         if (result == true)
         {
             _cairoApplication.ExitCairo();
         }
     });
 }
        private void btnChangeShell_Click(object sender, RoutedEventArgs e)
        {
            btnChangeShell.IsEnabled = false;

            Shell.IsCairoConfiguredAsShell = !Shell.IsCairoConfiguredAsShell;

            bool?LogoffChoice = CairoMessage.ShowOkCancel(Localization.DisplayString.sSettings_Advanced_ShellChangedText, Localization.DisplayString.sSettings_Advanced_ShellChanged, "Resources/logoffIcon.png", Localization.DisplayString.sSettings_Advanced_LogOffNow, Localization.DisplayString.sSettings_Advanced_LogOffLater);

            if (LogoffChoice.HasValue && LogoffChoice.Value)
            {
                Shell.Logoff();
            }
        }
Exemplo n.º 14
0
 private void OnWindowClosing(object sender, CancelEventArgs e)
 {
     if (CairoMessage.ShowOkCancel("You will need to reboot or use the start menu shortcut in order to run Cairo again.", "Are you sure you want to exit Cairo?", "Resources/cairoIcon.png", "Exit Cairo", "Cancel") == true)
     {
         //SHAppBarMessageHelper.DeRegisterBar(handle);
         System.Drawing.Size size = new System.Drawing.Size((int)this.ActualWidth, (int)this.ActualHeight);
         SHAppBarMessageHelper.RegisterBar(handle, size);
         SysTray.DestroySystemTray();
         Application.Current.Shutdown();
     }
     else
     {
         e.Cancel = true;
     }
 }
Exemplo n.º 15
0
        private void btnChangeShell_Click(object sender, RoutedEventArgs e)
        {
            btnChangeShell.IsEnabled = false;

            EnvironmentHelper.IsAppConfiguredAsShell = !EnvironmentHelper.IsAppConfiguredAsShell;

            CairoMessage.ShowOkCancel(Localization.DisplayString.sSettings_Advanced_ShellChangedText,
                                      Localization.DisplayString.sSettings_Advanced_ShellChanged, CairoMessageImage.LogOff,
                                      Localization.DisplayString.sSettings_Advanced_LogOffNow, Localization.DisplayString.sSettings_Advanced_LogOffLater,
                                      result =>
            {
                if (result == true)
                {
                    ShellHelper.Logoff();
                }
            });
        }
Exemplo n.º 16
0
        private void OpenCloseCairoBox(object sender, RoutedEventArgs e)
        {
            bool?CloseCairoChoice = CairoMessage.ShowOkCancel("You will need to reboot or use the start menu shortcut in order to run Cairo again.", "Are you sure you want to exit Cairo?", "Resources/cairoIcon.png", "Exit Cairo", "Cancel");

            if (CloseCairoChoice.HasValue && CloseCairoChoice.Value)
            {
                //SHAppBarMessageHelper.DeRegisterBar(handle);
                System.Drawing.Size size = new System.Drawing.Size((int)this.ActualWidth, (int)this.ActualHeight);
                SHAppBarMessageHelper.RegisterBar(handle, size);
                SysTray.DestroySystemTray();
                Application.Current.Shutdown();
                // TODO: Will want to relaunch explorer.exe when we start disabling it
            }
            else
            {
            }
        }
Exemplo n.º 17
0
 private void OpenCloseCairoBox(object sender, RoutedEventArgs e)
 {
     CairoMessage.ShowOkCancel(Localization.DisplayString.sExitCairo_Info, Localization.DisplayString.sExitCairo_Title,
                               CairoMessageImage.Default, Localization.DisplayString.sExitCairo_ExitCairo, Localization.DisplayString.sInterface_Cancel,
                               result =>
     {
         if (result == true)
         {
             if (KeyboardUtilities.IsKeyDown(System.Windows.Forms.Keys.ShiftKey))
             {
                 _cairoApplication.RestartCairo();
             }
             else
             {
                 _cairoApplication.ExitCairo();
             }
         }
     });
 }
Exemplo n.º 18
0
        private void categoryMenu_Delete(object sender, RoutedEventArgs e)
        {
            MenuItem     menuItem = sender as MenuItem;
            Category     category = menuItem.DataContext as Category;
            CategoryList catList  = category.ParentCategoryList;

            CairoMessage.ShowOkCancel(string.Format(DisplayString.sProgramsMenu_DeleteCategoryInfo, category.DisplayName, MenuBar._appGrabber.CategoryList.GetSpecialCategory(AppCategoryType.All)),
                                      string.Format(DisplayString.sProgramsMenu_DeleteCategoryTitle, category.DisplayName),
                                      CairoMessageImage.Warning,
                                      DisplayString.sInterface_Yes,
                                      DisplayString.sInterface_No,
                                      (bool?result) => {
                if (result == true)
                {
                    catList.Remove(category);
                    MenuBar._appGrabber.Save();
                }

                MenuBar.ProgramsMenu.IsSubmenuOpen = true;
            });
        }
Exemplo n.º 19
0
        public static void Icon_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item     = sender as MenuItem;
            string   tag      = item.Tag as string;
            string   verb     = tag.Substring(0, tag.IndexOf('|'));
            string   fileName = tag.Substring(tag.IndexOf('|') + 1);
            string   displayName;

            if (Settings.ShowFileExtensions)
            {
                displayName = Path.GetFileName(fileName);
            }
            else
            {
                displayName = Path.GetFileNameWithoutExtension(fileName);
            }

            if (verb == "open")
            {
                Interop.Shell.StartProcess(fileName);
                return;
            }
            else if (verb == "openwith")
            {
                Interop.Shell.ShowOpenWithDialog(fileName);
                return;
            }
            else if (verb == "delete")
            {
                bool?deleteChoice = CairoMessage.ShowOkCancel("\"" + displayName + "\" will be sent to the Recycle Bin.", "Are you sure you want to delete this?", "Resources/cairoIcon.png", "Delete", "Cancel");
                if (deleteChoice.HasValue && deleteChoice.Value)
                {
                    Interop.Shell.SendToRecycleBin(fileName);
                }
                return;
            }
            else if (verb == "properties")
            {
                Interop.Shell.ShowFileProperties(fileName);
                return;
            }
            else if (verb == "copy")
            {
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;
            }
            else if (verb == "addStack")
            {
                StacksManager.AddLocation(fileName);
                return;
            }
            else if (verb == "rename")
            {
                DockPanel parent = ((Button)((ContextMenu)item.Parent).PlacementTarget).Content as DockPanel;
                TextBox   rename = parent.FindName("txtRename") as TextBox;
                Border    label  = parent.FindName("bdrFilename") as Border;

                rename.Visibility = Visibility.Visible;
                label.Visibility  = Visibility.Collapsed;
                rename.Focus();
                rename.SelectAll();
                return;
            }

            Interop.Shell.StartProcess(fileName, "", verb);
        }
Exemplo n.º 20
0
        public static void PerformAction(string verb, string fileName)
        {
            switch (verb)
            {
            case Actions.Open:
                DesktopManager.Instance.IsOverlayOpen = false;
                Shell.StartProcess(fileName);
                return;

            case Actions.OpenWith:
                DesktopManager.Instance.IsOverlayOpen = false;
                Shell.ShowOpenWithDialog(fileName);
                return;

            case Actions.Delete:
                string displayName  = Shell.GetDisplayName(fileName);
                bool?  deleteChoice = CairoMessage.ShowOkCancel(string.Format(Localization.DisplayString.sDesktop_DeleteInfo, displayName), Localization.DisplayString.sDesktop_DeleteTitle, "Resources/cairoIcon.png", Localization.DisplayString.sInterface_Delete, Localization.DisplayString.sInterface_Cancel);
                if (deleteChoice.HasValue && deleteChoice.Value)
                {
                    Shell.SendToRecycleBin(fileName);
                }
                return;

            case Actions.Properties:
                Shell.ShowFileProperties(fileName);
                DesktopManager.Instance.IsOverlayOpen = false;
                return;

            case Actions.Copy:
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;

            case DirectoryActions.AddStack:
                StacksManager.Instance.AddLocation(fileName);
                return;

            case DirectoryActions.RemoveStack:
                StacksManager.Instance.StackLocations.Remove(new SystemDirectory(fileName, _dispatcher));
                return;

            case Actions.OpenWithShell:
                FolderHelper.OpenWithShell(fileName);
                break;

            case Actions.Personalize when Shell.IsCairoRunningAsShell:
                CairoSettingsWindow.Instance.Show();
                CairoSettingsWindow.Instance.Activate();
                CairoSettingsWindow.Instance.TabDesktop.IsSelected = true;
                break;

            case Actions.Personalize:
                Shell.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,2");
                break;

            case Actions.DisplaySettings:
                Shell.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,3");
                break;

            default:
                Shell.StartProcess(fileName, "", verb);
                break;
            }
        }
Exemplo n.º 21
0
        public static void Icon_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem item        = sender as MenuItem;
            string   tag         = item.Tag as string;
            string   verb        = tag.Substring(0, tag.IndexOf('|'));
            string   fileName    = tag.Substring(tag.IndexOf('|') + 1);
            string   displayName = Interop.Shell.GetDisplayName(fileName);

            if (verb == "open")
            {
                if (Startup.DesktopWindow != null)
                {
                    Startup.DesktopWindow.IsOverlayOpen = false;
                }

                Interop.Shell.StartProcess(fileName);

                return;
            }
            else if (verb == "openwith")
            {
                if (Startup.DesktopWindow != null)
                {
                    Startup.DesktopWindow.IsOverlayOpen = false;
                }

                Interop.Shell.ShowOpenWithDialog(fileName);

                return;
            }
            else if (verb == "delete")
            {
                bool?deleteChoice = CairoMessage.ShowOkCancel(String.Format(Localization.DisplayString.sDesktop_DeleteInfo, displayName), Localization.DisplayString.sDesktop_DeleteTitle, "Resources/cairoIcon.png", Localization.DisplayString.sInterface_Delete, Localization.DisplayString.sInterface_Cancel);
                if (deleteChoice.HasValue && deleteChoice.Value)
                {
                    Interop.Shell.SendToRecycleBin(fileName);
                }
                return;
            }
            else if (verb == "properties")
            {
                Interop.Shell.ShowFileProperties(fileName);
                Startup.DesktopWindow.IsOverlayOpen = false;

                return;
            }
            else if (verb == "copy")
            {
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;
            }
            else if (verb == "addStack")
            {
                StacksManager.AddLocation(fileName);
                return;
            }
            else if (verb == "rename")
            {
                DockPanel parent = ((Button)((ContextMenu)item.Parent).PlacementTarget).Content as DockPanel;
                TextBox   rename = parent.FindName("txtRename") as TextBox;
                Border    label  = parent.FindName("bdrFilename") as Border;

                rename.Visibility = Visibility.Visible;
                label.Visibility  = Visibility.Collapsed;
                rename.Focus();
                rename.SelectAll();
                return;
            }

            if (Startup.DesktopWindow != null)
            {
                Startup.DesktopWindow.IsOverlayOpen = false;
            }

            Interop.Shell.StartProcess(fileName, "", verb);
        }
Exemplo n.º 22
0
        public static void PerformAction(string verb, string fileName)
        {
            if (verb == "open")
            {
                if (WindowManager.Instance.DesktopWindow != null)
                {
                    WindowManager.Instance.DesktopWindow.IsOverlayOpen = false;
                }

                Shell.StartProcess(fileName);

                return;
            }
            else if (verb == "openwith")
            {
                if (WindowManager.Instance.DesktopWindow != null)
                {
                    WindowManager.Instance.DesktopWindow.IsOverlayOpen = false;
                }

                Shell.ShowOpenWithDialog(fileName);

                return;
            }
            else if (verb == "delete")
            {
                string displayName  = Shell.GetDisplayName(fileName);
                bool?  deleteChoice = CairoMessage.ShowOkCancel(string.Format(Localization.DisplayString.sDesktop_DeleteInfo, displayName), Localization.DisplayString.sDesktop_DeleteTitle, "Resources/cairoIcon.png", Localization.DisplayString.sInterface_Delete, Localization.DisplayString.sInterface_Cancel);
                if (deleteChoice.HasValue && deleteChoice.Value)
                {
                    Shell.SendToRecycleBin(fileName);
                }
                return;
            }
            else if (verb == "properties")
            {
                Shell.ShowFileProperties(fileName);
                WindowManager.Instance.DesktopWindow.IsOverlayOpen = false;

                return;
            }
            else if (verb == "copy")
            {
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;
            }
            else if (verb == "addStack")
            {
                StacksManager.Instance.AddLocation(fileName);
                return;
            }
            else if (verb == "removeStack")
            {
                StacksManager.Instance.StackLocations.Remove(new SystemDirectory(fileName, _dispatcher));
                return;
            }
            else if (verb == "openWithShell")
            {
                FolderHelper.OpenWithShell(fileName);
            }
            else if (verb == "personalize")
            {
                if (Shell.IsCairoRunningAsShell)
                {
                    CairoSettingsWindow.Instance.Show();
                    CairoSettingsWindow.Instance.Activate();
                    CairoSettingsWindow.Instance.TabDesktop.IsSelected = true;
                }
                else
                {
                    Shell.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,2");
                }
            }
            else if (verb == "displaySettings")
            {
                Shell.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,3");
            }
            else
            {
                Shell.StartProcess(fileName, "", verb);
            }
        }
Exemplo n.º 23
0
        public static void PerformAction(string verb, string fileName)
        {
            var desktopManager = CairoApplication.Current.Host.Services.GetService <DesktopManager>();

            switch (verb)
            {
            case Actions.Open:
                desktopManager.IsOverlayOpen = false;
                ShellHelper.StartProcess(fileName);
                return;

            case Actions.OpenWith:
                desktopManager.IsOverlayOpen = false;
                ShellHelper.ShowOpenWithDialog(fileName);
                return;

            case Actions.Delete:
                string displayName = ShellHelper.GetDisplayName(fileName);
                CairoMessage.ShowOkCancel(string.Format(Localization.DisplayString.sDesktop_DeleteInfo, displayName),
                                          Localization.DisplayString.sDesktop_DeleteTitle, CairoMessageImage.Warning,
                                          Localization.DisplayString.sInterface_Delete, Localization.DisplayString.sInterface_Cancel,
                                          result =>
                {
                    if (result == true)
                    {
                        ShellHelper.SendToRecycleBin(fileName);
                    }
                });
                return;

            case Actions.Properties:
                ShellHelper.ShowFileProperties(fileName);
                desktopManager.IsOverlayOpen = false;
                return;

            case Actions.Copy:
                StringCollection scPath = new StringCollection();
                scPath.Add(fileName);
                System.Windows.Forms.Clipboard.SetFileDropList(scPath);
                return;

            case DirectoryActions.AddStack:
                StacksManager.Instance.AddLocation(fileName);
                return;

            case DirectoryActions.RemoveStack:
                StacksManager.Instance.StackLocations.Remove(new SystemDirectory(fileName, _dispatcher));
                return;

            case Actions.OpenWithShell:
                FolderHelper.OpenWithShell(fileName);
                break;

            case Actions.Personalize when EnvironmentHelper.IsAppRunningAsShell:
                CairoSettingsWindow.Instance.Show();
                CairoSettingsWindow.Instance.Activate();
                CairoSettingsWindow.Instance.TabDesktop.IsSelected = true;
                break;

            case Actions.Personalize:
                ShellHelper.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,2");
                break;

            case Actions.DisplaySettings:
                ShellHelper.StartProcess("Rundll32.exe", "shell32.dll,Control_RunDLL desk.cpl,,3");
                break;

            default:
                ShellHelper.StartProcess(fileName, "", verb);
                break;
            }
        }