Ejemplo n.º 1
0
        /// <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();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add a new computer to the tree
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddComputer_Click(object sender, EventArgs e)
        {
            AddComputer addComp = new AddComputer();

            if (addComp.ShowDialog() == DialogResult.OK)
            {
                object o = trvComputers.SelectedNode.Tag;

                if (o is Computer)
                {
                    o = trvComputers.SelectedNode.Parent.Tag;
                }

                (o as Folder).Computers.Add(addComp.Computer);

                FillTree();

                trvComputers.SelectedNode = NodeFromObject((object)addComp.Computer);
                UpdateButtons();
            }
        }