private static void Http_ConnectionSuccess(object sender, NetSuccessEventArgs e) { if (e.NetStatus == netStatus.Success) { Debug.GC(true); // Free all available memory DebugPrint("-----------------RESPOND------------------"); DebugPrint("<- " + e.Answers.Trim()); DebugPrint("END REQUEST==============================="); string[] rowparam = e.Answers.Split('|'); for (int i = 0; i < rowparam.Length; i++) { Hardware.PIN_State(PINS.led_C, STATE.On); Param[] param = Decrypt.DecryptParams(rowparam[i]); try { while (!Decrypt.Parse(param)) ; } catch (Exception ex) { DebugPrint(ex.ToString()); } // Zakazuje vyинtбnн dat pokud se zaшнzenн inituje if (INITRUN && httpData.confirmed != String.Empty) { continue; } switch (httpData.events) { case 100: READ_SETTINGS = false; if (httpData.result == "ok") { Settings set = new Settings(); set.Save(); set.Read(); if (settings.isClosed == 1) { BLOCKING = true; } else { if (!INITRUN) { Buttons.Write(ALL, Screen.prices); } BLOCKING = false; } READ_SETTINGS = true; } break; case 101: CH_BOTTLE_OK = false; if (httpData.result == "ok") { if (bottleData.position > 0 && bottleData.position <= settings.positions) { new Bottle().Save(bottleData.position); Buttons.SendSettings(); if (rowparam.Length > 1 && i == rowparam.Length - 1) { CH_BOTTLE_OK = true; } else if (rowparam.Length == 1) { CH_BOTTLE_OK = true; } if (!INITRUN && !MENUSHOWED) { common.PosStates(Screen.prices, true); } } if (rowparam.Length > 1 && i < rowparam.Length - 1) { bottleData.position = 0; bottleData.Clear(); } } break; case 200: CARD_OK = false; if (httpData.result == "ok") { if (httpData.card == card.Id) { CARD_OK = true; } } break; case 201: DISPENSING = false; if (httpData.result == "ok") { if (httpData.dosevolume > 5) { DISPENSING = true; } } break; default: break; } } httpData.RESPONSE_OK = true; } else if (e.NetStatus == netStatus.Failure) { DebugPrint("FAILED : " + DateTime.Now.ToString("HH:mm:ss fff")); } Hardware.PIN_State(PINS.led_C, STATE.Off); }
private static void Http_ConnectionSuccess(object sender, NetSuccessEventArgs e) { if (e.NetStatus == netStatus.Success) { Debug.GC(true); // Free all available memory DebugPrint("-----------------RESPOND------------------"); DebugPrint("<- " + e.Answers.Trim()); DebugPrint("END REQUEST==============================="); string[] rowparam = e.Answers.Split('|'); for (int i = 0; i < rowparam.Length; i++) { Hardware.PIN_State(PINS.led_C, STATE.On); int[] b_bef = new int[settings.positions]; if(rowparam[i].IndexOf("event=101") > -1) { b_bef = PosStates(Screen.prices, false, true); } Param[] param = Decrypt.DecryptParams(rowparam[i]); try { while (!Decrypt.Parse(param)) ; } catch (Exception ex) { DebugPrint(ex.ToString()); } // Zakazuje vyинtбnн dat pokud se zaшнzenн inituje if (INITRUN && httpData.confirmed != String.Empty) { continue; } switch (httpData.events) { case 100: READ_SETTINGS = false; if (httpData.result == "ok") { Settings set = new Settings(); set.Save(); set.Read(); Blocking blc = new Blocking(); blc.Save(); blc.Read(); // Nyni obsluhuje blocking //if (!INITRUN) //{ // common.PosStates(Screen.prices); //} READ_SETTINGS = true; } break; case 101: CH_BOTTLE_OK = false; if (httpData.result == "ok") { if (bottleData.position > 0 && bottleData.position <= settings.positions) { new Bottle().Save(bottleData.position); Buttons.SendSettings(); //Buttons.Write(bottleData.position, Cmd.Refresh); if (rowparam.Length > 1 && i == rowparam.Length - 1) { CH_BOTTLE_OK = true; } else if (rowparam.Length == 1) { CH_BOTTLE_OK = true; } if (!INITRUN && !MENUSHOWED && BLOCKING < 1) { int[] b_after = PosStates(Screen.prices, false, true); if (b_bef[bottleData.position] == b_after[bottleData.position]) { PosStates(Screen.prices, true); } else { PosStates(Screen.prices, false); } } } if (rowparam.Length > 1 && i < rowparam.Length - 1) { bottleData.position = 0; bottleData.Clear(); } } break; case 200: CARD_OK = false; if (httpData.result == "ok") { if (httpData.card == card.Id) { CARD_OK = true; } } break; case 201: DISPENSING = false; if (httpData.result == "ok") { if (httpData.dosevolume > 5) { DISPENSING = true; } } break; case 400: DATETIME_OK = false; if (httpData.result == "ok") { try { Hardware.rtc.SetTime(DateTime.Now); Hardware.rtc.Synchronize(); } catch { } } break; default: break; } } httpData.RESPONSE_OK = true; } else if (e.NetStatus == netStatus.Failure) { DebugPrint("FAILED : " + DateTime.Now.ToString("HH:mm:ss fff")); } Hardware.PIN_State(PINS.led_C, STATE.Off); }