Beispiel #1
0
        public void CloseWindow(WindowItemVM windowItemVMToClose)
        {
            if (WindowItemVMs == null)
            {
                // Nothing to close
                return;
            }

            if (windowItemVMToClose == null)
            {
                // Nothing to close
                return;
            }

            if (windowItemVMToClose.IsClone)
            {
                // This is a clone window, remove it from windowItemVMClones.
                ObservableCollection <WindowItemVM> windowItemVMClones = Helper.GetWindowItemVMClones(windowItemVMToClose);
                windowItemVMClones.Remove(windowItemVMToClose);
            }

            //  Close the window asociated with windowItemVMToClose data contect
            Window window = Helper.GetWindowFromWindowItemVM(windowItemVMToClose);

            window.Close();
            SaveData.SaveShortcuts(false);
        }
Beispiel #2
0
        public void CloneWindow(WindowItemVM parent)
        {
            // Clone parent window
            WindowItemVM    windowItemVMClone     = ContextHelper.CloneWindow(parent);
            ShortcutsWindow shortcutsWindowCloned = new ShortcutsWindow();

            shortcutsWindowCloned.DataContext = windowItemVMClone;
            shortcutsWindowCloned.Show();
            SaveData.SaveShortcuts(false);
        }
Beispiel #3
0
        public void NewWindow(System.Windows.Forms.Screen screen)
        {
            // Create a new shortcut window
            WindowItemVM    windowItemVM    = ContextHelper.NewWindow(screen);
            ShortcutsWindow shortcutsWindow = new ShortcutsWindow();

            WindowItemVMs.Add(windowItemVM);
            shortcutsWindow.DataContext = windowItemVM;
            shortcutsWindow.Show();
            SaveData.SaveShortcuts(false);
        }
Beispiel #4
0
 public void DeleteAllItems(WindowItemVM windowItemVM)
 {
     // Delete physical files first
     foreach (ItemVM subItemVMToDelete in windowItemVM.RootItemVMs)
     {
         ShortcutUtils.DeleteShortcuts(subItemVMToDelete);
     }
     // Delete all items
     windowItemVM.RootItemVMs.Clear();
     SaveData.SaveShortcuts(false);
 }
Beispiel #5
0
        public void CloneWindowToAllScreens(WindowItemVM parent)
        {
            // Clone parent window
            List <WindowItemVM> windowItemVMClones = ContextHelper.CloneWindowToAllScreens(parent);

            foreach (WindowItemVM windowItemVMClone in windowItemVMClones)
            {
                ShortcutsWindow shortcutsWindowCloned = new ShortcutsWindow();
                shortcutsWindowCloned.DataContext = windowItemVMClone;
                shortcutsWindowCloned.Show();
            }
            SaveData.SaveShortcuts(false);
        }
Beispiel #6
0
        public void DeleteWindow(WindowItemVM windowItemVMToDelete)
        {
            if (WindowItemVMs == null)
            {
                // Nothing to delete
                return;
            }

            if (windowItemVMToDelete == null)
            {
                // Nothing to delete
                return;
            }

            if (!windowItemVMToDelete.IsClone)
            {
                // TODO Create the backup

                // This is not a clone window, just close it along with all its cloned window
                // First close all window clones
                foreach (WindowItemVM windowItemVMClone in windowItemVMToDelete.WindowItemVMClones)
                {
                    Window windowClone = Helper.GetWindowFromWindowItemVM(windowItemVMClone);
                    windowClone.Close();
                }

                // Firts we need to delete all the shortcuts thaat are inside this window
                DeleteAllItems(windowItemVMToDelete);
                // Delete windowItemVMToDelete from the WindowItemVMs
                WindowItemVMs.Remove(windowItemVMToDelete);
            }

            //  Close the window asociated with windowItemVMToDelete data contect
            Window window = Helper.GetWindowFromWindowItemVM(windowItemVMToDelete);

            window.Close();
            SaveData.SaveShortcuts(false);
        }