Example #1
0
        public void AddActiveAppliance(Appliance a)
        {
            _appliances.Add(a);

            DeviceSwitcher d = new DeviceSwitcher(a);

            a.GetMenuItem().Click += new EventHandler(d.DeviceMenuClicked);
            deviceMenu.MenuItems.Add(a.GetMenuItem());

            a.SetUIGenerator(new UIGeneration.UIGenerator(_rulePhases,
                                                          _smartCIOManager,
                                                          _registry));

            a.GetUIGenerator().Size     = this.Size;
            a.GetUIGenerator().Location = new System.Drawing.Point(0, 0);

            a.GetUIGenerator().GenerateUI(a);

            SetCurrentAppliance(a);
        }
Example #2
0
        public void RemoveAppliance(Appliance a)
        {
            _appliances.Remove(a);
            if (_appliances.Count > 0)
            {
                SetCurrentAppliance((Appliance)_appliances[0]);
            }
            else
            {
                _currentAppliance = null;
                this.Controls.Remove(a.GetUIGenerator());
                disconnectItem.Enabled = false;
                ShowLogPanel();
            }

            deviceMenu.MenuItems.Remove(a.GetMenuItem());
        }
Example #3
0
        public void SetCurrentAppliance(Appliance a)
        {
            if (_currentAppliance != null)
            {
                this.Controls.Remove(_currentAppliance.GetUIGenerator());
                _currentAppliance.GetMenuItem().Checked = false;
            }
            else
            {
                disconnectItem.Enabled = true;
            }

            _currentAppliance = a;
            _currentAppliance.GetMenuItem().Checked = true;
            this.Controls.Add(_currentAppliance.GetUIGenerator());
            _currentAppliance.GetUIGenerator().BringToFront();
            HideLogPanel();
        }