コード例 #1
0
ファイル: AppFileManager.cs プロジェクト: qwdingyu/C-
        private void ChangeEnterprise(object state)
        {
            IsUploading = true;
            _AppFiles.CloseNotifycation();
            try
            {
                Version serverVersion = new Version(ServiceHelper.GetAppVersion(_SelectedEnterprise));
                List <AssistantUpdater.AppFileInfo> list = ServiceHelper.GetAllFiles(_SelectedEnterprise, serverVersion.ToString());
                Version version = FileHelper.GetCurrentVersion();

                foreach (var item in list)
                {
                    AppFileInfo file = new AppFileInfo()
                    {
                        ServerVersion = serverVersion,
                        Version       = version,
                        Enterprise    = _SelectedEnterprise,
                        Status        = item.IsDeleted ? FileStatus.Deleted : FileStatus.Uploaded,
                        OriginName    = item.fileName
                    };
                    _AppFiles.Add(file);
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.Application.OpenForms[0].Invoke((Action)(() =>
                {
                    System.Windows.Forms.MessageBox.Show(ex.Message, "错误", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                }));
            }
            finally
            {
                IsUploading = false;
                System.Windows.Forms.Application.OpenForms[0].Invoke((Action)(() =>
                {
                    _AppFiles.OpenNotifycation(true);
                }));
            }
        }