Ejemplo n.º 1
0
 public override void OnSelected()
 {
     if (SelectedTab == null && TabItems.Any())
     {
         SelectedTab = TabItems.First();
     }
     SelectedTab?.OnSelected();
 }
Ejemplo n.º 2
0
        private void OnCloseTab(object param)
        {
            string layerName = param.ToString();

            TabItems.Remove(TabItems.First(n => n.TableName == layerName));

            TabControlSelectedIndex = 0;
            SetTabControlVisibility();
        }
Ejemplo n.º 3
0
        public void SaveModifiedFiles(object sender)
        {
            List <string> delList  = new List <string>();
            bool          noPrompt = false;

            try
            {
                foreach (IFile <T> item in new List <IFile <T> >(ViewManager.FileManager))
                {
                    // set tab index to current
                    SelectedIndex = TabItems.IndexOf(TabItems.First(x => x.Tag == item.Tag));
                    if (!IsValidTabIndex())
                    {
                        continue;
                    }

                    noPrompt = SaveModifiedFile(noPrompt, item);
                }
            }
            catch (Exception e)
            {
                SetStatus("SaveModifiedFiles: exception: " + e.ToString());
            }
        }
Ejemplo n.º 4
0
 public void SetTab(SourceControlTab tab)
 {
     SelectedItem = TabItems.First(t => t.ViewModel.Tab == tab);
 }
Ejemplo n.º 5
0
        public void SaveModifiedFiles(object sender)
        {
            List <string> delList = new List <string>();

            try
            {
                foreach (IFile <T> item in new List <IFile <T> >(ViewManager.FileManager.Where(x => x.Modified == true)))
                {
                    // set tab index to current
                    SelectedIndex = TabItems.IndexOf(TabItems.First(x => x.Tag == item.Tag));
                    if (!IsValidTabIndex())
                    {
                        continue;
                    }

                    // prompt for saving
                    if (!TextFilterSettings.Settings.AutoSave)
                    {
                        TimedSaveDialog dialog = new TimedSaveDialog(item.Tag);

                        dialog.Enable();

                        switch (dialog.WaitForResult())
                        {
                        case TimedSaveDialog.Results.Disable:
                            TextFilterSettings.Settings.AutoSave = true;
                            break;

                        case TimedSaveDialog.Results.DontSave:
                            item.Modified = false;
                            break;

                        case TimedSaveDialog.Results.Save:
                            SaveFileExecuted(item);
                            item.Modified = false;
                            break;

                        case TimedSaveDialog.Results.SaveAs:
                            SaveFileAsExecuted(item);
                            item.Modified = false;
                            break;

                        case TimedSaveDialog.Results.Unknown:
                            // dont worry about errors since we are closing.
                            break;
                        }
                    }
                    else
                    {
                        SaveFileExecuted(item);
                        item.Modified = false;
                    }

                    DeleteIfTempFile(item);
                }
            }
            catch (Exception e)
            {
                SetStatus("SaveModifiedFiles: exception: " + e.ToString());
            }
        }
 public void SetTab(SourceControlTab tab)
 {
     Logger.Trace($"Setting active tab to {tab}");
     SelectedItem = TabItems.First(t => t.ViewModel.Tab == tab);
 }
Ejemplo n.º 7
0
 private void ChangeTabTitle(Tuple <int, string> obj)
 {
     TabItems.First(x => x.ID == obj.Item1).Header = obj.Item2;
 }