Пример #1
0
        public void DownloadCompleted(DownloadCompletedChangedEventArgs e)
        {
            if (e.Cancel)
            {
                this.Close();
            }

            if (e.Error)
            {
                Methods.ShowStandardMsgBox(FormMessageType.Information, "خطا", "در هنگام به روز رسانی خطایی ایجاد شد. لطفا مجددا تلاش نمایید.");
            }

            if (!e.Cancel)
            {
                Methods.ShowStandardMsgBox(FormMessageType.Information, "به روز رسانی", "دانلود با موفقیت به پایان رسید.");

                string tempPath=SaveZipFileToTemp(e.Bytes);

                string updatePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                                               @"Shayan Dental\Updates");

                UnZipFile(tempPath, updatePath);

                Session.LastUpdateDate = DateTime.Now;
            }

            _updateDone = true;
            btnCancel.Text = "خروج";
            btnCancel.Image = RscIcon.exit;
            btnCancel.ImageAlignment = ContentAlignment.MiddleLeft;
            btnCancel.RightToLeft = RightToLeft.No;
            btnCancel.TextAlignment = ContentAlignment.MiddleRight;
            btnCancel.Text = btnCancel.Text + "   ";
        }
Пример #2
0
        void _updateDownloader_DownloadCompleted(object sender, DownloadCompletedChangedEventArgs e)
        {
            if (this.IsDisposed)
                return;

            this.Invoke(new DoneDelegate(DownloadCompleted), new object[] {e});
        }
Пример #3
0
        private void OnDownloadCompleted(bool error)
        {
            if (DownloadCompleted != null)
            {
                byte[] content=_httpWebRequestState.ContentStream!=null?
                    _httpWebRequestState.ContentStream.ToArray() : null;

                DownloadCompletedChangedEventArgs eventArgs = new DownloadCompletedChangedEventArgs(content, Cancel, error);
                _httpWebRequestState.Close();
                DownloadCompleted(this, eventArgs);
            }
        }