public ConDiagsView(ConDiagsController controller, Diags diags) { this.controller = controller; this.diags = diags; this.diags.QuestionAsk = Question; this.diags.MessageSend += Logger; this.diags.PropertyChanged += NotifyPropertyChanged; }
public ConDiagsView(ConDiagsController controller, Diags modelBind) { this.controller = controller; this.modelBind = modelBind; this.modelBind.QuestionAsk = Question; this.modelBind.MessageSend += Logger; this.modelBind.ReportClose += Summarize; this.modelBind.FileVisit += FileProgress; }
public ConLameView(ConLameController controller, Diags modelBind) { this.controller = controller; this.modelBind = modelBind; this.modelBind.InputChar = InputChar; this.modelBind.MessageSend += Logger; this.modelBind.ReportClose += Summarize; this.modelBind.FileVisit += FileProgress; this.modelBind.Product = ConLameController.ProductText; this.modelBind.ProductVersion = ConLameController.VersionText; }
private void button_Run_Click(object sender, EventArgs e) { Diags.Customers costumer = (Diags.Customers)Enum.Parse(typeof(Diags.Customers), Properties.Settings.Default.Costumer); _diags = new Diags( dut_port_name: Properties.Settings.Default.COM_DUT, ble_port_name: Properties.Settings.Default.COM_BLE, smt_serial: textBox_Serial.Text.ToUpper(), customer: costumer, hw_version: Properties.Settings.Default.HwVer, tester: Properties.Settings.Default.Operator, hub_ip_addr: null ); _diags.Status_Event += _diags_Status_Event; _diags.LogFolder = Properties.Settings.Default.Log_Folder; Directory.CreateDirectory(_diags.LogFolder); _diags.LED_Red_Low_Value = Properties.Settings.Default.LED_Red_Off_Val; _diags.LED_Red_High_Value = Properties.Settings.Default.LED_Red_On_Val; _diags.LED_Green_Low_Value = Properties.Settings.Default.LED_Green_Off_Val; _diags.LED_Green_High_Value = Properties.Settings.Default.LED_Green_On_Val; _diags.LED_Yellow_Low_Value = Properties.Settings.Default.LED_Yellow_Off_Val; _diags.LED_Yellow_High_Value = Properties.Settings.Default.LED_Yellow_On_Val; _run_task = new Task(() => _diags.Run()); _run_task.ContinueWith(runDone, TaskContinuationOptions.OnlyOnRanToCompletion); _run_task.ContinueWith(runError, TaskContinuationOptions.OnlyOnFaulted); setRunning(true); textBox_OutputStatus.Clear(); textBox_OutputStatus.AppendText("Parameters:\r\n"); textBox_OutputStatus.AppendText(string.Format("Operator: {0}\r\n", _diags.Tester)); textBox_OutputStatus.AppendText(string.Format("DUT COM: {0}\r\n", _diags.COM_DUT_Name)); textBox_OutputStatus.AppendText(string.Format("BT COM: {0}\r\n", _diags.COM_BT_Name)); textBox_OutputStatus.AppendText(string.Format("Customer: {0}\r\n", _diags.Customer.ToString())); textBox_OutputStatus.AppendText(string.Format("HW Ver: {0}\r\n", _diags.HW_Ver)); textBox_OutputStatus.AppendText("\r\n"); this.timer_UpdateRunning.Start(); _run_task.Start(); }
//This method will load the dialogue from the DialogueAssign component sent. bool Load(string dName) { diags[currentDiag] = new Diags(diags[currentDiag].name, diags[currentDiag].loadTag); if (Resources.Load("Dialogues/" + dName) == null) { return(false); } Dictionary <string, object> dict = SerializeHelper.ReadFromFile(dName) as Dictionary <string, object>; int pDiags = (int)((long)dict["playerDiags"]); int nDiags = (int)((long)dict["npcDiags"]); int aDiags = 0; if (dict.ContainsKey("actionNodes")) { aDiags = (int)((long)dict["actionNodes"]); } diags[currentDiag].start = (int)((long)dict["startPoint"]); if (dict.ContainsKey("loadTag")) { diags[currentDiag].loadTag = (string)dict["loadTag"]; } //Create first... for (int i = 0; i < pDiags; i++) { string tagt = ""; if (dict.ContainsKey("pd_pTag_" + i.ToString())) { tagt = (string)dict["pd_pTag_" + i.ToString()]; } addSet( (int)((long)dict["pd_comSize_" + i.ToString()]), (int)((long)dict["pd_ID_" + i.ToString()]), tagt ); } for (int i = 0; i < nDiags; i++) { string tagt = ""; if (dict.ContainsKey("nd_tag_" + i.ToString())) { tagt = (string)dict["nd_tag_" + i.ToString()]; } addAnswer( (string)dict["nd_text_" + i.ToString()], (int)((long)dict["nd_ID_" + i.ToString()]), (string)dict["nd_extraData_" + i.ToString()], tagt ); } for (int i = 0; i < aDiags; i++) { float pFloat; var pfl = dict["ac_pFloat_" + i.ToString()]; if (pfl.GetType() == typeof(System.Double)) { pFloat = System.Convert.ToSingle(pfl); } else { pFloat = (float)(long)pfl; } diags[currentDiag].actionNodes.Add(new ActionNode( (int)((long)dict["ac_ID_" + i.ToString()]), (string)dict["ac_meth_" + i.ToString()], (string)dict["ac_goName_" + i.ToString()], (bool)dict["ac_pause_" + i.ToString()], (bool)dict["ac_pBool_" + i.ToString()], (string)dict["ac_pString_" + i.ToString()], (int)((long)dict["ac_pInt_" + i.ToString()]), pFloat )); if (dict.ContainsKey("ac_ovrStartNode_" + i.ToString())) { diags[currentDiag].actionNodes[diags[currentDiag].actionNodes.Count - 1].ovrStartNode = (int)((long)dict["ac_ovrStartNode_" + i.ToString()]); } if (dict.ContainsKey("ac_renameDialogue_" + i.ToString())) { diags[currentDiag].actionNodes[diags[currentDiag].actionNodes.Count - 1].renameDialogue = (string)dict["ac_renameDialogue_" + i.ToString()]; } } //Connect now... for (int i = 0; i < diags[currentDiag].playerNodes.Count; i++) { for (int ii = 0; ii < diags[currentDiag].playerNodes[i].comment.Count; ii++) { diags[currentDiag].playerNodes[i].comment[ii].text = (string)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "text"]; if (dict.ContainsKey("pd_" + i.ToString() + "_com_" + ii.ToString() + "extraD")) { diags[currentDiag].playerNodes[i].comment[ii].extraData = (string)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "extraD"]; } int index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "iSet"]); if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].inputSet = diags[currentDiag].playerNodes[index]; } index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "oAns"]); if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].outputAnswer = diags[currentDiag].npcNodes[index]; } index = -1; if (dict.ContainsKey("pd_" + i.ToString() + "_com_" + ii.ToString() + "oAct")) { index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "oAct"]); } if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].outAction = diags[currentDiag].actionNodes[index]; } } } for (int i = 0; i < diags[currentDiag].npcNodes.Count; i++) { int index = (int)((long)dict["nd_oSet_" + i.ToString()]); if (index != -1) { diags[currentDiag].npcNodes[i].outputSet = diags[currentDiag].playerNodes[index]; } if (dict.ContainsKey("nd_oNPC_" + i.ToString())) { int index2 = (int)((long)dict["nd_oNPC_" + i.ToString()]); if (index2 != -1) { diags[currentDiag].npcNodes[i].outputNPC = diags[currentDiag].npcNodes[index2]; } } if (dict.ContainsKey("nd_oAct_" + i.ToString())) { index = -1; index = (int)((long)dict["nd_oAct_" + i.ToString()]); if (index != -1) { diags[currentDiag].npcNodes[i].outAction = diags[currentDiag].actionNodes[index]; } } } for (int i = 0; i < diags[currentDiag].actionNodes.Count; i++) { diags[currentDiag].actionNodes[i].paramType = (int)((long)dict["ac_paramT_" + i.ToString()]); int index = -1; index = (int)((long)dict["ac_oSet_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outPlayer = diags[currentDiag].playerNodes[index]; } if (dict.ContainsKey("ac_oNPC_" + i.ToString())) { index = -1; index = (int)((long)dict["ac_oNPC_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outNPC = diags[currentDiag].npcNodes[index]; } } if (dict.ContainsKey("ac_oAct_" + i.ToString())) { index = -1; index = (int)((long)dict["ac_oAct_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outAction = diags[currentDiag].actionNodes[index]; } } } diags[currentDiag].loaded = true; return(true); }
public void Create(ConDiagsController controller, Diags diags) { var view = new ConDiagsView(controller, diags); }
public void Create(ConLameController controller, Diags modelBind) { var view = new ConLameView(controller, modelBind); }
//This method will load the dialogue from the DialogueAssign component sent. static bool Load(string dName) { diags[currentDiag] = new Diags(diags[currentDiag].name, diags[currentDiag].loadTag); if (Resources.Load("Dialogues/" + dName) == null) { return(false); } Dictionary <string, object> dict = SerializeHelper.ReadFromFile(dName) as Dictionary <string, object>; int pDiags = (int)((long)dict["playerDiags"]); int nDiags = (int)((long)dict["npcDiags"]); int aDiags = 0; if (dict.ContainsKey("actionNodes")) { aDiags = (int)((long)dict["actionNodes"]); } diags[currentDiag].start = (int)((long)dict["startPoint"]); if (dict.ContainsKey("loadTag")) { diags[currentDiag].loadTag = (string)dict["loadTag"]; } Sprite[] sprites = Resources.LoadAll <Sprite>(""); List <string> spriteNames = new List <string>(); foreach (Sprite t in sprites) { spriteNames.Add(t.name); } //Create first... for (int i = 0; i < pDiags; i++) { string tagt = ""; if (dict.ContainsKey("pd_pTag_" + i.ToString())) { tagt = (string)dict["pd_pTag_" + i.ToString()]; } addSet( (int)((long)dict["pd_comSize_" + i.ToString()]), (int)((long)dict["pd_ID_" + i.ToString()]), tagt ); CommentSet com = diags[currentDiag].playerNodes[diags[currentDiag].playerNodes.Count - 1]; if (dict.ContainsKey("pd_sprite_" + i.ToString())) { string name = Path.GetFileNameWithoutExtension((string)dict["pd_sprite_" + i.ToString()]); if (spriteNames.Contains(name)) { com.sprite = sprites[spriteNames.IndexOf(name)]; } else { Debug.LogError("'" + name + "' not found in any Resources folder!"); } } if (dict.ContainsKey("pd_vars" + i.ToString())) { for (int v = 0; v < (int)(long)dict["pd_vars" + i.ToString()]; v++) { com.vars.Add((string)dict["pd_var_" + i.ToString() + "_" + v.ToString()]); com.varKeys.Add((string)dict["pd_varKey_" + i.ToString() + "_" + v.ToString()]); } } } for (int i = 0; i < nDiags; i++) { string tagt = ""; if (dict.ContainsKey("nd_tag_" + i.ToString())) { tagt = (string)dict["nd_tag_" + i.ToString()]; } addAnswer( (string)dict["nd_text_" + i.ToString()], (int)((long)dict["nd_ID_" + i.ToString()]), (string)dict["nd_extraData_" + i.ToString()], tagt ); Answer npc = diags[currentDiag].npcNodes[diags[currentDiag].npcNodes.Count - 1]; if (dict.ContainsKey("nd_sprite_" + i.ToString())) { string name = Path.GetFileNameWithoutExtension((string)dict["nd_sprite_" + i.ToString()]); if (spriteNames.Contains(name)) { npc.sprite = sprites[spriteNames.IndexOf(name)]; } else { Debug.LogError("'" + name + "' not found in any Resources folder!"); } } if (dict.ContainsKey("nd_vars" + i.ToString())) { for (int v = 0; v < (int)(long)dict["nd_vars" + i.ToString()]; v++) { npc.vars.Add((string)dict["nd_var_" + i.ToString() + "_" + v.ToString()]); npc.varKeys.Add((string)dict["nd_varKey_" + i.ToString() + "_" + v.ToString()]); } } } for (int i = 0; i < aDiags; i++) { float pFloat; var pfl = dict["ac_pFloat_" + i.ToString()]; if (pfl.GetType() == typeof(System.Double)) { pFloat = System.Convert.ToSingle(pfl); } else { pFloat = (float)(long)pfl; } diags[currentDiag].actionNodes.Add(new ActionNode( (int)((long)dict["ac_ID_" + i.ToString()]), (string)dict["ac_meth_" + i.ToString()], (string)dict["ac_goName_" + i.ToString()], (bool)dict["ac_pause_" + i.ToString()], (bool)dict["ac_pBool_" + i.ToString()], (string)dict["ac_pString_" + i.ToString()], (int)((long)dict["ac_pInt_" + i.ToString()]), pFloat )); if (dict.ContainsKey("ac_ovrStartNode_" + i.ToString())) { diags[currentDiag].actionNodes[diags[currentDiag].actionNodes.Count - 1].ovrStartNode = (int)((long)dict["ac_ovrStartNode_" + i.ToString()]); } if (dict.ContainsKey("ac_renameDialogue_" + i.ToString())) { diags[currentDiag].actionNodes[diags[currentDiag].actionNodes.Count - 1].renameDialogue = (string)dict["ac_renameDialogue_" + i.ToString()]; } } //Connect now... for (int i = 0; i < diags[currentDiag].playerNodes.Count; i++) { for (int ii = 0; ii < diags[currentDiag].playerNodes[i].comment.Count; ii++) { diags[currentDiag].playerNodes[i].comment[ii].text = (string)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "text"]; if (dict.ContainsKey("pd_" + i.ToString() + "_com_" + ii.ToString() + "extraD")) { diags[currentDiag].playerNodes[i].comment[ii].extraData = (string)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "extraD"]; } int index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "iSet"]); if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].inputSet = diags[currentDiag].playerNodes[index]; } index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "oAns"]); if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].outputAnswer = diags[currentDiag].npcNodes[index]; } index = -1; if (dict.ContainsKey("pd_" + i.ToString() + "_com_" + ii.ToString() + "oAct")) { index = (int)((long)dict["pd_" + i.ToString() + "_com_" + ii.ToString() + "oAct"]); } if (index != -1) { diags[currentDiag].playerNodes[i].comment[ii].outAction = diags[currentDiag].actionNodes[index]; } } } for (int i = 0; i < diags[currentDiag].npcNodes.Count; i++) { int index = (int)((long)dict["nd_oSet_" + i.ToString()]); if (index != -1) { diags[currentDiag].npcNodes[i].outputSet = diags[currentDiag].playerNodes[index]; } if (dict.ContainsKey("nd_oNPC_" + i.ToString())) { int index2 = (int)((long)dict["nd_oNPC_" + i.ToString()]); if (index2 != -1) { diags[currentDiag].npcNodes[i].outputNPC = diags[currentDiag].npcNodes[index2]; } } if (dict.ContainsKey("nd_oAct_" + i.ToString())) { index = -1; index = (int)((long)dict["nd_oAct_" + i.ToString()]); if (index != -1) { diags[currentDiag].npcNodes[i].outAction = diags[currentDiag].actionNodes[index]; } } } for (int i = 0; i < diags[currentDiag].actionNodes.Count; i++) { diags[currentDiag].actionNodes[i].paramType = (int)((long)dict["ac_paramT_" + i.ToString()]); int index = -1; index = (int)((long)dict["ac_oSet_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outPlayer = diags[currentDiag].playerNodes[index]; } if (dict.ContainsKey("ac_oNPC_" + i.ToString())) { index = -1; index = (int)((long)dict["ac_oNPC_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outNPC = diags[currentDiag].npcNodes[index]; } } if (dict.ContainsKey("ac_oAct_" + i.ToString())) { index = -1; index = (int)((long)dict["ac_oAct_" + i.ToString()]); if (index != -1) { diags[currentDiag].actionNodes[i].outAction = diags[currentDiag].actionNodes[index]; } } } diags[currentDiag].loaded = true; return(true); }