private void InitializeForm() { InitializeComponent(); txt_dockerCaption.Focus(); DockerCaption = txt_dockerCaption.Text; btn_cancel.DialogResult = DialogResult.Cancel; btn_done.DialogResult = DialogResult.OK; CorelVersionInfo temp; string version = ""; for (int i = CorelVersionInfo.MinVersion; i < CorelVersionInfo.MaxVersion; i++) { temp = new CorelVersionInfo(i); installedVersions.Add(temp); AddCheckBox(temp.Corel64FullName, i, !temp.CorelInstallationNotFound); if (i != CorelVersionInfo.MinVersion && i != CorelVersionInfo.MaxVersion) { version += "|"; } version += CorelVersionInfo.GetCorelAbreviation(i); } regex = new Regex(string.Format(@".+\\Corel\\CorelDRAW Graphics Suite (?<corelAbb>(?:{0}))\\Programs(?:64|)$", version)); ChangeTheme(); ChangeType(); }
private void Ck_Click(object sender, EventArgs e) { CheckBox ck = sender as CheckBox; CorelVersionInfo temp = installedVersions.Find(r => r.CorelVersion == (int)ck.Tag); if (ck.Checked) { if (temp.CorelInstallationNotFound) { if (!temp.recoverPathManually(temp.CorelVersion)) { ck.Checked = false; } } if (!temp.CorelInstallationNotFound) { this.selectedVersions.Add(temp); } } if (!ck.Checked && this.selectedVersions.Count > 0) { this.selectedVersions.Remove(installedVersions.Find(r => r.CorelVersion == (int)ck.Tag)); } if (this.selectedVersions.Count > 0) { btn_done.Enabled = true; } else { btn_done.Enabled = false; } }
private void Ck_Click(object sender, EventArgs e) { CheckBox ck = sender as CheckBox; CorelVersionInfo temp = installedVersions.Find(r => r.CorelVersion == (int)ck.Tag); if (ck.Checked) { if (temp.CorelInstallationNotFound) { if (!string.IsNullOrEmpty(virtualFolder)) { if (regex.IsMatch(virtualFolder)) { string toReplace = regex.Match(virtualFolder).Result("${corelAbb}"); virtualFolder = virtualFolder.Replace(toReplace, temp.CorelAbreviation); } else { virtualFolder = ""; } } if (!temp.recoverPathManually(temp.CorelVersion, virtualFolder)) { ck.Checked = false; } } if (!temp.CorelInstallationNotFound) { this.selectedVersions.Add(temp); if (temp.Corel64Bit == CorelVersionInfo.CorelIs64Bit.Corel32) { virtualFolder = temp.CorelExePath; } else { virtualFolder = temp.CorelExePath; } } } if (!ck.Checked && this.selectedVersions.Count > 0) { this.selectedVersions.Remove(installedVersions.Find(r => r.CorelVersion == (int)ck.Tag)); } if (this.selectedVersions.Count > 0) { btn_done.Enabled = true; } else { btn_done.Enabled = false; } }
private void InitializeForm() { InitializeComponent(); txt_dockerCaption.Focus(); DockerCaption = txt_dockerCaption.Text; btn_cancel.DialogResult = DialogResult.Cancel; btn_done.DialogResult = DialogResult.OK; CorelVersionInfo temp; for (int i = CorelVersionInfo.MinVersion; i < CorelVersionInfo.MaxVersion; i++) { temp = new CorelVersionInfo(i); installedVersions.Add(temp); AddCheckBox(temp.Corel64FullName, i, !temp.CorelInstallationNotFound); } ChangeTheme(); ChangeType(); }
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { this.projectDir = replacementsDictionary["$destinationdirectory$"]; try { EnvDTE80.DTE2 dte = null; VsTheme vsTheme = VsTheme.Unknown; try { dte = automationObject as EnvDTE80.DTE2; } catch { } if (dte != null) { ThemeManager tManager = new ThemeManager(dte); vsTheme = tManager.GetCurrentTheme(); } ConfigureForm form = new ConfigureForm(vsTheme,replacementsDictionary["$type$"]); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool cancel = true; this.selectedVersions = form.SelectedVersions; for (int i = CorelVersionInfo.MinVersion; i < CorelVersionInfo.MaxVersion; i++) { replacementsDictionary.Add("$corel" + i.ToString() + "$", "0"); } for (int i = 0; i <selectedVersions.Count; i++) { CorelVersionInfo corel = selectedVersions[i]; if (corel.CorelInstallationNotFound) { System.Windows.Forms.MessageBox.Show(string.Format("{0} not found", corel.CorelFullName)); } else { cancel = false; string corelAddonsPath = ""; if (corel.Corel64Bit == CorelVersionInfo.CorelIs64Bit.Corel32) corel.CorelAddonsPath(out corelAddonsPath); else corel.CorelAddonsPath64(out corelAddonsPath); replacementsDictionary["$corel" + corel.CorelVersion.ToString() + "$"] = "1"; replacementsDictionary.Add("$CorelAddonsPath" + corel.CorelVersion + "$", corelAddonsPath); replacementsDictionary.Add("$CorelProgramPath" + corel.CorelVersion + "$", corel.CorelExePath); } } if (cancel) { System.Windows.Forms.MessageBox.Show("Operation is canceled!"); throw new WizardCancelledException(); } replacementsDictionary.Add("$GuidA$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$GuidB$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$GuidC$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$Caption$", form.DockerCaption); finish = true; } else { throw new WizardCancelledException(); } } catch(WizardCancelledException) { finish = false; } catch (Exception) { finish = false; } }
public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { this.projectDir = replacementsDictionary["$destinationdirectory$"]; try { EnvDTE80.DTE2 dte = null; VsTheme vsTheme = VsTheme.Unknown; try { dte = automationObject as EnvDTE80.DTE2; } catch { } if (dte != null) { ThemeManager tManager = new ThemeManager(dte); vsTheme = tManager.GetCurrentTheme(); } ConfigureForm form = new ConfigureForm(vsTheme, replacementsDictionary["$type$"]); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool cancel = true; this.selectedVersions = form.SelectedVersions; DirectoryInfo dir; string targetFolder = ""; if (form.GlobalTargets) { replacementsDictionary.Add("$targetvar$", "$([System.Environment]::GetEnvironmentVariable('localappdata'))\\bonus630\\"); dir = new DirectoryInfo(System.Environment.GetEnvironmentVariable("localappdata") + "\\bonus630"); if (!dir.Exists) { dir.Create(); } targetFolder = dir.FullName; } else { replacementsDictionary.Add("$targetvar$", "$(SolutionDir)"); dir = new DirectoryInfo(this.projectDir); if (dir.Exists) { targetFolder = dir.Parent.FullName; } } if (!string.IsNullOrEmpty(targetFolder)) { TargetsCreator targetsCreator = new TargetsCreator(); targetsCreator.WriteTargetsFile(targetFolder); } for (int i = CorelVersionInfo.MinVersion; i < CorelVersionInfo.MaxVersion; i++) { replacementsDictionary.Add("$corel" + i.ToString() + "$", ""); } foreach (var item in ProjectTypeGuid) { replacementsDictionary.Add(item.Key, item.Value); } for (int i = CorelVersionInfo.MinVersion; i < CorelVersionInfo.MaxVersion; i++) { CorelVersionInfo corel = new CorelVersionInfo(i); //CorelVersionInfo corel = selectedVersions[i]; //string corelAddonsPath = ""; //if (corel.Corel64Bit == CorelVersionInfo.CorelIs64Bit.Corel32) // corel.CorelAddonsPath(out corelAddonsPath); //else // corel.CorelAddonsPath64(out corelAddonsPath); string projectKind = replacementsDictionary["$lang$"]; if (projectKind.Equals("cs")) { replacementsDictionary["$corel" + corel.CorelVersion.ToString() + "$"] = Helper.buildConfigurationCS(corel); } else if (projectKind.Equals("vb")) { replacementsDictionary["$corel" + corel.CorelVersion.ToString() + "$"] = Helper.buildConfigurationVB(corel); } else { throw new WizardCancelledException(); } if (!corel.CorelInstallationNotFound) { cancel = false; } //if (corel.CorelInstallationNotFound) //{ // System.Windows.Forms.MessageBox.Show(string.Format("{0} not found", corel.CorelFullName)); //} //else //{ // cancel = false; //} } if (cancel) { //System.Windows.Forms.MessageBox.Show("Operation is canceled!"); throw new WizardCancelledException("Operation is canceled!"); } replacementsDictionary.Add("$GuidA$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$GuidB$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$GuidC$", Guid.NewGuid().ToString()); replacementsDictionary.Add("$Caption$", form.DockerCaption); finish = true; } else { finish = false; throw new WizardCancelledException(); } } catch (WizardCancelledException) { finish = false; } catch (Exception) { finish = false; } }