/// <summary> /// Builds the templates. /// </summary> /// <param name="progressIndicator">The progress indicator.</param> private void BuildTemplates(ProgressIndicator progressIndicator) { var service = Shell.Instance.GetComponent<AutoTemplatesService>(); var settings = service.GetSettings(); var builder = new AutoTemplateBuilder(); builder.Process(progressIndicator, settings.GetMaxTemplates(), settings.GetOccurances(), settings.GetMinPercentage()); AutoTemplateManager.Invalidate(); }
/// <summary>Updates the templates.</summary> private void UpdateTemplates() { var window = new ProgressWindow(); try { int maxTemplates; if (!int.TryParse(this.MaxTemplates.Text, out maxTemplates)) { MessageBox.Show("Max Suggestions must be a number."); return; } int occurances; if (!int.TryParse(this.Occurances.Text, out occurances)) { MessageBox.Show("Occurances must be a number."); return; } int minPercentage; if (!int.TryParse(this.MinPercentage.Text, out minPercentage)) { MessageBox.Show("Minimum Percentage must be a number."); return; } window.Show(); var builder = new AutoTemplateBuilder(); builder.Process(window.ProgressIndicator, maxTemplates, occurances, minPercentage); AutoTemplateManager.Invalidate(); this.RefreshInfo(); } finally { if (window.Visible) { window.Close(); } } }