コード例 #1
0
        private void stop_Button_Click(object sender, EventArgs e)
        {
            TreeNode node;

            if ((node = runningInstances_TreeView.SelectedNode) != null)
            {
                var nodes       = TreeViewHandler.GetAllChildren(node);
                var scriptpaths = nodes.Where(x => x.FullPath.EndsWith("launch.sh")).Select(x => x.FullPath);
                ((Button)sender).Enabled = false;
                handler.StopInstances(scriptpaths).ContinueWith(x => this.Invoke((MethodInvoker)(() =>
                {
                    var expanded = node.Nodes.GetExpansionState();
                    if (node.Parent.IsExpanded)
                    {
                        expanded.Add(node.Parent.FullPath);
                    }
                    if (node.IsExpanded)
                    {
                        expanded.Add(node.FullPath);
                    }
                    RefreshViews(null, expanded);
                    ((Button)sender).Enabled = true;
                })));
            }
            else
            {
                MessageBox.Show("No running instance or instance group selected");
            }
        }
コード例 #2
0
        public void PopulateViews(TreeView running, TreeView idle, string serversPath)
        {
            running.Nodes.Clear();
            idle.Nodes.Clear();
            var screens = SshHandler.GetRunningScreens();

            TreeViewHandler.Add(running, screens);
            var strs = SshHandler.FindWithName(serversPath, "launch.sh");

            strs.RemoveAll(x => screens.Contains(x));
            TreeViewHandler.Add(idle, strs);
        }
コード例 #3
0
        private void restart_Button_Click(object sender, EventArgs e)
        {
            TreeNode node;

            if ((node = runningInstances_TreeView.SelectedNode) != null)
            {
                var nodes       = TreeViewHandler.GetAllChildren(node);
                var scriptpaths = nodes.Where(x => x.FullPath.EndsWith("launch.sh")).Select(x => x.FullPath);
                Pause();
                handler.StopInstances(scriptpaths).ContinueWith(x => { handler.StartInstances(scriptpaths); this.Invoke((MethodInvoker)(() => RefreshViews())); });
            }
            else
            {
                MessageBox.Show("No running instance or instance group selected");
            }
        }
コード例 #4
0
        private void start_Button_Click(object sender, EventArgs e)
        {
            TreeNode node;

            if ((node = idleInstances_TreeView.SelectedNode) != null)
            {
                var nodes = TreeViewHandler.GetAllChildren(node);
                //var serverpathreal = handler.SshHandler.RealPath(mcServerPath_TextBox.Text);
                var scriptPaths = nodes.Where(x => x.FullPath.EndsWith("launch.sh")).Select(x => x.FullPath);
                handler.StartInstances(scriptPaths);
                var addToRunning = node.Nodes.GetExpansionState();
                addToRunning.AddRange(node.AllParents());
                addToRunning.Add(node.FullPath);
                RefreshViews(addToRunning);
            }
            else
            {
                MessageBox.Show("No instance or instance group selected");
            }
        }