public void Unload(Appliance appl) { UnloadedAppliance uAppl = new UnloadedAppliance(appl); _appliances[appl.GetUniqueName()] = uAppl; MenuItem mi = appl.GetServerMenuItem(); }
/* * Constructor */ public Appliance(UnloadedAppliance appl) : base(appl) { #if SMARTPHONE _leftMenuStack = new Stack(); _leftMenuStack.Push(new LeftMenuStackItem("Log", new EventHandler(this.leftHandler))); #endif }
public void ActivateAppliance(UnloadedAppliance oldAppl, Appliance newAppl) { Globals.GetFrame(newAppl).AddActiveAppliance(newAppl); _appliances[newAppl.GetUniqueName()] = newAppl; }
protected void initUIMenu(ServerInformation msg) { _name = msg.GetServerName(); if (_menu == null) { initMenu(); } _menu.MenuItems.Clear(); clearMarks(); int count = 0; _menu.Text = _name; IEnumerator e = msg.GetDevices(); while (e.MoveNext()) { ServerInformation.DeviceInfo device = (ServerInformation.DeviceInfo)e.Current; ApplianceStub astub = (ApplianceStub)_appliances[device.GetDeviceUniqueString()]; if (astub == null) { astub = new UnloadedAppliance(this, device.GetDevicePort(), device.GetDeviceName(), device.GetDeviceUniqueString()); _appliances[astub.GetUniqueName()] = astub; if (_openAllNext) { ((UnloadedAppliance)astub).LoadAppliance(); } } astub.SetMark(true); count++; MenuItem mi = new MenuItem(); mi.Text = device.GetDeviceName(); _menu.MenuItems.Add(mi); astub.SetServerMenuItem(mi); mi.Click += new System.EventHandler(astub.GetServerMenuListener().MenuClicked); } _openAllNext = false; if (count < _appliances.Count) { MenuItem mi = null; if (count > 0) { mi = new MenuItem(); mi.Text = "-"; _menu.MenuItems.Add(mi); } e = _appliances.Values.GetEnumerator(); while (e.MoveNext()) { ApplianceStub astub = (ApplianceStub)e.Current; if (!astub.IsMarked()) { mi = new MenuItem(); mi.Text = astub.GetServerName(); mi.Enabled = false; _menu.MenuItems.Add(mi); } } } if (_appliances.Count == 0 && _menu.MenuItems.Count == 0) { MenuItem mi = new MenuItem(); mi.Text = "No Appliances!"; mi.Enabled = false; _menu.MenuItems.Add(mi); } }