示例#1
0
 public void addPeripheric(Peripheric p)
 {
     _peripherics.Add(p);
 }
示例#2
0
        protected void parseInteractions(XElement interactionNode)
        {
            Interaction interaction = new Interaction();

            foreach (XElement action in interactionNode.Elements())
            {
                if (action.Name.LocalName == "SendSignal")
                {
                    string signal = action.Attribute("name").Value;
                    string target = "";
                    if (action.Attribute("target") != null)
                    {
                        target = action.Attribute("target").Value;
                    }
                    if (target == "")
                    {
                        target = "designated";
                    }
                    string periphName = action.Attribute("peripheric").Value;
                    string buttonName = action.Attribute("button").Value;
                    bool   pressed    = (bool)action.Attribute("pressed");

                    SendSignalAction sendSignal = new SendSignalAction();
                    sendSignal.SignalClass = new Signal(signal);

                    Peripheric periph = this.window.getPeripheric(periphName);
                    Button     button = periph.getButton(buttonName);
                    if (button != null)
                    {
                        interaction.addButtonAction(button, sendSignal, target, pressed);
                    }
                }
                else if (action.Name.LocalName == "CallOperation")
                {
                    string classifier  = action.Attribute("classifier").Value;
                    Class  targetClass = MascaretApplication.Instance.Model.AllClasses[classifier][0];
                    string operation   = action.Attribute("name").Value;
                    string target      = action.Attribute("target").Value;
                    string periphName  = action.Attribute("peripheric").Value;
                    string buttonName  = action.Attribute("button").Value;
                    bool   pressed     = (bool)action.Attribute("pressed");

                    CallOperationAction callOp = new CallOperationAction();
                    callOp.Operation = targetClass.Operations[operation];

                    Peripheric periph = this.window.getPeripheric(periphName);
                    Button     button = periph.getButton(buttonName);
                    if (button != null)
                    {
                        interaction.addButtonAction(button, callOp, target, pressed);
                    }
                }
                else if (action.Name.LocalName == "CallProcedure")
                {
                    string procedure    = action.Attribute("name").Value;
                    string organisation = action.Attribute("organisation").Value;

                    string target = "";
                    if (action.Attribute("target") != null)
                    {
                        target = action.Attribute("target").Value;
                    }
                    if (target == "")
                    {
                        target = "designated";
                    }
                    string periphName = action.Attribute("peripheric").Value;
                    string buttonName = action.Attribute("button").Value;
                    bool   pressed    = (bool)action.Attribute("pressed");

                    CallProcedureAction callProc = new CallProcedureAction();
                    callProc.Procedure            = procedure;
                    callProc.OrganisationalEntity = organisation;

                    Peripheric periph = this.window.getPeripheric(periphName);
                    Button     button = periph.getButton(buttonName);
                    if (button != null)
                    {
                        interaction.addButtonAction(button, callProc, target, pressed);
                    }
                }
            }
        }
示例#3
0
 public void addPeripheric(Peripheric p)
 {
     _peripherics.Add(p);
 }