Esempio n. 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;
        }
Esempio n. 2
0
 public MessageBoxResult SaveAllFilesWithRequesting()
 {
     return(GherkinSettings.SaveAllFilesWithRequesting(excluded: null));
 }