예제 #1
0
        public void Unload(Appliance appl)
        {
            UnloadedAppliance uAppl = new UnloadedAppliance(appl);

            _appliances[appl.GetUniqueName()] = uAppl;

            MenuItem mi = appl.GetServerMenuItem();
        }
예제 #2
0
        /*
         * Constructor
         */
        public Appliance(UnloadedAppliance appl)
            : base(appl)
        {
                        #if SMARTPHONE
            _leftMenuStack = new Stack();

            _leftMenuStack.Push(new LeftMenuStackItem("Log", new EventHandler(this.leftHandler)));
                        #endif
        }
예제 #3
0
        public void ActivateAppliance(UnloadedAppliance oldAppl, Appliance newAppl)
        {
            Globals.GetFrame(newAppl).AddActiveAppliance(newAppl);

            _appliances[newAppl.GetUniqueName()] = newAppl;
        }
예제 #4
0
        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);
            }
        }