/// <summary> /// Add a new folder to the tree /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddFolder_Click(object sender, EventArgs e) { if (trvComputers.SelectedNode != null) { AddFolder addFolder = new AddFolder(); if (addFolder.ShowDialog() == DialogResult.OK) { object o = trvComputers.SelectedNode.Tag; if (o is Computer) { o = trvComputers.SelectedNode.Parent.Tag; } (o as Folder).Folders.Add(addFolder.Folder); FillTree(); trvComputers.SelectedNode = NodeFromObject(o); UpdateButtons(); } } else { MessageBox.Show(_resourceManager.GetString("SuggestSelectObject")); } }
/// <summary> /// The edit button was clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEdit_Click(object sender, EventArgs e) { if (trvComputers.SelectedNode != null) { if (trvComputers.SelectedNode.Tag is Computer) { Computer computer = (Computer)trvComputers.SelectedNode.Tag; Computer computerTemp = (Computer)computer.Clone(); AddComputer editComp = new AddComputer(computerTemp); if (editComp.ShowDialog() == DialogResult.OK) { computer.ConnectToConsole = editComp.Computer.ConnectToConsole; computer.DisplayName = editComp.Computer.DisplayName; computer.OpenFullScreen = editComp.Computer.OpenFullScreen; computer.ScreenHeight = editComp.Computer.ScreenHeight; computer.ScreenWidth = editComp.Computer.ScreenWidth; computer.ServerAddress = editComp.Computer.ServerAddress; computer.Username = editComp.Computer.Username; computer.Dimensions = editComp.Computer.Dimensions; computer.ScreenHeightPercentage = editComp.Computer.ScreenHeightPercentage; computer.ScreenWidthPercentage = editComp.Computer.ScreenWidthPercentage; FillTree(); } } else { Folder folder = (Folder)trvComputers.SelectedNode.Tag; AddFolder editFolder = new AddFolder(folder); if (editFolder.ShowDialog() == DialogResult.OK) { folder.FolderName = editFolder.Folder.FolderName; FillTree(); } } } }