public static void Pgm(String stSeconds, Queue <int> iQueue, Int16 lenQueue2, Int16 lenQueue4, bool flagDebug) { MyDLL.setWhite(0); MyDLL.cleanScreen(); MyDLL.setAutoMaxMin(true, true); int ScaleValue = MyDLL.getScaleMove(); WriteDebug.Pgm("MOVE = " + ScaleValue.ToString(), flagDebug); if (stSeconds == "4S") { for (int x = 0; x <= lenQueue4; x++) { if (x % 4 == ScaleValue) { MyDLL.addData(iQueue.ElementAt(x)); } } } if (stSeconds == "2S") { for (int x = 0; x <= lenQueue2; x++) { if (x % 2 == ScaleValue) { MyDLL.addData(iQueue.ElementAt(x)); } } } }
public static void Pgm(SerialPort comPort, int longueur, Int16 lenQueue1, Int16 lenQueue2, Int16 lenQueue3, Int16 lenQueue4, bool flagDebug) { try { int totalBytes = comPort.BytesToRead; while (totalBytes > 0) { WriteDebug.Pgm("Send data END (E)", flagDebug); comPort.Write("E"); char[] buffer = new char[totalBytes]; comPort.Read(buffer, 0, totalBytes); Thread.Sleep(100); totalBytes = comPort.BytesToRead; if (buffer[1] == 'j' && buffer[2] == 'o' && buffer[3] == '?') { totalBytes = 0; } } totalBytes = comPort.BytesToRead; char[] buffer2 = new char[totalBytes]; comPort.Read(buffer2, 0, totalBytes); } catch {} MyDLL.setVisible("START", true); MyDLL.setVisible("REFRESH", true); MyDLL.setVisible("STOP", false); MyDLL.setVisible("HELP", true); MyDLL.setAutoMaxMin(false, false); if (longueur > lenQueue4) { MyDLL.setVisible("1S", true); MyDLL.setVisible("2S", true); MyDLL.setVisible("4S", true); } else { if (longueur > lenQueue3) { MyDLL.setVisible("1S", true); MyDLL.setVisible("2S", true); } else { if (longueur > lenQueue1) { MyDLL.setVisible("1S", true); } } } }
public static bool Pgm(SerialPort comPort, bool flagDebug) { try { int totalBytes = comPort.BytesToRead; while (totalBytes > 0) { char[] buffer = new char[totalBytes]; comPort.Read(buffer, 0, totalBytes); Thread.Sleep(100); totalBytes = comPort.BytesToRead; } int retValue = 0; while (retValue != 65534) { WriteDebug.Pgm("Send data BEGIN (B)", flagDebug); comPort.Write("B"); retValue = readCOM.Pgm(comPort, true, flagDebug); } } catch (Exception ex) { WriteDebug.Pgm("ERROR : COM port - " + ex.Message.ToString(), flagDebug); MyDLL.writeMessage("ERROR", "START button", "Error Com port !"); return(false); } MyDLL.setVisible("START", false); MyDLL.setVisible("REFRESH", false); MyDLL.setVisible("SAVE", false); MyDLL.setVisible("INSIDE", false); MyDLL.setVisible("MOVE", false); MyDLL.setVisible("1S", false); MyDLL.setVisible("2S", false); MyDLL.setVisible("4S", false); MyDLL.setVisible("STOP", true); MyDLL.setVisible("HELP", false); MyDLL.setAutoMaxMin(true, true); MyDLL.cleanScreen(); MyDLL.setWhite(50); MyDLL.setVisible("MAX", true); return(true); }
public static void Pgm(String stSeconds, Queue <int> iQueue, Int16 lenQueue1, Int16 lenQueue2, Int16 lenQueue3, Int16 lenQueue4) { switch (stSeconds) { case "1S": MyDLL.setEnable("1S", false); MyDLL.setEnable("2S", true); MyDLL.setEnable("4S", true); MyDLL.setVisible("SAVE", true); MyDLL.setVisible("INSIDE", true); MyDLL.setInside(12); MyDLL.setVisible("MOVE", false); MyDLL.setWhite(0); MyDLL.cleanScreen(); MyDLL.setAutoMaxMin(true, true); MyDLL.setZero("0"); MyDLL.setValueX("0.25", "0.5", "0.75", "1s"); for (int x = 0; x <= lenQueue1; x++) { MyDLL.addData(iQueue.ElementAt(x)); } break; case "2S": MyDLL.setEnable("1S", true); MyDLL.setEnable("2S", false); MyDLL.setEnable("4S", true); MyDLL.setVisible("SAVE", true); MyDLL.setVisible("INSIDE", true); MyDLL.setVisible("MOVE", true); MyDLL.setInside(4); MyDLL.setMove(1); MyDLL.setWhite(0); MyDLL.cleanScreen(); MyDLL.setAutoMaxMin(true, true); MyDLL.setZero("0"); MyDLL.setValueX("0.5", "1", "1.5", "2s"); for (int x = 0; x <= lenQueue2; x++) { if (x % 1 == 0) { MyDLL.addData(iQueue.ElementAt(x)); } } break; case "4S": MyDLL.setEnable("1S", true); MyDLL.setEnable("2S", true); MyDLL.setEnable("4S", false); MyDLL.setVisible("SAVE", true); MyDLL.setVisible("INSIDE", false); MyDLL.setVisible("MOVE", true); MyDLL.setMove(3); MyDLL.setWhite(0); MyDLL.cleanScreen(); MyDLL.setAutoMaxMin(true, true); MyDLL.setZero("0"); MyDLL.setValueX("1", "2", "3", "4s"); for (int x = 0; x <= lenQueue4; x++) { if (x % 4 == 0) { MyDLL.addData(iQueue.ElementAt(x)); } } break; default: break; } }
public static int Pgm(String stSeconds, int longeur, Int16 lenQueue1, Int16 lenQueue2, Int16 lenQueue3, Int16 lenQueue4, bool flagDebug) { MyDLL.setWhite(0); MyDLL.cleanScreen(); MyDLL.setAutoMaxMin(true, true); int ScaleValue = MyDLL.getScaleInside(); WriteDebug.Pgm("INSIDE = " + ScaleValue.ToString(), flagDebug); int valDecale = 0; if (stSeconds == "1S") { valDecale = ScaleValue * 250; if ((lenQueue1 + valDecale) < longeur) { switch (ScaleValue) { case 0: MyDLL.setZero("0"); MyDLL.setValueX("0.25", "0.5", "0.75", "1s"); break; case 1: MyDLL.setZero("0.25"); MyDLL.setValueX("0.5", "0.75", "1", "1.25s"); break; case 2: MyDLL.setZero("0.5"); MyDLL.setValueX("0.75", "1", "1.25", "1.5s"); break; case 3: MyDLL.setZero("0.75"); MyDLL.setValueX("1", "1.25", "1.5", "1.75s"); break; case 4: MyDLL.setZero("1"); MyDLL.setValueX("1.25", "1.5", "1.75", "2s"); break; case 5: MyDLL.setZero("1.25"); MyDLL.setValueX("1.5", "1.75", "2", "2.25s"); break; case 6: MyDLL.setZero("1.5"); MyDLL.setValueX("1.75", "2", "2.25", "2.5s"); break; case 7: MyDLL.setZero("1.75"); MyDLL.setValueX("2", "2.25", "2.5", "2.75s"); break; case 8: MyDLL.setZero("2"); MyDLL.setValueX("2.25", "2.5", "2.75", "3s"); break; case 9: MyDLL.setZero("2.25"); MyDLL.setValueX("2.5", "2.75", "3", "3.25s"); break; case 10: MyDLL.setZero("2.5"); MyDLL.setValueX("2.75", "3", "3.25", "3.5s"); break; case 11: MyDLL.setZero("2.75"); MyDLL.setValueX("3", "3.25", "3.5", "3.75s"); break; case 12: MyDLL.setZero("3"); MyDLL.setValueX("3.25", "3.5", "3.75", "4s"); break; default: break; } } } if (stSeconds == "2S") { valDecale = ScaleValue * 500; if ((lenQueue1 + valDecale) < longeur) { switch (ScaleValue) { case 0: MyDLL.setZero("0"); MyDLL.setValueX("0.5", "1", "1.5", "2s"); break; case 1: MyDLL.setZero("0.5"); MyDLL.setValueX("1", "1.5", "2", "2.5s"); break; case 2: MyDLL.setZero("1"); MyDLL.setValueX("1.5", "2", "2.5", "3s"); break; case 3: MyDLL.setZero("1.5"); MyDLL.setValueX("2", "2.5", "3", "3.5s"); break; case 4: MyDLL.setZero("2"); MyDLL.setValueX("2.5", "3", "3.5", "4s"); break; default: break; } } } return(valDecale); }