private void _btnAddOnClick(object sender, EventArgs e) { if (textCodeName.Text.IsEmpty()) { MessageBox.Show("Enter Code Name", "Empty Code Name", MessageBoxButtons.OK, MessageBoxIcon.Stop); textCodeName.Focus(); return; } textStatus.Text = string.Format("Adding new image & creating packages..."); this.Update(); this.Invalidate(true); _frmMsg = new FrmMsg("Adding new image & creating packages..."); _frmMsg.Owner = this; _frmMsg.Show(this); backgroundVersionAdd.RunWorkerAsync(); }
private void _btnAddOnClick(object sender, EventArgs e) { if (textConfigFile.Text == "") { MessageBox.Show(this, "Enter config package file", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (!File.Exists(textConfigFile.Text)) { MessageBox.Show(this, "Config package file not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_installInfo.PlatformId.IsEmpty == true) { MessageBox.Show(this, "Select platform", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } if (textVersionNumber.Text == "") { MessageBox.Show(this, "Enter Version Number", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } var strs = textVersionNumber.Text.Split('.'); if (strs.Length != 3) { MessageBox.Show(this, "Invalid version number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SwlVersion v = new SwlVersion(); try { v.Major = byte.Parse(strs[0]); v.Minor = byte.Parse(strs[1]); v.Release = UInt16.Parse(strs[2]); } catch { MessageBox.Show(this, "Invalid version number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _installInfo.VersionNumber = v.ToInt32(); if (_installInfo.VersionNumber == 0) { MessageBox.Show(this, "Invalid version number", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textVersionDescription.Text == "") { MessageBox.Show(this, "Description is empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textVersionDescription.Focus(); return; } _installInfo.Description = textVersionDescription.Text; _frmMsg = new FrmMsg("Copying new config..."); _frmMsg.Owner = this; _frmMsg.Show(this); backgroundConfigAdd.RunWorkerAsync(); }
private void _backgroundConfigAddCompleted(object sender, RunWorkerCompletedEventArgs e) { _frmMsg.Close(); _frmMsg = null; this.BringToFront(); var req = new AddNewInstall(); req.PlatformId = _installInfo.PlatformId; req.Type = SoftwareUpdateType.Config; req.VersionNumber = _installInfo.VersionNumber; req.Description = _installInfo.Description; req.Date = DateTime.Now; req.SourcePath = Path.GetFileName(textConfigFile.Text); SendRequest(req); }
private void _backgroundVersionAddProgress(object sender, ProgressChangedEventArgs e) { switch (e.ProgressPercentage) { case 1: textStatus.Text = "Copying new installation..."; this.Update(); this.Invalidate(true); if (_frmMsg != null) { _frmMsg.Close(); } _frmMsg = new FrmMsg("Copying new installation..."); _frmMsg.Owner = this; _frmMsg.Show(this); break; case 2: textStatus.Text = "Adding new image & creating packages..."; this.Update(); this.Invalidate(true); if (_frmMsg != null) { _frmMsg.Close(); } _frmMsg = new FrmMsg(textStatus.Text); _frmMsg.Owner = this; _frmMsg.Show(this); break; } }
private void _backgroundVersionAddComplete(object sender, RunWorkerCompletedEventArgs e) { _frmMsg.Close(); _frmMsg = null; this.BringToFront(); textStatus.Text = "Finished"; this.Update(); this.Invalidate(true); if (_swlr != SwlResult.OK) { MessageBox.Show(_imagePath, "Error to Add New Installation", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("New installation added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Close(); }