//--------------------------------------------------------------------- private bool GetShopName(string szNo) { bool bFlag = false; MyWebPage myWebPage = new MyWebPage(MyApp.HostIP); if (myWebPage.PingHost()) { string szURL = MyApp.WebSite + "/api/GetShopName.php"; string param = "CodeNo=" + szNo; string buf = myWebPage.GetResponseString(szURL, param); if (buf != "") { string[] aAry = buf.Split(','); this.MachineNo = Int32.Parse(aAry[0]); m_szPhotoCount = aAry[1]; txtDeviceID.Text = aAry[2]; txtShopName.Text = aAry[3]; bFlag = true; } else { MessageBox.Show("ERR, CodeNo!"); } } else { MessageBox.Show("ERR, PingHost()!"); } return(bFlag); }
//--------------------------------------------------------------------- private void CheckUpdate() { string lastUpdate = MyApp.GetNodeValue("/AppData/LastUpdate"); MyWebPage myWebPage = new MyWebPage(MyApp.HostIP); if (myWebPage.PingHost()) { string szURL = MyApp.WebSite + "/api/CheckUpdate.php"; string param = "no=" + m_nMachineNo.ToString() + "&t1=" + lastUpdate; string buf = myWebPage.GetResponseString(szURL, param); if (buf != "") { string[] aAry = buf.Split(','); for (Int32 i = 0; i < aAry.Length; i += 2) { DownFile(aAry[i], aAry[i + 1]); // 下載檔案並更新。 } listBox1.Items.Add("Update OK!"); lastUpdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); MyApp.SetNodeValue("/AppData/LastUpdate", lastUpdate); MyApp.Save(); } else { listBox1.Items.Add("No Updated"); } } }
//--------------------------------------------------------------------- private bool MachineEnabled(string szNo) { bool bFlag = true; MyWebPage myWebPage = new MyWebPage(MyApp.HostIP); if (myWebPage.PingHost()) { string szURL = MyApp.WebSite + "/api/MachineEnabled.php"; string param = "ANo=" + szNo; string buf = myWebPage.GetResponseString(szURL, param); if (buf == "") { bFlag = false; } } else { bFlag = false; } return(bFlag); }