コード例 #1
0
        private void miProgramsAddCategory_Click(object sender, RoutedEventArgs e)
        {
            MenuItem        mi = sender as MenuItem;
            ApplicationInfo ai = mi.DataContext as ApplicationInfo;

            Common.MessageControls.Input inputControl = new Common.MessageControls.Input();
            inputControl.Initialize(DisplayString.sAppGrabber_Untitled);

            CairoMessage.ShowControl(DisplayString.sProgramsMenu_AddCategoryInfo,
                                     DisplayString.sProgramsMenu_AddCategoryTitle,
                                     CairoMessageImage.Default,
                                     inputControl,
                                     DisplayString.sInterface_OK,
                                     DisplayString.sInterface_Cancel,
                                     (bool?result) => {
                if (result == true)
                {
                    Category newCat = new Category(inputControl.Text);
                    MenuBar._appGrabber.CategoryList.Add(newCat);

                    ai.Category.Remove(ai);
                    newCat.Add(ai);

                    MenuBar._appGrabber.Save();
                }

                MenuBar.ProgramsMenu.IsSubmenuOpen = true;
            });
        }
コード例 #2
0
        private void ShowGoToFolderDialog()
        {
            Common.MessageControls.Input inputControl = new Common.MessageControls.Input();
            inputControl.InputField.Text = NavigationManager.CurrentItem.Path;
            inputControl.InputField.SelectAll();
            inputControl.InputField.Focus();

            CairoMessage.ShowControl(Localization.DisplayString.sDesktop_GoToFolderMessage,
                                     Localization.DisplayString.sDesktop_GoToFolderTitle,
                                     CairoMessageImage.Default,
                                     inputControl,
                                     Localization.DisplayString.sInterface_Go,
                                     Localization.DisplayString.sInterface_Cancel,
                                     (bool?result) =>
            {
                string path = inputControl.InputField.Text;
                if (result != true || string.IsNullOrEmpty(path))
                {
                    return;
                }

                // Check if this is a valid folder
                ShellFolder shellFolder = new ShellFolder(path, IntPtr.Zero);
                bool valid = shellFolder.Loaded;
                shellFolder.Dispose();

                if (valid)
                {
                    NavigationManager.NavigateTo(path);
                }
                else
                {
                    CairoMessage.Show(Localization.DisplayString.sError_FileNotFoundInfo,
                                      Localization.DisplayString.sError_OhNo,
                                      MessageBoxButton.OK,
                                      CairoMessageImage.Error, (bool?errResult) =>
                    {
                        ShowGoToFolderDialog();
                    });
                }
            });
        }
コード例 #3
0
        private void categoryMenu_Rename(object sender, RoutedEventArgs e)
        {
            MenuItem menuItem = sender as MenuItem;
            Category category = menuItem.DataContext as Category;

            Common.MessageControls.Input inputControl = new Common.MessageControls.Input();
            inputControl.Initialize(category.Name);

            CairoMessage.ShowControl(string.Format(DisplayString.sProgramsMenu_RenameCategoryInfo, category.DisplayName),
                                     string.Format(DisplayString.sProgramsMenu_RenameTitle, category.DisplayName),
                                     CairoMessageImage.Default,
                                     inputControl,
                                     DisplayString.sInterface_Rename,
                                     DisplayString.sInterface_Cancel,
                                     (bool?result) => {
                if (result == true)
                {
                    category.Name = inputControl.Text;
                    MenuBar._appGrabber.Save();
                }

                MenuBar.ProgramsMenu.IsSubmenuOpen = true;
            });
        }