예제 #1
0
        public void HelloWorldResult(IAsyncResult ar)
        {
            bool bval = false;

            WebService.Service ws = (WebService.Service)ar.AsyncState;
            try
            {
                string ip = ws.EndHelloWorld(ar);
                if (ip.IndexOf('.') > 0)
                {
                    bval = true;

                    if (bChkVersion == false)
                    {
                        WebService.Service wss = new hStore.WebService.Service();
                        AsyncCallback      GetCurrentTimeCallBack = new AsyncCallback(GetCurrentTimeResult);
                        wss.BeginGetCurrentTime(GetCurrentTimeCallBack, wss);

                        //Thread td = new Thread(new ThreadStart(GetRemoteVersion));
                        //td.Start();
                        bChkVersion = true;
                    }
                }

                Global.wwanConnected = bval;
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("HelloWorldResult Exception:" + e.Message);
            }
            finally
            {
                ws.Dispose();
            }
        }
예제 #2
0
        public void GetVersionInfo2Result(IAsyncResult ar)
        {
            WebService.Service ws = (WebService.Service)ar.AsyncState;
            try
            {
                DataTable dtRaw = new DataTable();
                try
                {
                    dtRaw = ws.EndGetVersionInfo2(ar);
                    string fname = "";

                    for (int i = 0; i < dtRaw.Rows.Count; i++)
                    {
                        if (dtRaw.Rows[i]["FILEINFO"] != DBNull.Value)
                        {
                            fname = dtRaw.Rows[i]["FILENAME"].ToString();
                            if (File.Exists(sFilePathLu + fname))
                            {
                                File.Delete(sFilePathLu + fname);
                            }
                            byte[]       tmpFile = (byte[])dtRaw.Rows[i]["FILEINFO"];
                            FileStream   fs      = new FileStream(sFilePathLu + fname, FileMode.CreateNew);
                            BinaryWriter bw      = new BinaryWriter(fs);
                            bw.Write(tmpFile, 0, tmpFile.Length);
                            bw.Close();
                            fs.Close();
                        }
                    }

                    SetVersion(sVersionL + "+");

                    Business.SaveConfig(Global.appPath + @"\config.xml", sVersionL, sVersionR, sFileNameL);
                }
                catch
                {
                }
                finally
                {
                    dtRaw.Dispose();
                }
            }
            catch
            {
            }
            finally
            {
                ws.Dispose();
            }
        }
예제 #3
0
        public void GetVersionInfoNoneResult(IAsyncResult ar)
        {
            WebService.Service ws = (WebService.Service)ar.AsyncState;
            try
            {
                DataTable dt      = new DataTable();
                bool      bUpdate = false;

                try
                {
                    dt = ws.EndGetVersionInfoNone(ar);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["FILENAME"].ToString().ToUpper() == sFileNameL.ToUpper())
                        {
                            sVersionR = dt.Rows[i]["VERSIONNO"].ToString();
                            break;
                        }
                    }
                }
                catch
                { }
                finally
                {
                    dt.Dispose();
                }


                bUpdate = CheckVersion(sVersionL, sVersionR);

                if (bUpdate)
                {
                    WebService.Service ws2 = new WebService.Service();
                    AsyncCallback      GetVersionInfo2CallBack = new AsyncCallback(GetVersionInfo2Result);
                    ws.BeginGetVersionInfo2(sFileNameL, sVersionL, GetVersionInfo2CallBack, ws2);
                }
            }
            catch
            {
            }
            finally
            {
                ws.Dispose();
            }
        }
예제 #4
0
        public void GetUserInfResult(IAsyncResult ar)
        {
            WebService.Service ws = (WebService.Service)ar.AsyncState;
            try
            {
                string sql;
                string userid;
                string pwd;

                DataTable dt = new DataTable();
                try
                {
                    dt = ws.EndgetUserInf(ar);

                    sql = "delete from userinf";
                    SqlCe.ExecuteNonQuery(sql);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        userid = dt.Rows[i]["USERID"].ToString();
                        pwd    = dt.Rows[i]["PWD"].ToString();

                        sql = "insert into userinf (USERID,PWD) values('" + userid + "','" + pwd + "')";
                        SqlCe.ExecuteNonQuery(sql);
                    }

                    frmMessage frmMessage = new frmMessage();
                    frmMessage.ShowDialog("用户资料库已更新!", "提示", "确定");
                    frmMessage.Dispose();
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
                finally
                {
                    dt.Dispose();
                }
            }
            catch { }
            finally
            {
                ws.Dispose();
            }
        }
예제 #5
0
        public void GetCurrentTimeResult(IAsyncResult ar)
        {
            WebService.Service ws = (WebService.Service)ar.AsyncState;
            try
            {
                DateTime dt = ws.EndGetCurrentTime(ar);

                Business.SetCurrentTime(dt);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine("GetCurrentTimeResult Exception:" + e.Message);
            }
            finally
            {
                ws.Dispose();
            }
        }