Example #1
0
        public void AddController(FanController c)
        {
            if (controllers.Contains(c))
            {
                return;
            }

            controllers.Add(c);
            c.enabledChanged += FanController_enabled_changed;
            FanController_enabled_changed(c, null);
        }
Example #2
0
        public FanController CloneController(FanController f)
        {
            // Copy by reloading from settings
            f.SaveToSettings();
            FanController c = new FanController(f.ID, sensors, settings);

            // Assign new ID to actually create a different instance
            c.ID      = GetFreeControllerSlot();
            c.Name    = c.Name + "_copy";
            c.Enabled = false;
            c.SaveToSettings();
            AddController(c);
            return(c);
        }
Example #3
0
        public void FanController_enabled_changed(object sender, EventArgs e)
        {
            FanController c = (FanController)sender;

            if (c.Enabled)
            {
                // Disable all other controllers affecting the same IControl
                foreach (FanController fc in controllers)
                {
                    if (fc.Controlled == c.Controlled && fc != c && fc.Enabled)
                    {
                        fc.Enabled = false;
                        active.Remove(c);
                    }
                }
                active.Add(c);
            }
            else
            {
                active.Remove(c);
            }
        }