コード例 #1
0
ファイル: Pull.cs プロジェクト: amosvoron/querytalk
        // forced pull
        internal bool ForcePull()
        {
            var download = new ClientDownload(new Guid().ToString("D"), Program.License.User, Program.License.Password);

            //download.FastPull();
            var bytes = download.PullZip();

            if (bytes == null || bytes.Length == 0)
            {
                throw new Exception("Pull failed. Try later.");
            }

            Program.Start.PullBytes = bytes;

            if (IsTaskCanceled)
            {
                _failed = true;
                _TerminatePull(download);
                return(false);
            }

            if (download.IsDenied)
            {
                _failed = true;
                Common.ShowNotification("Pull has been denied.");
                _TerminatePull(download);
                return(false);
            }

            return(_TerminatePull(download));
        }
コード例 #2
0
ファイル: Pull.cs プロジェクト: amosvoron/querytalk
        // execute on total completion - when download of both files is finished with success
        private bool _TerminatePull(ClientDownload download)
        {
            var saved = false;

            if (!_failed && download.IsDownloadCompleted)
            {
                Extract(download.PullBytes);
                saved = true;
            }

            PullTerminated?.Invoke(this, new EventArgs());
            return(saved);
        }
コード例 #3
0
ファイル: Start.cs プロジェクト: amosvoron/querytalk
 private void StartPull()
 {
     Task.Factory.StartNew(() =>
     {
         try
         {
             var clientDownload = new ClientDownload(new Guid().ToString("D"), Program.License.User, Program.License.Password);
             PullBytes          = clientDownload.PullZip();
         }
         catch (Exception ex)
         {
             PullException = ex;
         }
     });
 }