private void BtnOkClick(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(txtTextWorkspace.Text)) { Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgWorkspaceEmpty"]); } if ((!txtTextWorkspace.Text.Equals(TextWorkspace)) || (DefaultWorkspace != cbxDefaultWorkspace.Checked)) { if (!Insert) { M4Core.Entities.Workspace workspace = new M4Core.Entities.Workspace { Parent = ParentWorkspace, Text = txtTextWorkspace.Text }; if (DefaultWorkspace == null) { workspace.Default = null; } else { workspace.Default = cbxDefaultWorkspace.Checked; } ListWorkspace.Instance(Program.LanguageDefault).Update(TextWorkspace, workspace, (!txtTextWorkspace.Text.Equals(TextWorkspace))); } TextWorkspace = txtTextWorkspace.Text; if ((DefaultWorkspace != null) || (Insert)) { DefaultWorkspace = cbxDefaultWorkspace.Checked; } } DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(ex.Message); } }
public void InsertTemplate(string textWorkspace) { FrmDescription frmDescription = new FrmDescription(_frmMain) { Insert = true }; if (!String.IsNullOrEmpty(textWorkspace)) { frmDescription.TextWorkspace = textWorkspace; frmDescription.SetPropertiesWorkspace(); } DialogResult result = frmDescription.ShowDialog(); if (!result.Equals(DialogResult.OK)) { return; } try { M4Core.Entities.Workspace workspace = new M4Core.Entities.Workspace { Parent = "Workspaces", Text = frmDescription.TextWorkspace, Default = frmDescription.DefaultWorkspace }; if (ListWorkspace.Instance(Program.LanguageDefault).Insert(workspace)) { _archiveName = frmDescription.TextWorkspace + ".xml"; SaveConfigMain(); } else { InsertTemplate(frmDescription.TextWorkspace); } } finally { WorkspaceLoaded = frmDescription.TextWorkspace; } }
private void CmnuWorkspaceDropDownClosed(object sender, EventArgs e) { if (((RadContextMenu)sender).DropDown.ClickedItem == null) { return; } if (((RadContextMenu)sender).DropDown.ClickedItem.Text.ToUpper() == Program.LanguageDefault.DictionaryWorkspace["mnuDefaultWorkspace"].ToUpper()) { M4Core.Entities.Workspace workspace = new M4Core.Entities.Workspace { Parent = trvWorkspace.SelectedNode.Parent.Text, Text = trvWorkspace.SelectedNode.Text, Default = true }; ListWorkspace.Instance(Program.LanguageDefault).Update(trvWorkspace.SelectedNode.Text, workspace, false); LoadDataWorkspace(); } else if (((RadContextMenu)sender).DropDown.ClickedItem.Text.ToUpper() == Program.LanguageDefault.DictionaryWorkspace["mnuLoadWorkspace"].ToUpper()) { _frmMain.RestoreWorkspace(trvWorkspace.SelectedNode.Text.Trim()); WorkspaceLoaded = trvWorkspace.SelectedNode.Text.Trim(); ////create a custom palette //NPalette palette = new NUIPalette // { // ControlDark = Color.FromArgb(170, 170, 170), // ControlLight = Color.FromArgb(170, 170, 170), // ControlBorder = Color.FromArgb(170, 170, 170), // Control = Color.FromArgb(170, 170, 170), // }; ////apply the palette //NUIManager.ApplyPalette(_frmMain, palette); } else if (((RadContextMenu)sender).DropDown.ClickedItem.Text.ToUpper() == Program.LanguageDefault.DictionaryWorkspace["mnuRenameWorkspace"].ToUpper()) { BtnApplyClick(null, null); } }
public void SaveTemplate(string theme, frmMain2 frmMain) { try { M4Core.Entities.Workspace workspace = new M4Core.Entities.Workspace { Parent = "Workspaces", Text = "LoadWorkspace", Theme = theme, Default = true }; ListWorkspace.Instance().SaveWorkspaceLoad(workspace); // SaveConfigMain("WorkspaceTelerik.xml", frmMain); } catch (Exception ex) { } }