private void Combine(ViewportSetupFileViewModel model)
        {
            Excluded.Remove(model);
            Data.Combined.SetCombined(model.ProfileName);
            if (model == CurrentViewportSetup)
            {
                using (new HeliosUndoBatch())
                {
                    Data.GenerateCombined = true;
                    ConfigManager.UndoManager.AddUndoItem(new UndoCombine(this, model));
                }
            }

            AddCombined(model);
            Data.InvalidateStatusReport();
        }
        /// <summary>
        /// called when the current profile has been saved under a different name
        /// </summary>
        private void HandleProfileNameChange()
        {
            string oldName = CurrentViewportSetup.ProfileName;
            string newName = Data.CurrentProfileName;

            Debug.Assert(oldName != newName);

            ResetCurrentMonitorSetupSelection();
            ViewportSetupFileViewModel model = Combined.FirstOrDefault(m => m.ProfileName == newName);

            if (model != null)
            {
                ConfigureCurrentProfile(model);

                // after fixups, check if in the correct list
                if (Data.Combined.IsCombined(model.ProfileName))
                {
                    return;
                }

                Combined.Remove(model);
                AddExcluded(model);
                return;
            }

            model = Excluded.FirstOrDefault(m => m.ProfileName == newName);
            if (model != null)
            {
                ConfigureCurrentProfile(model);

                // after fixups, check if in the correct list
                if (!Data.Combined.IsCombined(model.ProfileName))
                {
                    return;
                }

                Excluded.Remove(model);
                AddCombined(model);
                return;
            }

            // not found
            AddCurrentProfile();
        }
 private void ResetCurrentMonitorSetupSelection()
 {
     if (CurrentViewportSetup.ProfileName == null)
     {
         // special entry for unsaved profile, just remove it
         if (Combined.Contains(CurrentViewportSetup))
         {
             Combined.Remove(CurrentViewportSetup);
         }
         else if (Excluded.Contains(CurrentViewportSetup))
         {
             Excluded.Remove(CurrentViewportSetup);
         }
     }
     else
     {
         // keep it, but this is no longer the special entry for current
         CurrentViewportSetup.IsCurrentProfile = false;
     }
 }
 private void Delete(ViewportSetupFileViewModel model)
 {
     Data.Combined.Delete(model.ProfileName);
     Excluded.Remove(model);
     Data.InvalidateStatusReport();
 }
 private void OnInclude(char?symbol)
 {
     Excluded.Remove(symbol);
     Included.Insert(0, symbol);
 }