public static CScaleWeight GetStabile() { CWeight w = null; CScaleWeight s = new CScaleWeight(); try { long lClock = Environment.TickCount; do { cGlobalScale.objCIND890APIClient.CurrentScale.GetGNTInPrimaryUnit(ref s); if (s.WeightStable == true && s.Status == CScaleWeight.enumScaleStatus.STATUS_WEIGHTOK) { //w = s.NetWeight; //Trace.WriteLine(w.Weight.ToString() + " " + w.Unit + " ==>" + w.Status.ToString() + " =>STABIL"); break; } else if (s.WeightStable == false && s.Status == CScaleWeight.enumScaleStatus.STATUS_WEIGHTOK) { //w = s.NetWeight; //Trace.WriteLine(w.Weight.ToString() + " " + w.Unit + " ==>" + w.Status.ToString() + " =>DYNAMISCH"); } else { //Trace.WriteLine("ERROR"); } if (Environment.TickCount - lClock > 4000) { break; } }while (true); } catch (Exception ex) { SiAuto.LogException(ex); throw; } if (s.WeightStable == true && s.Status == CScaleWeight.enumScaleStatus.STATUS_WEIGHTOK) { return(s); } else { return(null); } }
public static MTTS.IND890.CE.CScale.enumTareResult setTare(double dGewicht) { if (cGlobalScale.objCIND890APIClient != null) { CWeight w = new CWeight(dGewicht, 1, cGlobalScale.objCIND890APIClient.CurrentScale.GrossWeight.Unit); MTTS.IND890.CE.CScale.enumTareResult tareResult; tareResult = cGlobalScale.objCIND890APIClient.CurrentScale.PerformTare(w); //MessageBox.Show(tareResult.ToString()); return(tareResult); } else { return(MTTS.IND890.CE.CScale.enumTareResult.TARE_NOTSUPPORTED); } }
private void Starte_DIO_Test() { #region Phase 1 try { CScaleWeight sw = cGlobalScale.GetDynamic(); } catch (Exception ex) { MessageBox.Show(ex.Message, "DIO Test Phase 1"); } #endregion #region Phase 2 try { CWeight w = cGlobalScale.objCIND890APIClient.CurrentScale.DisplayWeight; } catch (Exception ex) { MessageBox.Show(ex.Message, "DIO Test Phase 2"); } #endregion #region Phase 3 try { CDiscreteIO oDiscreteIO = cGlobalScale.objCIND890APIClient_DigitalIO.DiscreteIO; if (oDiscreteIO == null) { MessageBox.Show("DIO NULL", "DIO Test Phase 3>>"); } //for (int iLocation = 0; iLocation < 10; iLocation++) //{ // #region Phase 4 // try // { // if (oDiscreteIO != null) // { // oDiscreteIO.WriteToDIO((byte)iLocation, 5, 0); // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message, iLocation.ToString() + ">>> DIO Test Phase 4"); // } // #endregion //} } catch (Exception ex) { MessageBox.Show(ex.Message, "DIO Test Phase 3"); } #endregion try { var fdio = new frmDIOTest(); fdio.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message, "DIO Test Start"); } }