private void btnSave_Click(object sender, EventArgs e) { SakwaUserControl oldEditor = editor.Controls.Count > 0 ? editor.Controls[0] as SakwaUserControl : null; if (oldEditor != null) { oldEditor.OnDeactivate(); } foreach (IDecisionTree tree in ctrl.Trees) { if (tree.FullPath != "") { SaveTreeFile(tree, tree.FullPath); } else { saveFileDialog.InitialDirectory = SakwaSupport.InitialFolder(tree, SakwaSupport.eInitialFolder.Template, LastUsedFolder); saveFileDialog.FileName = tree.RootNode.Name; saveFileDialog.Title = string.Format(UI_Constants.File_Save, tree.RootNode.Name); if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { SaveTreeFile(tree, saveFileDialog.FileName); } } } }
private void btnReduceText_Click(object sender, EventArgs e) { ctrl.Font = SetFont(ctrl.Font, -1.0F); props.Font = SetFont(props.Font, -1.0F); SakwaUserControl oldEditor = editor.Controls.Count > 0 ? editor.Controls[0] as SakwaUserControl : null; if (oldEditor != null) { oldEditor.Font = SetFont(oldEditor.Font, -1.0F); } }
private void ReplaceEditor(SakwaUserControl newEditor = null) { SakwaUserControl oldEditor = editor.Controls.Count > 0 ? editor.Controls[0] as SakwaUserControl : null; if (oldEditor != null) { oldEditor.OnDeactivate(); } editor.Controls.Clear(); if (newEditor != null) { newEditor.Dock = DockStyle.Fill; editor.Controls.Add(newEditor); newEditor.OnActivate(); newEditor.Font = ctrl.Font; } }
private void TemplateForm_FormClosing(object sender, FormClosingEventArgs e) { bool CanExit = true; DialogResult UserSelected = DialogResult.None; SakwaUserControl oldEditor = editor.Controls.Count > 0 ? editor.Controls[0] as SakwaUserControl : null; if (oldEditor != null) { oldEditor.OnDeactivate(); } foreach (IDecisionTree tree in ctrl.Trees) { if (tree.IsDirty) { UserSelected = IApplicationInterface.GetFloatingForm( eFloatReason.NotSet, new ucUnsavedExit(true)).ShowDialog(); switch (UserSelected) { case DialogResult.OK: CanExit = true; break; case DialogResult.Yes: btnSave_Click(this, new EventArgs()); CanExit = true; break; default: CanExit = false; break; } break; } } if (CanExit) { conf.SetConfigurationValue(UI_Constants.TemplateFormState, this.WindowState.ToString()); IConfigurationItem size = conf.GetConfigurationItem(UI_Constants.TemplateFormSize); (size as IConfigurationItemObject <Size>).SetValue(this.Size); IConfigurationItem location = conf.GetConfigurationItem(UI_Constants.TemplateFormLocation); (location as IConfigurationItemObject <Point>).SetValue(this.Location); IConfigurationItem recentProjects = conf.GetConfigurationItem(UI_Constants.TemplateRecentProjects); if (recentProjects != null) { recentProjects.Clear(); foreach (IDecisionTree tree in ctrl.Trees) { if (File.Exists(tree.FullPath)) { string itemName = string.Format("item-{0}", recentProjects.ConfigurationItems.Count + 1); recentProjects.AddConfigurationItem(new IConfigurationItemImpl(itemName, tree.FullPath, UI_Constants.ConfigurationSource)); } } string path = ctrl.SelectedPath; conf.SetConfigurationValue(UI_Constants.TemplateRecentNode, path); } try { conf.Save(); } catch (Exception ex) { log.Debug(ex.ToString()); } _IApplication.ShowHideTemplateEditor(false, true); } else { e.Cancel = true; } }