Пример #1
0
        public Dock CreateDock()
        {
            int mon;

            for (mon = 0; mon < Screen.Default.NMonitors; mon++)
            {
                if (PositionsAvailableForDock(mon).Any())
                {
                    break;
                }
                if (mon == Screen.Default.NMonitors - 1)
                {
                    return(null);
                }
            }

            string name = "Dock" + 1;

            for (int i = 2; DockNames.Contains(name); i++)
            {
                name = "Dock" + i;
            }

            DockNames = DockNames.Concat(new[] { name });

            DockPreferences dockPrefs = new DockPreferences(name, mon);

            dockPrefs.Position = PositionsAvailableForDock(mon).First();
            Dock dock = new Dock(dockPrefs);

            docks.Add(dock);

            return(dock);
        }
Пример #2
0
        public bool DeleteDock(Dock dock)
        {
            if (!docks.Contains(dock) || docks.Count == 1)
            {
                return(false);
            }

            docks.Remove(dock);
            if (dock.Preferences.DefaultProvider.IsWindowManager)
            {
                docks.First().Preferences.DefaultProvider.SetWindowManager();
            }
            dock.Preferences.FreeProviders();
            dock.Preferences.ResetPreferences();
            dock.Dispose();
            DockNames = DockNames.Where(s => s != dock.Preferences.GetName());

            return(true);
        }