Example #1
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);
        }
Example #2
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);
        }