Example #1
0
        public ButtonControlState(IImageCache imageCache, CockpitXML.CockpitControlsButtonState state)
        {
            if (state.StateValue == null)
            {
                stateValues = new string[0];
            }
            else
            {
                stateValues = state.StateValue;
            }

            this.stateImage       = imageCache.getImage(state.Image);
            this.pushedStateImage = imageCache.getImage(state.PushedImage);

            if (state.PushedAction != null)
            {
                foreach (string action in state.PushedAction)
                {
                    pushedActions.Add(ActionFactory.CreateAction(action));
                }
            }

            if (state.ReleaseAction != null)
            {
                foreach (string action in state.ReleaseAction)
                {
                    releaseActions.Add(ActionFactory.CreateAction(action));
                }
            }
        }
Example #2
0
        public ControlManager(INetConnection connection, IImageCache imageCache, string[] startActions, string[] resetActions, CockpitXML.CockpitControls controls)
        {
            this.connection = connection;
            this.imageCache = imageCache;

            connection.Manager = this;

            // Load start actions
            if (startActions != null)
            {
                foreach (string action in startActions)
                {
                    this.startActions.Add(ActionFactory.CreateAction(action));
                }
            }

            if (resetActions != null)
            {
                foreach (string action in resetActions)
                {
                    if (action.StartsWith("RS:"))
                    {
                        TouchPal.Error("Reset CommandAction cannot be used as a ResetAction.");
                    }
                    else
                    {
                        this.resetActions.Add(ActionFactory.CreateAction(action));
                    }
                }
            }

            // Load all of the controls defined
            if (controls.Button != null)
            {
                foreach (CockpitXML.CockpitControlsButton control in controls.Button)
                {
                    TouchPal.Debug("Loading button control: " + control.Name);
                    ButtonCockpitControl item = new ButtonCockpitControl(this, control);
                    this.controls.Add(control.Name, item);
                }
            }

            // Load all of the controls defined
            if (controls.Text != null)
            {
                foreach (CockpitXML.CockpitControlsText control in controls.Text)
                {
                    TouchPal.Debug("Loading text control: " + control.Name);
                    TextCockpitControl item = new TextCockpitControl(this, control);
                    this.controls.Add(control.Name, item);
                }
            }
        }
Example #3
0
        public BaseCockpitControl(ControlManager manager, string name, int width, int height, int networkid, string[] pushedActions, string[] releaseActions)
        {
            this.manager   = manager;
            this.size      = new Size(width, height);
            this.name      = name;
            this.networkID = networkid;

            if (pushedActions != null)
            {
                foreach (string action in pushedActions)
                {
                    this.pushedActions.Add(ActionFactory.CreateAction(action));
                }
            }

            if (releaseActions != null)
            {
                foreach (string action in releaseActions)
                {
                    this.releaseActions.Add(ActionFactory.CreateAction(action));
                }
            }
        }