public void Download(BlockConditionsWindow.Model.BlockConditions bCs) { string[] BlockConditions = ReturnBlockCondition.Split(','); if (BlockConditions[1] == "0") { bCs.SortBlockConditions(ReturnBlockCondition); } else { throw new Exception("Error"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { sp = new SerialPort("COM9", 38400, Parity.None, 8, StopBits.One); try { //sp.Open(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } _operationWithSerialport = new Model.OperationWithSerialport(sp, LB1); _commonMarkingConditions = new CommonMarkingConditionsModule.Model.CommonMarkingConditions(); _blockConditions = new BlockConditionsWindow.Model.BlockConditions(); // _blockConditionsList = new List<BlockConditionsWindow.Model.BlockConditions>(); }
public void Upload(BlockConditionsWindow.Model.BlockConditions bCs) { try { sp.Open(); sp.WriteLine(bCs.HeaderToSetBlockCondition + "," + bCs.ProgramNo + "," + bCs.BlockNo + "," + bCs.Setting + bCs.Delimiter); var waitingForResponce = Task.Delay(250); waitingForResponce.Wait(); string ReturnBlockCondition = sp.ReadExisting(); errorcode.IsNoErrorExists(ReturnBlockCondition); //check return flag } catch (System.IO.IOException ex) { throw ex; } catch (Exception ex) { throw ex; } finally { sp.Close(); } }
public void Download(BlockConditionsWindow.Model.BlockConditions bCs) { try { sp.Open(); sp.WriteLine(bCs.HeaderToRequestBlockCondition + "," + bCs.ProgramNo + "," + bCs.BlockNo + bCs.Delimiter); var waitingForResponce = Task.Delay(250); waitingForResponce.Wait(); string ReturnBlockCondition = sp.ReadExisting(); string[] BlockConditions = ReturnBlockCondition.Split(','); if (errorcode.IsNoErrorExists(ReturnBlockCondition))//(BlockConditions[1] == "0") { bCs.SortBlockConditions(ReturnBlockCondition); } } catch (System.IO.IOException ex) { throw ex; } finally { sp.Close(); } }