Beispiel #1
0
        void DetectMonitors()
        {
            DockMonitors = new List <DockMonitor> ();

            // first add all of the screens and their geometries
            for (int i = 0; i < Screen.Default.NMonitors; i++)
            {
                DockMonitor mon = new DockMonitor();
                mon.MonitorNumber = i;
                mon.Geo           = Screen.Default.GetMonitorGeometry(i);
                DockMonitors.Add(mon);
            }

            int topDockVal    = DockMonitors.OrderBy(d => d.Geo.Top).First().Geo.Top;
            int bottomDockVal = DockMonitors.OrderByDescending(d => d.Geo.Bottom).First().Geo.Bottom;
            int leftDockVal   = DockMonitors.OrderBy(d => d.Geo.Left).First().Geo.Left;
            int rightDockVal  = DockMonitors.OrderByDescending(d => d.Geo.Right).First().Geo.Right;

            // now build the list of available positions for a given screen.
            for (int i = 0; i < DockMonitors.Count(); i++)
            {
                List <DockPosition> positions = new List <DockPosition> ();
                DockMonitor         mon       = DockMonitors.Where(d => d.MonitorNumber == i).First();

                if (mon.Geo.Left == leftDockVal)
                {
                    positions.Add(DockPosition.Left);
                }
                if (mon.Geo.Right == rightDockVal)
                {
                    positions.Add(DockPosition.Right);
                }
                if (mon.Geo.Top == topDockVal)
                {
                    positions.Add(DockPosition.Top);
                }
                if (mon.Geo.Bottom == bottomDockVal)
                {
                    positions.Add(DockPosition.Bottom);
                }

                mon.PossiblePositions = positions;
            }
        }
		void DetectMonitors ()
		{
			DockMonitors = new List<DockMonitor> ();
			
			// first add all of the screens and their geometries
			for (int i = 0; i < Screen.Default.NMonitors; i++) {
				DockMonitor mon = new DockMonitor ();
				mon.MonitorNumber = i;
				mon.Geo = Screen.Default.GetMonitorGeometry (i);
				DockMonitors.Add (mon);
			}
			
			int topDockVal = DockMonitors.OrderBy (d => d.Geo.Top).First ().Geo.Top;
			int bottomDockVal = DockMonitors.OrderByDescending (d => d.Geo.Bottom).First ().Geo.Bottom;
			int leftDockVal = DockMonitors.OrderBy (d => d.Geo.Left).First ().Geo.Left;
			int rightDockVal = DockMonitors.OrderByDescending (d => d.Geo.Right).First ().Geo.Right;
			
			// now build the list of available positions for a given screen.
			for (int i = 0; i < DockMonitors.Count (); i++) {
				List<DockPosition> positions = new List<DockPosition> ();
				DockMonitor mon = DockMonitors.Where (d => d.MonitorNumber == i).First ();
				
				if (mon.Geo.Left == leftDockVal)
					positions.Add (DockPosition.Left);
				if (mon.Geo.Right == rightDockVal)
					positions.Add (DockPosition.Right);
				if (mon.Geo.Top == topDockVal)
					positions.Add (DockPosition.Top);
				if (mon.Geo.Bottom == bottomDockVal)
					positions.Add (DockPosition.Bottom);
				
				mon.PossiblePositions = positions;
			}
		}