示例#1
0
 private void BatchProcessMultipleServers_Load(object sender, EventArgs e)
 {
     if (ALL_SEVERS.Count == 0)
     {
         Commons.ShowErrorBox(this, "未添加服务");
         return;
     }
     m_errorIds = new List <Tuple <string, string> >();
     AllResult  = new List <IResult>();
     backgroundWorker1.RunWorkerAsync();
 }
示例#2
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
 {
     // 如果导出过程没有出现任何异常,那么导出成功,2个打开按钮变为可用。
     // 否则显示错误对话框。
     if (e.Error == null)
     {
         btnOpenFile.Enabled   = true;
         btnOpenFolder.Enabled = true;
         label2.Text           = string.Format(Properties.Resources.DownloadFileDlg_Downloaded, FileName);
     }
     else
     {
         Commons.ShowErrorBox(this, e.Error.Message);
         Close();
     }
 }
示例#3
0
 public static void SetValue(this NumericUpDown ctrl, decimal value)
 {
     if (value > ctrl.Maximum)
     {
         ctrl.Value = ctrl.Maximum;
         Commons.ShowErrorBox(ctrl.Parent, string.Format("{0}={1} 值设置超出范围", ctrl.Name, value));
     }
     else if (value < ctrl.Minimum)
     {
         ctrl.Value = ctrl.Minimum;
         Commons.ShowErrorBox(ctrl.Parent, string.Format("{0}={1} 值设置超出范围", ctrl.Name, value));
     }
     else
     {
         ctrl.Value = value;
     }
 }
示例#4
0
 private void btnCreatePrj_Click(object sender, EventArgs e)
 {
     using (var dlgCreate = new ProjectCreateDlg()) {
         if (dlgCreate.ShowDialog(this) == DialogResult.OK)
         {
             if (dlgCreate.NewId != 0)
             {
                 myGridViewBinding1.BindTo(dlgCreate.DlgResult, Commons.BindFlag.Update, "pId");
                 PrjReadOnly = false;
                 Edit(dlgCreate.NewId);
             }
             else
             {
                 Commons.ShowErrorBox(this, "创建失败");
             }
         }
     }
 }
示例#5
0
 private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         Commons.ShowErrorBox(this, e.Error.Message);
     }
     if (m_errorIds.Count > 0)
     {
         string info = "尚有" + (ALL_SEVERS.Count - m_complete) + "个服务未成功执行.\n";
         foreach (var d in m_errorIds)
         {
             info += d.Item1 + ":" + d.Item2 + "\r\n";
         }
         Commons.ShowErrorBox(this, info);
     }
     DialogResult = DialogResult.OK;
     Close();
 }
示例#6
0
        private async void btnOk_Click(object sender, EventArgs e)
        {
            var ret = await Security.SignIn.Validate(
                txtUserName.Text,
                txtPassword.Text,
                txtCaptchaCode.Text
                );

            if (ret)
            {
                var userName = txtUserName.Text.Trim();
                m_log.InfoFormat("logged as {0}", userName);
                Properties.Settings.Default.LastUser = userName;
                DialogResult = System.Windows.Forms.DialogResult.OK;
                Close();
            }
            else
            {
                Commons.ShowErrorBox(this, Properties.Resources.SignIn_Failed);
            }
        }