public bool plotList() { bool plotResult = false; StarterPlotFlag = true; //OscilloscopeViewModel.GetInstance.ChComboEn = false; Thread.Sleep(10); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(34), SubID = Convert.ToInt16(1), // Start Plot list IsSet = false, IsFloat = false }); int timeOutPlot = 0; do { Thread.Sleep(100); timeOutPlot++; } while(OscilloscopeParameters.plotCount_temp != 0 && timeOutPlot <= 50); //Debug.WriteLine("TimeOutPlot: " + timeOutPlot); if (OscilloscopeParameters.plotCount_temp == 0) { EventRiser.Instance.RiseEevent(string.Format($"Success")); plotResult = true; } else { EventRiser.Instance.RiseEevent(string.Format($"Failed")); OscilloscopeParameters.InitList(); plotResult = false; } //OscilloscopeViewModel.GetInstance.ChComboEn = true; //StarterPlotFlag = false; return(plotResult); }
private void StarterOperation() { #region Operations StarterOperationFlag = true; StarterCount = 0; Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(34), SubID = Convert.ToInt16(1), // Start Plot list IsSet = false, IsFloat = false }); int timeOutPlot = 0; do { Thread.Sleep(1500); Debug.WriteLine("Round"); timeOutPlot++; } while(OscilloscopeParameters.plotCount_temp != 0 && timeOutPlot <= 10); if (OscilloscopeParameters.plotCount_temp == 0) { EventRiser.Instance.RiseEevent(string.Format($"Success")); } else { EventRiser.Instance.RiseEevent(string.Format($"Failed")); OscilloscopeParameters.InitList(); } //Thread.Sleep(1000); /* * Rs232Interface.GetInstance.SendToParser(new PacketFields * { * Data2Send = "", * ID = Convert.ToInt16(66), // IfullScale * SubID = Convert.ToInt16(0), * IsSet = false, * IsFloat = true * }); * Thread.Sleep(20); * Rs232Interface.GetInstance.SendToParser(new PacketFields * { * Data2Send = "", * ID = Convert.ToInt16(66), // VfullScale * SubID = Convert.ToInt16(1), * IsSet = false, * IsFloat = true * }); */ EventRiser.Instance.RiseEevent(string.Format($"Reading parameters...")); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(1), SubID = Convert.ToInt16(0), IsSet = false, IsFloat = false }); Thread.Sleep(20); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(60), SubID = Convert.ToInt16(1), // SelectedCh1DataSource IsSet = false, IsFloat = false }); Thread.Sleep(20); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(60), SubID = Convert.ToInt16(2), // SelectedCh2DataSource IsSet = false, IsFloat = false }); Thread.Sleep(20); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(62), SubID = Convert.ToInt16(10), // Checksum IsSet = false, IsFloat = false }); Thread.Sleep(20); for (int i = 1; i < 4; i++) { Thread.Sleep(20); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(62), SubID = Convert.ToInt16(i), IsSet = false, IsFloat = false }); } //Thread.Sleep(20); //Rs232Interface.GetInstance.SendToParser(new PacketFields //{ // Data2Send = "", // ID = Convert.ToInt16(60), // SubID = Convert.ToInt16(9), // Get Units Name // IsSet = false, // IsFloat = false //}); //Thread.Sleep(20); //Rs232Interface.GetInstance.SendToParser(new PacketFields //{ // Data2Send = "", // ID = Convert.ToInt16(60), // SubID = Convert.ToInt16(10), // Get Units Name // IsSet = false, // IsFloat = false //}); Thread.Sleep(200); #endregion Operations if (StarterCount == 7) { EventRiser.Instance.RiseEevent(string.Format($"Success")); } else { EventRiser.Instance.RiseEevent(string.Format($"Failed")); } LeftPanelViewModel.flag = true; StarterOperationFlag = false; #if !DEBUG Thread Connection = new Thread(RefreshManger.GetInstance.VerifyConnection); Connection.Start(); //RefreshManger.GetInstance.VerifyConnection(); #endif if (DebugViewModel.GetInstance.EnRefresh) { //Thread bkgnd = new Thread(BackGroundFunc); //bkgnd.IsBackground = true; //bkgnd.Start(); //Thread t1 = new Thread(() => //{ BackGroundFunc(); //}); //t1.IsBackground = true; //t1.Start(); } }
internal void UpdateModel(Tuple <int, int> commandidentifier, string newPropertyValue) { LeftPanelViewModel.GetInstance.ValueChange = false; #region Calibration_old //if(Commands.GetInstance.CalibartionCommandsList.ContainsKey(new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2))) //{ // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2 - 1)].CommandValue = CalibrationGetStatus(newPropertyValue); // if(LeftPanelViewModel.GetInstance.EnRefresh == false && Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2 - 1)].ButtonContent == "Running")//newPropertyValue != "2" && newPropertyValue != "3"&& CalibrationTimeOut > 0 // { // Rs232Interface.GetInstance.SendToParser(new PacketFields // { // ID = Convert.ToInt16(commandidentifier.Item1), // SubID = Convert.ToInt16(commandidentifier.Item2), // IsSet = false, // IsFloat = false // }); // //Thread.Sleep(100); // //CalibrationTimeOut--; // } // //else if(CalibrationTimeOut <= 0) // //{ // // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2 - 1)].ButtonContent = "Run"; // // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2 - 1)].CommandValue = "TimeOut"; // //} // //else // if(newPropertyValue == "2") // { // PrecedentIdx = commandidentifier.Item2; // Rs232Interface.GetInstance.SendToParser(new PacketFields // { // ID = Convert.ToInt16(33), // SubID = Convert.ToInt16(1), // IsSet = false, // IsFloat = false // }); // } // else if(newPropertyValue == "3") // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(6, commandidentifier.Item2 - 1)].ButtonContent = "Run"; //} //else if(commandidentifier.Item1 == 33) // Calibraion Status //{ // if(PrecedentIdx != 0) // { // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(6, PrecedentIdx - 1)].CommandValue = CalibrationGetError(newPropertyValue); // Commands.GetInstance.CalibartionCommandsList[new Tuple<int, int>(6, PrecedentIdx - 1)].ButtonContent = "Run"; // PrecedentIdx = 0; // } // else // { // Commands.GetInstance.DataViewCommandsList[new Tuple<int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = CalibrationGetError(newPropertyValue); // } //} #endregion Calibration_old #region Calibration_new if (commandidentifier.Item1 == 6) { if (Commands.GetInstance.CalibartionCommandsList.ContainsKey(new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2))) { if (Convert.ToInt16(newPropertyValue) == 0) { Commands.GetInstance.CalibartionCommandsList[new Tuple <int, int>(6, commandidentifier.Item2)].ButtonContent = "Run"; } else if (Convert.ToInt16(newPropertyValue) == 1) { Commands.GetInstance.CalibartionCommandsList[new Tuple <int, int>(6, commandidentifier.Item2)].ButtonContent = "Running"; } } else if (Commands.GetInstance.DataViewCommandsList.ContainsKey(new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2))) { //if(Convert.ToInt16(newPropertyValue) < 2) Commands.GetInstance.DataViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = CalibrationGetStatus(newPropertyValue); } } #endregion Calibration_new #region Plot_Channels else if (commandidentifier.Item1 == 60 && commandidentifier.Item2 <= 2) { if (Int32.Parse(newPropertyValue) >= 0) { int Sel = 0; if (Int32.Parse(newPropertyValue) > 30) { Sel = Int32.Parse(newPropertyValue) - 3; } else { Sel = Int32.Parse(newPropertyValue); } if (LeftPanelViewModel.GetInstance.StarterOperationFlag || DisconnectedFlag) { if (commandidentifier.Item2 == 1) { OscilloscopeViewModel.GetInstance.Ch1SelectedIndex = Sel; OscilloscopeViewModel.GetInstance.SelectedCh1DataSource = OscilloscopeViewModel.GetInstance.Channel1SourceItems.ElementAt(Sel); } if (commandidentifier.Item2 == 2) { OscilloscopeViewModel.GetInstance.Ch2SelectedIndex = Sel; OscilloscopeViewModel.GetInstance.SelectedCh2DataSource = OscilloscopeViewModel.GetInstance.Channel2SourceItems.ElementAt(Sel); DisconnectedFlag = false; } } else { if (commandidentifier.Item2 == 1) { OscilloscopeViewModel.GetInstance.Ch1SelectedIndex = Sel; } if (commandidentifier.Item2 == 2) { OscilloscopeViewModel.GetInstance.Ch2SelectedIndex = Sel; } } } } else if (commandidentifier.Item1 == 60 && commandidentifier.Item2 == 9) { OscilloscopeViewModel.GetInstance.YAxisUnits = YAxisUnits("CH1", newPropertyValue); } else if (commandidentifier.Item1 == 60 && commandidentifier.Item2 == 10) { OscilloscopeViewModel.GetInstance.YAxisUnits = YAxisUnits("CH2", newPropertyValue); } else if (commandidentifier.Item1 == 66) { if (commandidentifier.Item2 == 0) { OscilloscopeParameters.IfullScale = float.Parse(newPropertyValue); } else if (commandidentifier.Item2 == 1) { OscilloscopeParameters.VfullScale = float.Parse(newPropertyValue); } OscilloscopeParameters.InitList(); } #endregion Plot_Channels #region DataView_EnumView else if (commandidentifier.Item1 == 33) { Commands.GetInstance.DataViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = CalibrationGetError(newPropertyValue); } else if (commandidentifier.Item1 == 1 && commandidentifier.Item2 == 0) // MotorStatus { if (LeftPanelViewModel.GetInstance.ConnectTextBoxContent == "Connected") { if (newPropertyValue == "1" || newPropertyValue == "0") { ConnectionCount = 0; LeftPanelViewModel.GetInstance.LedMotorStatus = Convert.ToInt16(newPropertyValue); Commands.GetInstance.DataViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; } } else if (LeftPanelViewModel.GetInstance.ConnectTextBoxContent == "Not Connected") { LeftPanelViewModel.GetInstance.ConnectTextBoxContent = "Connected"; if (DisconnectedFlag) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(60), SubID = Convert.ToInt16(1), // SelectedCh1DataSource IsSet = false, IsFloat = false }); Thread.Sleep(2); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "", ID = Convert.ToInt16(60), SubID = Convert.ToInt16(2), // SelectedCh2DataSource IsSet = false, IsFloat = false }); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = "1", ID = Convert.ToInt16(64), SubID = Convert.ToInt16(0), // AutoBaud (Synch) IsSet = true, IsFloat = false }); } } } //else if(commandidentifier.Item1 == 65 && commandidentifier.Item2 == 0) // EnableLoader //{ // MaintenanceViewModel.GetInstance.EnableLoder = (newPropertyValue == 0.ToString()) ? false : true; //} else if (Commands.GetInstance.DataViewCommandsList.ContainsKey(new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2))) { Commands.GetInstance.DataViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; if (commandidentifier.Item1 == 62 && commandidentifier.Item2 < 3) { Commands.GetInstance.DataViewCommandsListLP[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; } } else if (Commands.GetInstance.EnumViewCommandsList.ContainsKey(new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2))) { int index = Convert.ToInt16(newPropertyValue) - Convert.ToInt16(Commands.GetInstance.EnumViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue); if (index < Commands.GetInstance.EnumViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandList.Count && index >= 0) { Commands.GetInstance.EnumViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].SelectedItem = Commands.GetInstance.EnumViewCommandsList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandList[index]; } } #endregion DataView_EnumView #region DigitalInput else if (Commands.GetInstance.DigitalInputList.ContainsKey(new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2))) { Commands.GetInstance.DigitalInputList[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = Convert.ToInt16(newPropertyValue) == 1 ? 1 : 0; } #endregion DigitalInput #region StartUpAPP else if (commandidentifier.Item1 == 62) { switch (commandidentifier.Item2) { case 0: Commands.GetInstance.DataViewCommandsListLP[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; break; case 1: Commands.GetInstance.DataViewCommandsListLP[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; break; case 2: Commands.GetInstance.DataViewCommandsListLP[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; break; case 3: Commands.GetInstance.DataViewCommandsListLP[new Tuple <int, int>(commandidentifier.Item1, commandidentifier.Item2)].CommandValue = newPropertyValue; break; } } #endregion StartUpAPP }
public bool ParseInputPacket(byte[] data) { var crclsb = data[7]; var crcmsb = data[8]; ushort crc = CrcInputCalc(data.Take(7), 0); byte[] crcBytes = BitConverter.GetBytes(crc); if (crcBytes[0] == crclsb && crcBytes[1] == crcmsb)//CHECK { var cmdlIdLsb = data[0]; var cmdIdlMsb = data[1] & 0x3F; var subIdLsb = (data[1] >> 6) & 0x03; var subIdMsb = data[2] & 0x07; var getSet = (data[2] >> 4) & 0x01;//ASK var intFloat = (data[2] >> 5) & 0x01; var farmeColor = (data[3] >> 6) & 0x03; bool isInt = (intFloat == 0); //Answer Int=0/////to need check what doing!!! //Cmd ID int commandId = Convert.ToInt16(cmdlIdLsb); commandId = commandId + Convert.ToInt16(cmdIdlMsb << 8); //Cmd SubID int commandSubId = Convert.ToInt16(subIdLsb); commandSubId = commandSubId + Convert.ToInt16(subIdMsb << 2); //int newPropertyValueInt=0; float newPropertyValuef = 0; Int32 transit = data[6]; transit <<= 8; transit |= data[5]; transit <<= 8; transit |= data[4]; transit <<= 8; transit |= data[3]; if (!exceptionID.Contains(commandId)) { if (isInt) { if (getSet == 1) { RefreshManger.GetInstance.UpdateModel(new Tuple <int, int>(commandId, commandSubId), transit.ToString()); } #if (DEBUG && DEBUG_OPERATION) Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); #endif } else { var dataAray = new byte[4]; for (int i = 0; i < 4; i++) { dataAray[i] = data[i + 3]; } newPropertyValuef = System.BitConverter.ToSingle(dataAray, 0); if (getSet == 1) { RefreshManger.GetInstance.UpdateModel(new Tuple <int, int>(commandId, commandSubId), newPropertyValuef.ToString()); } #if (DEBUG && DEBUG_OPERATION) Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, newPropertyValuef, "F", getSet == 0 ? "Set" : "Get"); #endif } } else if (commandId == 67) { #if (DEBUG && DEBUG_OPERATION) Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); #endif if (commandSubId == 1) { MaintenanceViewModel.PbarParamsCount = Convert.ToUInt32(transit); if (MaintenanceViewModel.GetInstance.SaveToFile == true) { MaintenanceViewModel.ParamsCount = Convert.ToUInt32(transit); Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = 1, ID = 67, SubID = Convert.ToInt16(12), IsSet = true, IsFloat = false } ); } else if (MaintenanceViewModel.GetInstance.LoadFromFile == true) { if (MaintenanceViewModel.GetInstance.SelectFile(Convert.ToUInt32(transit))) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = 1, ID = 67, SubID = Convert.ToInt16(2), IsSet = true, IsFloat = false }); } else { MaintenanceViewModel.GetInstance.LoadFromFile = false; } } } else if (commandSubId == 12 && getSet == 0) { if (MaintenanceViewModel.ParamsToFile.Count == 0) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = 1, ID = 67, SubID = Convert.ToInt16(13), IsSet = false, IsFloat = false } ); } else { MaintenanceViewModel.GetInstance.SaveToFile = false; } } else if (commandSubId == 13) { MaintenanceViewModel.GetInstance.DataToList(Convert.ToUInt32(transit)); } else if (commandSubId == 2 && getSet == 0) { if (MaintenanceViewModel.GetInstance.LoadFromFile && MaintenanceViewModel.FileToParams.Count > 1) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = MaintenanceViewModel.FileToParams.ElementAt(0), ID = 67, SubID = Convert.ToInt16(3), IsSet = true, IsFloat = false }); MaintenanceViewModel.FileToParams.RemoveAt(0); } else if (!MaintenanceViewModel.GetInstance.LoadFromFile && MaintenanceViewModel.FileToParams.Count > 1) { MaintenanceViewModel.GetInstance.LoadFromFile = false; } } else if (commandSubId == 3 && getSet == 0) { if (MaintenanceViewModel.FileToParams.Count > 1) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = MaintenanceViewModel.FileToParams.ElementAt(0), ID = 67, SubID = Convert.ToInt16(3), IsSet = true, IsFloat = false }); MaintenanceViewModel.FileToParams.RemoveAt(0); MaintenanceViewModel.GetInstance.PbarValueFromFile = 100 - ((MaintenanceViewModel.FileToParams.Count) * 100 / MaintenanceViewModel.PbarParamsCount); } else if (MaintenanceViewModel.FileToParams.Count == 1) { Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = MaintenanceViewModel.FileToParams.ElementAt(0), ID = 67, SubID = Convert.ToInt16(4), IsSet = true, IsFloat = false }); } } else if (commandSubId == 4 && getSet == 0) { if (transit == 1) { EventRiser.Instance.RiseEevent(string.Format($"Load Parameters successed")); MaintenanceViewModel.GetInstance.PostRedoState(MaintenanceViewModel._redoState); } else { EventRiser.Instance.RiseEevent(string.Format($"Load Parameters Failed")); MaintenanceViewModel.GetInstance.PostRedoState(MaintenanceViewModel._redoState); } MaintenanceViewModel.GetInstance.LoadFromFile = false; Rs232Interface.GetInstance.SendToParser(new PacketFields { Data2Send = 0, ID = 67, SubID = Convert.ToInt16(2), IsSet = true, IsFloat = false }); } } else if (commandId == 34) { EventRiser.Instance.RiseEevent(string.Format($"Reading plots...")); OscilloscopeParameters.plotCount_temp = transit; OscilloscopeParameters.plotCount = transit; EventRiser.Instance.RiseEevent(string.Format($"Plots count: " + transit.ToString())); if (transit > 0) { OscilloscopeParameters.fillPlotList(); } } else if (commandId == 35) { OscilloscopeParameters.plotGeneral.Add(transit); } else if (commandId == 36) { var dataAray = new byte[4]; for (int i = 0; i < 4; i++) { dataAray[i] = data[i + 3]; } newPropertyValuef = System.BitConverter.ToSingle(dataAray, 0); OscilloscopeParameters.plotFullScale.Add(newPropertyValuef); if (OscilloscopeParameters.plotCount_temp > 0) { OscilloscopeParameters.fillPlotList(); } } else { string result; if (Commands.GetInstance.ErrorList.TryGetValue(transit, out result)) { EventRiser.Instance.RiseEevent(string.Format($"Com. Error: " + result)); } else { EventRiser.Instance.RiseEevent(string.Format($"Error: " + transit.ToString())); } } return(true); } return(false); }
public bool ParseInputPacket(byte[] data) { DebugData = data; var crclsb = data[7]; var crcmsb = data[8]; ushort crc = CrcInputCalc(data.Take(7), 0); byte[] crcBytes = BitConverter.GetBytes(crc); if (crcBytes[0] == crclsb && crcBytes[1] == crcmsb)//CHECK { var cmdlIdLsb = data[0]; var cmdIdlMsb = data[1] & 0x3F; var subIdLsb = (data[1] >> 6) & 0x03; var subIdMsb = data[2] & 0x07; var getSet = (data[2] >> 4) & 0x01;//ASK var intFloat = (data[2] >> 5) & 0x01; var farmeColor = (data[3] >> 6) & 0x03; bool isInt = (intFloat == 0); //Answer Int=0/////to need check what doing!!! //Cmd ID int commandId = Convert.ToInt16(cmdlIdLsb); commandId = commandId + Convert.ToInt16(cmdIdlMsb << 8); //Cmd SubID int commandSubId = Convert.ToInt16(subIdLsb); commandSubId = commandSubId + Convert.ToInt16(subIdMsb << 2); //int newPropertyValueInt=0; float newPropertyValuef = 0; Int32 transit = data[6]; transit <<= 8; transit |= data[5]; transit <<= 8; transit |= data[4]; transit <<= 8; transit |= data[3]; var dataAray = new byte[4]; Array.Copy(data, 3, dataAray, 0, 4); newPropertyValuef = BitConverter.ToSingle(dataAray, 0); if (WizardWindowViewModel.GetInstance.send_update_parameters && getSet == 0 && commandId != 64) { DataViewModel myValue; if (WizardWindowViewModel.GetInstance.OperationList.TryGetValue(new Tuple <int, int>(commandId, commandSubId), out myValue)) { WizardWindowViewModel.GetInstance.send_operation_count++; WizardWindowViewModel.operation_echo.Remove(new Tuple <int, int>(commandId, commandSubId)); //Debug.WriteLine("Op Removed: {0}[{1}]={2} {3} {4}.", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); } } if (LeftPanelViewModel.GetInstance.StarterPlotFlag || commandId == 34 || commandId == 35 || commandId == 36) // build plot list { OscilloscopeParameters.plot_transfert(commandId, commandSubId, getSet, transit, data); } else if (LeftPanelViewModel.GetInstance.StarterOperationFlag && !exceptionID.Contains(commandId) || !exceptionID.Contains(commandId) || ParametarsWindowViewModel.TabControlIndex == (int)eTab.DEBUG) { RefreshManager.GetInstance.UpdateModel(new Tuple <int, int>(commandId, commandSubId), isInt ? transit.ToString() : newPropertyValuef.ToString(), isInt); #if (DEBUG && DEBUG_OPERATION) if (getSet == 0 && commandId != 64) { Debug.Write(DateTime.Now.ToString("hh.mm.ss.ffffff")); Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, isInt ? transit.ToString() : newPropertyValuef.ToString(), "I", getSet == 0 ? "Set" : "Get"); } #endif #if OLD if (isInt) { //if(getSet == 1) RefreshManager.GetInstance.UpdateModel(new Tuple <int, int>(commandId, commandSubId), transit.ToString(), true); //else if(ParametarsWindowViewModel.TabControlIndex == (int)eTab.DEBUG) // RefreshManger.GetInstance.UpdateModel(new Tuple<int, int>(commandId, commandSubId), newPropertyValuef.ToString(), isInt); #if (DEBUG && DEBUG_OPERATION) #if DEBUG_SET if (getSet == 0) { Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); } #endif #if DEBUG_GET if (getSet == 1) { Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); } #endif #endif } else { //if(getSet == 1) RefreshManager.GetInstance.UpdateModel(new Tuple <int, int>(commandId, commandSubId), newPropertyValuef.ToString(), false); //else if(ParametarsWindowViewModel.TabControlIndex == (int)eTab.DEBUG) // RefreshManger.GetInstance.UpdateModel(new Tuple<int, int>(commandId, commandSubId), newPropertyValuef.ToString(), isInt); #if (DEBUG && DEBUG_OPERATION) #if DEBUG_SET if (getSet == 0) { Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, newPropertyValuef, "F", getSet == 0 ? "Set" : "Get"); } #endif #if DEBUG_GET if (getSet == 1) { Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, newPropertyValuef, "F", getSet == 0 ? "Set" : "Get"); } #endif #endif } #endif } else if (commandId == 67) // Save driver parameters to file, Load parameters to driver from file { #if (DEBUG && DEBUG_OPERATION) Debug.WriteLine("{0} {1}[{2}]={3} {4} {5}.", "Drv", commandId, commandSubId, transit, "I", getSet == 0 ? "Set" : "Get"); #endif MaintenanceViewModel.GetInstance.data_transfert(commandId, commandSubId, getSet, transit); } else { // Error ID 100 Commands.GetInstance.driver_error_occured(commandId, commandSubId, transit); } return(true); } return(false); }