Exemple #1
0
        public Bar(Monitor monitor)
        {
            InternalClosing = false;
            InitializeComponent();

            barHeight = Convert.ToInt32(Manager.settings.ReadSettingOrDefault(15, "General.Bar.Height"));
            titleFont = new Font(Manager.settings.ReadSettingOrDefault("Segoe UI", "General.Bar.Font"), barHeight * 0.6f);
            boldFont = new Font(titleFont, FontStyle.Bold);
            foregroundBrush =
                new SolidBrush(
                    Color.FromName(Manager.settings.ReadSettingOrDefault("Black", "General.Bar.UnselectedForeground")));
            foregroundBrush2 =
                new SolidBrush(
                    Color.FromName(Manager.settings.ReadSettingOrDefault("LightGray", "General.Bar.SelectedForeground")));
            backgroundBrush =
                new SolidBrush(
                    Color.FromName(Manager.settings.ReadSettingOrDefault("DarkGray", "General.Bar.SelectedItemColour")));
            backgroundBrush2 =
                new SolidBrush(
                    Color.FromName(Manager.settings.ReadSettingOrDefault("Black",
                                                                         "General.Bar.UnselectedBackgroundColour")));
            selectedBrush =
                new SolidBrush(Color.FromArgb(128,
                                              Color.FromName(Manager.settings.ReadSettingOrDefault("White",
                                                                                                   "General.Bar.SelectedTagColour"))));
            coverBrush = new SolidBrush(Color.FromArgb(
                int.Parse(Manager.settings.ReadSettingOrDefault("128", "General.Bar.Inactive.Opacity")),
                Color.FromName(Manager.settings.ReadSettingOrDefault("Black", "General.Bar.Inactive.Colour"))
                ));

            Color seperatorColour =
                Color.FromName(Manager.settings.ReadSettingOrDefault("Blue", "General.Bar.SeperatorColour"));
            int seperatorWidth = int.Parse(Manager.settings.ReadSettingOrDefault("3", "General.Bar.SeperatorWidth"));
            seperatorPen = new Pen(seperatorColour, seperatorWidth);
            _screen = monitor.Screen;
            _parent = monitor;

            tagStyle = Manager.settings.ReadSettingOrDefault("numbers", _parent.SafeName, "Bar", "TagStyle");
            this.StartPosition = FormStartPosition.Manual;
            this.Location = _screen.Bounds.Location;
            this.Width = _screen.Bounds.Width;
            this.Height = 10;
            this.FormBorderStyle = FormBorderStyle.None;
            this.DesktopLocation = this.Location;
            Color bColor = Color.FromName(Manager.settings.ReadSettingOrDefault("DarkGray", "General.Bar.BackColour"));
            this.BackColor = bColor;
            this.ShowInTaskbar = false;
            BarWindow = new Window("", this.Handle, "", "", true);
            loadPluginItems();
            loadAdditionalItems();
            generateMenu();

            SystemEvents.SessionEnding += SystemEvents_SessionEnding;
        }
Exemple #2
0
 private static void setupMonitors()
 {
     foreach (Screen screen in Screen.AllScreens) {
         Monitor monitor = new Monitor(screen);
         monitors.Add(monitor);
     }
 }
Exemple #3
0
 public static int GetMonitorIndex(Monitor monitor)
 {
     Screen screen = monitor.Screen;
     int index = 0;
     foreach (Monitor mon in monitors) {
         if (mon.Name == screen.DeviceName) {
             return index;
         }
         index++;
     }
     return 0;
 }
Exemple #4
0
 public bool Equals(Monitor other)
 {
     if (ReferenceEquals(null, other)) {
         return false;
     }
     if (ReferenceEquals(this, other)) {
         return true;
     }
     return Equals(other.Name, Name);
 }