예제 #1
0
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            var id = (Rs232Action.Rs232ActionType)Enum.Parse(typeof(Rs232Action.Rs232ActionType), operationCmb.Text);
            var data = new Rs232Action.Rs232ActionData()
                                                   {
                                                       Port = portCmb.Text,
                                                       BaudRate = baudRateCmb.Text,
                                                       Command = commandTxb.Text,
                                                       DataBits = dataBitsCmb.Text,
                                                       Dtr = dtrCmb.Text,
                                                       Handshake = HandshakeCmb.Text,
                                                       Parity = parityCmb.Text,
                                                       Rts = rtsCmb.Text,
                                                       StopBits = stopBitsCmb.Text,
                                                       TargetVar = targetVarCmb.Text,
                                                       LogFileName = logCmb.Text,
                                                       AsBytes = asBytesCmb.Text,
                                                       SendLineFeed = lineFeedCmb.Text,
                                                       SendSingleChar = singleCharCmb.Text
                                                   };

            var rsObj = new Rs232Action(id, data);
            var entity = new StepEntity(rsObj);
            entity.Comment = string.Format("Rs232 Action - {0}", operationCmb.Text);
            Singleton.Instance<SaveData>().AddStepEntity(entity);
        }
예제 #2
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var conditionAction = new ConditionAction(new ConditionActionData { SourceVar = varCmb.Text, Lable = lableCmb.Text, Result = conditionCmb.Text });
     var entity = new StepEntity(conditionAction);
     entity.Comment = string.Format("If variable {0} is {1} then GoTo lable {2}", varCmb.Text, conditionCmb.Text, lableCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #3
0
 //private void saveBtn_Click(object sender, RoutedEventArgs e)
 //{
 //    var type = (ServerComAction.ActionType)Enum.Parse(typeof(ServerComAction.ActionType), operationCmb.Text);
 //    var action = new ServerComAction(type, new ServerComAction.ActionData() { Host = hostCmb.Text, Port = portTxb.Text,  Value = valueTxb.Text, TargetVar = targetVarCmb.Text });
 //    var entity = new StepEntity(action);
 //    entity.Comment = string.Format("Remote Server Action {0}", operationCmb.Text);
 //    Singleton.Instance<SaveData>().AddStepEntity(entity);
 //}
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (RemoteServerAction.ActionType)Enum.Parse(typeof(RemoteServerAction.ActionType), operationCmb.Text);
     var action = new RemoteServerAction(type, new RemoteServerAction.ActionData() { Host = hostCmb.Text, Port = portTxb.Text, Value = valueTxb.Text, TargetVar = targetVarCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Remote Server Action {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #4
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (TimersAction.TimersActionType)Enum.Parse(typeof(TimersAction.TimersActionType), operationCmb.Text);
     var timerAction = new TimersAction(type, new TimersAction.TimersActionData() { TimerName = timerNameTxb.Text, TargetVar = targetVarCmb.Text });
     var entity = new StepEntity(timerAction);
     entity.Comment = string.Format("Timer {0} - {1}", operationCmb.Text, timerNameTxb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #5
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (DateTimeAction.ActionType)Enum.Parse(typeof(DateTimeAction.ActionType), operationCmb.Text);
     var action = new DateTimeAction(type, new DateTimeAction.ActionData() { SourceVar = srcVarCmb.Text, TimeFormat = timeFormatCmb.Text, TargetVar = trgVarCmb.Text, Value = valueCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("DateTime {0} Action", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #6
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (Horison80PowerSupplyAction.ActionType)Enum.Parse(typeof(Horison80PowerSupplyAction.ActionType), operationCmb.Text);
     var action = new Horison80PowerSupplyAction(type, new Horison80PowerSupplyAction.ActionData() { Host = hostCmb.Text, Port = portTxb.Text, Parm1 = param1Txb.Text, TargetVar = targetVarCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("HR-80 Power Supply Action {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #7
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (SystemAction.ActionType)Enum.Parse(typeof(SystemAction.ActionType), operationCmb.Text);
     var action = new SystemAction(type, new SystemAction.ActionData() { TargetVar = targetCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("{0} System Action", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (MotorControllerAction.ActionType)Enum.Parse(typeof(MotorControllerAction.ActionType), operationCmb.Text);
     var action = new MotorControllerAction(type, new MotorControllerAction.ActionData() { ComPort = portCmb.Text, Value = valueCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Motor Controller {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #9
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = SwitchAction.ActionType.SwitchAction;
     var action = new SwitchAction(type, new SwitchAction.ActionData() { Switch = switchCmb.Text, CaseList = GenerateSwitchList(), DefaultScript = defaultScriptTxb.Text + SwitchAction.SwitchDelimiter + paramsDefaultTxb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Switch Action");
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (RelayControlAction.ActionType)Enum.Parse(typeof(RelayControlAction.ActionType), operationCmb.Text);
     var action = new RelayControlAction(type, new RelayControlAction.ActionData() { ComPort = portCmb.Text, Vendor = vendorCmb.Text, RelayNumber = relayNumberCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("RelayControl {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #11
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (LabelAction.ActionType)Enum.Parse(typeof(LabelAction.ActionType), operationCmb.Text);
     var action = new LabelAction(type, new LabelAction.ActionData() { LableName = lableCmb.Text, Loops = loopCountCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("{0} Label - {1}", operationCmb.Text, lableCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #12
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (SqliteAction.ActionType)Enum.Parse(typeof(SqliteAction.ActionType), operationCmb.Text);
     var action = new SqliteAction(type, new SqliteAction.ActionData() { DbName = dbNameTxb.Text, Options = optionsTxb.Text, Query = queryTxb.Text, TargetVar = varCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Sqlite {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #13
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (FileAction.ActionType)Enum.Parse(typeof(FileAction.ActionType), operationCmb.Text);
     var action = new FileAction(type, new FileAction.ActionData() { FileName = fileNameCmb.Text, TargetVar = valueCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("File Action {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #14
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var id = (ListAction.ActionType)Enum.Parse(typeof(ListAction.ActionType), operationCmb.Text);
     var action = new ListAction(id, new ListAction.ActionData() { ListName = listNameCmb.Text, Value = valueCmb.Text, Index = indexCmb.Text, Target = targetVarCmb.Text, FileName = fileNameCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("List Action - {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #15
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (EmailAction.ActionType)Enum.Parse(typeof(EmailAction.ActionType), operationCmb.Text);
     var action = new EmailAction(type, new EmailAction.ActionData() { Recipient = recipientTxb.Text, From = fromTxb.Text, Subject = subjectTxb.Text, Body = bodyTxb.Text, MailServer = mailSrvTxb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Email {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #16
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (SftpAction.SftpActionType)Enum.Parse(typeof(SftpAction.SftpActionType), operationCmb.Text);
     var action = new SftpAction(type, new SftpAction.SftpActionData() { Host = varCmb.Text, UserName = userNameTxb.Text, Password = passwordTxb.Text, Command1 = command1Txb.Text, Command2 = command2Txb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Sftp {0} Action", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #17
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (WaynPumpAction.ActionType)Enum.Parse(typeof(WaynPumpAction.ActionType), operationCmb.Text);
     var action = new WaynPumpAction(type, new WaynPumpAction.ActionData() { TargetVariable = varCmb.Text, PumpId = pumpCmb.Text, NzlId = nzlCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Wayne Sim {0} Action", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #18
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var data = new RunProgram.ActionData() { Program = programeTxb.Text, Parms = paramTxb.Text, WaitForClose = waitForExit.IsChecked.ToString() };
     var type = (RunProgram.ActionType)Enum.Parse(typeof(RunProgram.ActionType), operationCmb.Text);
     var action = new RunProgram(type, data);
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Process {0} with parameters {1} action {2}", programeTxb.Text, paramTxb.Text, operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #19
0
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            var type = (TelentAction.TelentActionType)Enum.Parse(typeof(TelentAction.TelentActionType), operationCmb.Text);

            var action = new TelentAction(type, new TelentAction.TelentActionData() { Host = hostTxb.Text, Port = portTxb.Text, Command = commandTxb.Text, TargetVar = varCmb.Text });
            var entity = new StepEntity(action);
            entity.Comment = string.Format("Telnet {0} Action", operationCmb.Text);
            Singleton.Instance<SaveData>().AddStepEntity(entity);
        }
예제 #20
0
 public void AddStep(string scriptName, string param)
 {
     var data = new ScriptAction.ActionData() { Name = scriptName, Params = param };
     var type = (ScriptAction.ActionType)Enum.Parse(typeof(ScriptAction.ActionType), "Execute");
     var action = new ScriptAction(type, data);
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Script Execute {0}", scriptName);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #21
0
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            var type = (TableAction.ActionType)Enum.Parse(typeof(TableAction.ActionType), operationCmb.Text);

            var action = new TableAction(type, new TableAction.ActionData() { TableName = tableNameCmb.Text, Value = valueCmb.Text, Row = rowCmb.Text, Column = colCmb.Text, FileName = fileCmb.Text, TargetVar = targetCmb.Text });
            var entity = new StepEntity(action);
            entity.Comment = string.Format("Table {0} Action", operationCmb.Text);
            Singleton.Instance<SaveData>().AddStepEntity(entity);
        }
예제 #22
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (AutoItUiAction.ActionType)Enum.Parse(typeof(AutoItUiAction.ActionType), operationCmb.Text);
     var data = new AutoItUiAction.ActionData { WindowTitle = winTitleCmb.Text, ControlID = controlIdTxb.Text, Text = textCmb.Text, TargetVariable = targetCmb.Text };
     var action = new AutoItUiAction(type, data);
     var entity = new StepEntity(action);
     entity.Comment = string.Format("GUI Automation {0}", operationCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #23
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var type = (MessageAction.ActionType)Enum.Parse(typeof(MessageAction.ActionType), "ShowMessage");
     var data = new MessageAction.ActionData { Message = messageCmb.Text, TimeOut = timeOutCmb.Text };
     var action = new MessageAction(type, data);
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Message action {0}", "ShowMessage");
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #24
0
 public StepEntity(StepEntity entity)
 {
     try
     {
         Enable = entity.Enable;
         Comment = entity.Comment;
         Action = entity.Action;
         OnFailureLabel = entity.OnFailureLabel;
     }
     catch { }
 }
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(targetCmb.Text))
                HelperClass.ShowMessageBox("Info", "Target Variable is empty");

            var type = (TextManipulationAction.TextActionType)Enum.Parse(typeof(TextManipulationAction.TextActionType), operationCmb.Text);
            var data = new TextActionData() { SourceVar = srcCmb.Text, TargetVar = targetCmb.Text, Value = valueTxb.Text, Length = lengthTxb.Text };
            var textMaipulationAction = new TextManipulationAction(type, data);
            var entity = new StepEntity(textMaipulationAction);
            entity.Comment = string.Format("Text Operations {0}", operationCmb.Text);
            Singleton.Instance<SaveData>().AddStepEntity(entity);
        }
예제 #26
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(targetVarCmb.Text))
     {
         HelperClass.ShowErrorMessage("Target variable is empty");
         return;
     }
     var type = (PingAction.ActionType)Enum.Parse(typeof(PingAction.ActionType), operationCmb.Text);
     var action = new PingAction(type, new PingAction.ActionData() { Host = hostCmb.Text, Loops = loopCountCmb.Text, TargetVar = targetVarCmb.Text });
     var entity = new StepEntity(action);
     entity.Comment = string.Format("Ping Action to host {0}", hostCmb.Text);
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }
예제 #27
0
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            var id = (VariablesAction.VariablesActionType)Enum.Parse(typeof(VariablesAction.VariablesActionType), operationCmb.Text);
            IVariableData iv = new SavedData.VariableData(varCmb.Text, valueTxb.Text);
            var op = new OperationData { FileName = fileNameCmb.Text, TargetVar = targetVarCmb.Text, Value = valueTxb.Text };//we use the same valueTxb.Text field for both setting value to variable and performing operations (depands on the action)

            var variable = new VariablesAction(id, iv, op);
            var entity = new StepEntity(variable);
            entity.Comment = string.Format("Variables {0} - {1}", operationCmb.Text, varCmb.Text);
            Singleton.Instance<SaveData>().AddStepEntity(entity);

            if ((id == VariablesAction.VariablesActionType.Create) || (id == VariablesAction.VariablesActionType.LoadVariableFile))
                variable.Execute();
        }
예제 #28
0
        public void AddStepEntity(StepEntity entity)
        {
            if (SelectedStepEntityIndex == -1)
                SelectedStepEntityIndex = 0;
            int index = SelectedStepEntityIndex;
            entity.Enable = true;
            if (IsSelectedStepEntity)
            {
                entity.Comment = Script.Entities[index].Comment;//save the previous comment
                Script.Entities[index] = entity;
                SelectedStepEntityIndex = index;//SelectedStepEntityIndex turns to -1 after update
            }
            else
                Script.Entities.Add(entity);

            UpdateAutoSave();
        }
예제 #29
0
        public static ScriptObj ExtructScriptFromFile(string fileName)
        {
            string detail = string.Empty;
            if (string.IsNullOrEmpty(fileName))
                return null;

            if (!File.Exists(fileName))
            {
                return null;
            }
            ScriptObj script = new ScriptObj();
            ActionBase action = null;
            StepEntity stepEntity = null;
            using (XmlReader reader = XmlReader.Create(fileName))
            // using (XmlReader reader =XmlReader.Create(new StreamReader(fileName, Encoding.GetEncoding("ISO-8859-9"))))
            {
                while (reader.Read())
                {
                    // Only detect start elements.
                    if (reader.IsStartElement())
                    {
                        switch (reader.Name)
                        {
                            case "Script":
                                script = new ScriptObj();
                                break;

                            case "Enable":
                                stepEntity.Enable = bool.Parse(reader.ReadInnerXml());
                                break;

                            case "Description":
                                detail = reader.ReadInnerXml();
                                detail = detail.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">");//encode special characters -The characters &, <, and > are replaced with &amp;, &lt;, and &gt;, respectively
                                script.Description = detail;
                                break;

                            case "Step":
                                if (stepEntity != null)
                                {
                                    stepEntity.Action = action;
                                    stepEntity.Action.Construct();
                                    script.Entities.Add(stepEntity);
                                }
                                stepEntity = new StepEntity(action);
                                break;

                            case "OnFailureLable":
                                stepEntity.OnFailureLabel = reader.ReadInnerXml();
                                break;

                            case "Comment":
                                detail = reader.ReadInnerXml();
                                detail = detail.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">");//encode special characters -The characters &, <, and > are replaced with &amp;, &lt;, and &gt;, respectively
                                stepEntity.Comment = detail;
                                break;

                            case "ID":
                                var id = Enum.Parse(typeof(Enums.ActionTypeId), reader.ReadInnerXml().ToString());
                                action = ActionFactory.GetAction((Enums.ActionTypeId)id);
                                break;

                            case "Name":
                                action.Name = reader.ReadInnerXml();
                                break;

                            case "Detail":
                                detail = reader.ReadInnerXml();
                                detail = detail.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">");//encode special characters -The characters &, <, and > are replaced with &amp;, &lt;, and &gt;, respectively
                                action.Details.Add(detail);
                                break;
                        }
                    }
                }
            }
            //adding the last step entity

            if (action != null)
            {
                stepEntity.Action = action;
                stepEntity.Action.Construct();
                script.Entities.Add(stepEntity);
            }

            return script;
        }
예제 #30
0
 private void saveBtn_Click(object sender, RoutedEventArgs e)
 {
     var entity = new StepEntity(new SleepAction(delayCmb.Text));
     entity.Comment = "Sleep for " + "{" + delayCmb.Text + "} Sec";
     Singleton.Instance<SaveData>().AddStepEntity(entity);
 }