コード例 #1
0
        public void DownloadAsync(CompletedEventHandler completedEvent)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {
                VVK_WPRC.CurlUtil cutil = new VVK_WPRC.CurlUtil();

                string output = cutil.DownloadWithCert(CONF_URL, false, "", CONF_CERT);
                Debug.WriteLine(output);
                if (output == null || output.Length < 1)
                {
                    completedEvent(false);
                    return;
                }

                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ConfModel));
                using (MemoryStream memStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(output)))
                {
                    try
                    {
                        _confModel = serializer.ReadObject(memStream) as ConfModel;
                    }
                    catch (Exception e)
                    {
                        if(completedEvent != null)
                            completedEvent(false);
                        return;
                    }
                }

                if (completedEvent != null)
                    completedEvent(true);
            }));
            thread.Start();
        }
コード例 #2
0
        public void DownloadAsync(CompletedEventHandler completedEvent)
        {
            Thread thread = new Thread(new ThreadStart(() =>
            {
                VVK_WPRC.CurlUtil cutil = new VVK_WPRC.CurlUtil();

                string output = cutil.DownloadWithCert(CONF_URL, false, "", CONF_CERT);
                Debug.WriteLine(output);
                if (output == null || output.Length < 1)
                {
                    completedEvent(false);
                    return;
                }

                DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(ConfModel));
                using (MemoryStream memStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(output)))
                {
                    try
                    {
                        _confModel = serializer.ReadObject(memStream) as ConfModel;
                    }
                    catch (Exception e)
                    {
                        if (completedEvent != null)
                        {
                            completedEvent(false);
                        }
                        return;
                    }
                }

                if (completedEvent != null)
                {
                    completedEvent(true);
                }
            }));

            thread.Start();
        }
コード例 #3
0
 public void ResetData()
 {
     _confModel = null;
 }
コード例 #4
0
 public void ResetData()
 {
     _confModel = null;
 }