private void BtnRemoveClick(object sender, EventArgs e) { try { //Só remove o item se não existir sub-itens. if (trvWorkspace.SelectedNode.Nodes.Count > 0) { Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgNotRootRemove"], " "); return; } if (Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryMessage["msgRemoveWorkspace"], "", MessageBoxButtons.OKCancel) == DialogResult.OK) { ListWorkspace.Instance(Program.LanguageDefault).Delete(trvWorkspace.SelectedNode.Text); if (Directory.Exists(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\")) { ChangeFileAccess(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\"); Directory.Delete(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\", true); } //if (File.Exists(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\" + trvWorkspace.SelectedNode.Text.Trim() + ".xml")) // File.Delete(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\" + trvWorkspace.SelectedNode.Text.Trim() + ".xml"); //if (File.Exists(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\" + "ATIVOS_" + trvWorkspace.SelectedNode.Text.Trim() + ".xml")) // File.Delete(ListWorkspace._path + trvWorkspace.SelectedNode.Text.Trim() + "\\" + "ATIVOS_" + trvWorkspace.SelectedNode.Text.Trim() + ".xml"); LoadDataWorkspace(); btnApply.Enabled = false; btnRemove.Enabled = false; } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void TrvWorkspaceDragEnded(object sender, RadTreeViewDragEventArgs e) { try { ListWorkspace.Instance().SaveXmlDragDrop(e.Node.Text, e.TargetNode.Parent.Text, true); LoadDataWorkspace(); } catch (Exception ex) { Telerik.WinControls.RadMessageBox.Show(ex.Message, " "); } }
public bool Load(frmMain2 frmMain) { XmlDocument xmlDocument = ListWorkspace.Instance().GetXmlWorkspaceLoad(); if (xmlDocument == null) { return(false); } LoadTheme(); return(true); }
public void LoadTheme() { XmlDocument xmlDocument = ListWorkspace.Instance().GetXmlWorkspaceLoad(); if (xmlDocument == null) { return; } if (frmMain2.GInstance != null) { frmMain2.GInstance.m_Style = xmlDocument.GetElementsByTagName("WORKSPACE")[0]["THEME"].InnerText; } ChangeTheme.ChangeThemeName(xmlDocument.GetElementsByTagName("WORKSPACE")[0]["THEME"].InnerText); }
private void TrvWorkspaceDragOverNode(object sender, RadTreeViewDragCancelEventArgs e) { if ((e.DropPosition == DropPosition.AsChildNode) || (e.TargetNode.Parent == null)) { e.Cancel = true; } try { ListWorkspace.Instance().SaveXmlDragDrop(e.Node.Text, e.TargetNode.Parent.Text, false); } catch { e.Cancel = true; } }
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); } }
private void LoadDataWorkspace() { trvWorkspace.Nodes.Clear(); XmlNodeList nodeList = ListWorkspace.Instance().Load()[0].SelectNodes("SUPORTE"); int i = 0; foreach (XmlNode nivelSuperior in nodeList) { AddNodeWorkspace(nivelSuperior, trvWorkspace.Nodes.Count > 0 ? trvWorkspace.Nodes[i] : null); i++; } trvWorkspace.Nodes[0].Selected = true; trvWorkspace.ExpandAll(); }
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) { } }