Пример #1
0
        private void OnDeleteAllEditorTabsRequested(object sender, DeleteAllEditorTabsRequestedArg arg)
        {
            MessageBoxResult result = GherkinSettings.SaveAllFilesWithRequesting(arg.ExcludedEditorViewModel);

            if (result == MessageBoxResult.Cancel)
            {
                return;
            }

            SelectedTabIndex = TabPanels.Count - 1; // Note: Select last tab to force to notify SelectedTabIndex property changed event

            if (arg.ExcludedEditorViewModel == null)
            {
                for (int i = TabPanels.Count - 1; i > 0; i--)
                {
                    EventAggregator <EditorClosedArg> .Instance.Publish(this, new EditorClosedArg(TabPanels[i].EditorTabContentViewModel.CurrentFilePath));

                    TabPanels.RemoveAt(i);
                }
                TabPanels[0].EditorTabContentViewModel.ChangeToEmptyFile();
            }
            else
            {
                for (int i = TabPanels.Count - 1; i >= 0; i--)
                {
                    if (TabPanels[i].EditorTabContentViewModel != arg.ExcludedEditorViewModel)
                    {
                        EventAggregator <EditorClosedArg> .Instance.Publish(this, new EditorClosedArg(TabPanels[i].EditorTabContentViewModel.CurrentFilePath));

                        TabPanels.RemoveAt(i);
                    }
                }
            }
            SelectedTabIndex = 0;
        }
        private void OnCloseAllButThis()
        {
            DeleteAllEditorTabsRequestedArg arg = new DeleteAllEditorTabsRequestedArg(EditorTabContentViewModel);

            Util.EventAggregator <DeleteAllEditorTabsRequestedArg> .Instance.Publish(this, arg);
        }
        private void OnCloseAllDocuments()
        {
            DeleteAllEditorTabsRequestedArg arg = new DeleteAllEditorTabsRequestedArg(null);

            Util.EventAggregator <DeleteAllEditorTabsRequestedArg> .Instance.Publish(this, arg);
        }