Пример #1
0
 private void OpenOptionsDialogCore() {
     bool checkForIllegalCrossThreadCalls = CheckForIllegalCrossThreadCalls;
     CheckForIllegalCrossThreadCalls = false;
     using(optionsDialog = new OptionsDialog(pluginManager, odCallback_DialogResult)) {
         TMPfNowOptionDialogOpening = false;
         optionsDialog.ShowDialog();
     }
     optionsDialog = null;
     fOptionDialogCreated = false;
     CheckForIllegalCrossThreadCalls = checkForIllegalCrossThreadCalls;
 }
Пример #2
0
 private void OpenOptionsDialogCore() {
     bool checkForIllegalCrossThreadCalls = Control.CheckForIllegalCrossThreadCalls;
     Control.CheckForIllegalCrossThreadCalls = false;
     using(optionsDialog = new OptionsDialog(this.pluginManager, new FormMethodInvoker(this.odCallback_DialogResult))) {
         TMPfNowOptionDialogOpening = false;
         optionsDialog.ShowDialog();
     }
     optionsDialog = null;
     this.fOptionDialogCreated = false;
     Control.CheckForIllegalCrossThreadCalls = checkForIllegalCrossThreadCalls;
 }
Пример #3
0
 private void odCallback_DialogResult(object o) {
     if(o is string) {
         Invoke(new FormMethodInvoker(odCallback_PluginOption), new object[] { o });
     }
     else if(o is List<PluginAssembly>) {
         Invoke(new FormMethodInvoker(odCallback_ManagePlugin), new object[] { o });
     }
     else {
         DialogResult result = (DialogResult)o;
         if(result != DialogResult.Yes) {
             optionsDialog = null;
         }
         if((result == DialogResult.OK) || (result == DialogResult.Yes)) {
             Invoke(new MethodInvoker(odCallback_RefreshOptions));
         }
     }
 }
Пример #4
0
            public bool ExecuteCommand(Commands command, object arg)
            {
                if (tabBar != null)
                {
                    IntPtr ptr;
                    switch (command)
                    {
                    case Commands.GoBack:
                    case Commands.GoForward:
                        if (arg is int)
                        {
                            return(tabBar.NavigateToIndex(command == Commands.GoBack, (int)arg));
                        }
                        break;

                    case Commands.GoUpOneLevel:
                        tabBar.UpOneLevel();
                        return(true);

                    case Commands.RefreshBrowser:
                        tabBar.Explorer.Refresh();
                        return(true);

                    case Commands.CloseCurrentTab:
                        return(tabBar.CloseTab(tabBar.CurrentTab));

                    case Commands.CloseLeft:
                    case Commands.CloseRight:
                        tabBar.CloseLeftRight(command == Commands.CloseLeft, -1);
                        return(true);

                    case Commands.CloseAllButCurrent:
                        tabBar.CloseAllTabsExcept(tabBar.CurrentTab);
                        return(true);

                    case Commands.CloseAllButOne: {
                        TabWrapper wrapper = arg as TabWrapper;
                        if (wrapper == null)
                        {
                            break;
                        }
                        tabBar.CloseAllTabsExcept(wrapper.Tab);
                        return(true);
                    }

                    case Commands.CloseWindow:     // 关闭窗口 2 indiff
                        /* using (RegistryKey key = Registry.CurrentUser.CreateSubKey(RegConst.Root))
                         * {
                         *   string[] list = (from QTabItem item2 in tabControl1.TabPages
                         *                    where item2.TabLocked
                         *                    select item2.CurrentPath).ToArray();
                         *
                         *   MessageBox.Show(String.Join(",", list));
                         *   QTUtility2.WriteRegBinary(list, "TabsLocked", key);
                         * }*/
                        WindowUtils.CloseExplorer(tabBar.ExplorerHandle, 2);
                        return(true);

                    case Commands.UndoClose:
                        tabBar.RestoreLastClosed();
                        return(true);

                    case Commands.BrowseFolder:
                        tabBar.ChooseNewDirectory();
                        return(true);

                    case Commands.ToggleTopMost:
                        tabBar.ToggleTopMost();
                        TryCallButtonBar(bbar => bbar.RefreshButtons());
                        return(true);

                    case Commands.FocusFileList:
                        tabBar.listView.SetFocus();
                        return(true);

                    case Commands.OpenTabBarOptionDialog:
                        OptionsDialog.Open();
                        return(true);

                    case Commands.OpenButtonBarOptionDialog:
                        OptionsDialog.Open();     // todo: open at bbar page
                        return(true);

                    case Commands.IsFolderTreeVisible:
                        return(tabBar.ShellBrowser.IsFolderTreeVisible());

                    case Commands.IsButtonBarVisible:
                        return(InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr));

                    case Commands.ShowFolderTree:
                        if (!QTUtility.IsXP || !(arg is bool))
                        {
                            break;
                        }
                        tabBar.ShowFolderTree((bool)arg);
                        return(true);

                    case Commands.ShowButtonBar:
                        if (!InstanceManager.TryGetButtonBarHandle(tabBar.ExplorerHandle, out ptr))
                        {
                        }
                        break;

                    case Commands.MD5:
                        if (!(arg is string[]))
                        {
                            break;
                        }
                        if (md5Form == null)
                        {
                            md5Form = new FileHashComputerForm();
                        }
                        if (md5Form.InvokeRequired)
                        {
                            md5Form.Invoke(new FormMethodInvoker(ShowMD5FormCore), new object[] { arg });
                        }
                        else
                        {
                            ShowMD5FormCore(arg);
                        }
                        return(true);

                    case Commands.ShowProperties: {
                        if ((arg == null) || !(arg is Address))
                        {
                            break;
                        }
                        Address address = (Address)arg;
                        using (IDLWrapper wrapper = new IDLWrapper(address)) {
                            if (!wrapper.Available)
                            {
                                break;
                            }
                            ShellMethods.ShowProperties(wrapper.IDL, tabBar.ExplorerHandle);
                            return(true);
                        }
                    }

                    case Commands.SetModalState:
                        if (((arg == null) || !(arg is bool)) || !((bool)arg))
                        {
                            tabBar.NowModalDialogShown = false;
                            break;
                        }
                        tabBar.NowModalDialogShown = true;
                        break;

                    case Commands.SetSearchBoxStr:
                        return(arg != null && arg is string &&
                               TryCallButtonBar(bbar => bbar.SetSearchBarText((string)arg)));

                    case Commands.ReorderTabsByName:
                    case Commands.ReorderTabsByPath:
                    case Commands.ReorderTabsByActv:
                    case Commands.ReorderTabsRevers:
                        if (tabBar.tabControl1.TabCount > 1)
                        {
                            bool fDescending = ((arg != null) && (arg is bool)) && ((bool)arg);
                            tabBar.ReorderTab(((int)command) - 0x18, fDescending);
                        }
                        break;
                    }
                }
                return(false);
            }