protected override void OnStop()
 {
     if (Core != null)
     {
         Core.Stop(); Core = null;
     }
 }
Example #2
0
 public void Stop()
 {
     if (Core != null)
     {
         Core.Stop(); Core = null;
     }
 }
Example #3
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (LocalHostSlave != null)
            {
                LocalHostSlave.Stop();
                LocalHostSlave = null;
            }

            SaveSettingsToRegistry();
        }
Example #4
0
 public void Start()
 {
     Core = new SlaveCore(this, false);
 }
Example #5
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey(AppRegSubKey);
                Left   = (int)key.GetValue("MainForm_Left", Left);
                Top    = (int)key.GetValue("MainForm_Top", Top);
                Width  = (int)key.GetValue("MainForm_Width", Width);
                Height = (int)key.GetValue("MainForm_Height", Height);
                MainSplitContainer.SplitterDistance = (int)key.GetValue("MainForm_SplitterDistance", MainSplitContainer.SplitterDistance);
                Terminal.TextFontSizeInPoints       = (int)key.GetValue("Terminal_TextFontSize", (int)Terminal.TextFontSizeInPoints);
            }
            catch (Exception)
            {
                MainSplitContainer_Resize(null, null);
            }

            try
            {
                Show();

                CredentialsDialog cd = new CredentialsDialog(this);
                cd.Caption = "Please provide the account to use upon connecting.";
                cd.Message = "Enter credentials.";
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    Close();
                    return;
                }
                UserCredentials = cd.Credentials;

                lock (Slaves)
                {
                    lock (ComputerTree)
                    {
                        ComputerTree.Nodes.Add(HostNodes);
                        ComputerTree.Nodes.Add(GroupNodes);

                        // Add a LocalHost slave running in this process.  Looks just like the service, but runs whenever parallel terminal is running- just in case
                        // the user wants to run something to include localhost.
                        LocalHostSlave = new SlaveCore(this, true);

                        // Add all slaves and only start connecting them after they've all been added.  This ensures proper semantics in the TerminalControl.
                        Slaves.Add(new Slave("localhost", AcceptedCertificates));

                        // Find all other hosts that we've previously opened and use
                        RegistryKey key = Registry.CurrentUser.OpenSubKey(HostRegSubKey, false);
                        if (key != null)
                        {
                            foreach (var v in key.GetSubKeyNames())
                            {
                                Slave NewSlave = new Slave(v, AcceptedCertificates);
                                Slaves.Add(NewSlave);
                            }
                        }

                        foreach (Slave ss in Slaves)
                        {
                            ss.Connection.OnMessage         += Slave_Connection_OnMessage;
                            ss.Connection.OnConnectionState += Slave_Connection_OnState;

                            Terminal.AddSlave(ss);
                            TreeNode SlaveNode = new TreeNode(ss.HostName + " (Disconnected)");
                            SlaveNode.Tag     = ss;
                            SlaveNode.Checked = false;
                            HostNodes.Nodes.Add(SlaveNode);
                        }

                        // Find all groups we've previously had and restore them
                        key = Registry.CurrentUser.OpenSubKey(GroupsRegSubKey, false);
                        if (key != null)
                        {
                            foreach (var v in key.GetSubKeyNames())
                            {
                                var group_key = key.OpenSubKey(v, false);

                                HostGroup Group = new HostGroup(v);
                                Groups.Add(Group);
                                TreeNode GNode = new TreeNode(group_key + " (Disconnected)");
                                GNode.Tag = Group;

                                object HostList = group_key.GetValue("Includes-Hosts");
                                if (HostList as string != null)
                                {
                                    string[] HostNames = ((string)HostList).Split(new char[] { ';' });
                                    foreach (string HostName in HostNames)
                                    {
                                        Slave Match = null;
                                        foreach (Slave ss in Slaves)
                                        {
                                            if (ss.HostName == HostName)
                                            {
                                                Match = ss; break;
                                            }
                                        }
                                        if (Match != null)
                                        {
                                            Group.Slaves.Add(Match);
                                            TreeNode HNode = new TreeNode(Match.HostName + " (Disconnected)");
                                            HNode.Tag     = Match;
                                            HNode.Checked = false;
                                            GNode.Nodes.Add(HNode);
                                        }
                                    }
                                }
                                GNode.Text = Group.GetDisplayText();
                                GroupNodes.Nodes.Add(GNode);
                            }
                        }

                        GUITimer.Enabled = true;

                        ComputerTree.ExpandAll();

                        Legend.Invalidate();

                        Terminal.Focus();
                        Terminal.Select();
                    }
                }

                ComputerTree_AfterCheck(null, null);

                if (!IsOnScreen(this))
                {
                    Top   = 10; Left = 10;
                    Width = 1000; Height = 1000;
                }

                Application.DoEvents();         // Clear out any keyboard events.
                Terminal.Enabled = true;        // Enable keyboard input after dialog box.
            }
            catch (Exception ex) {
                MessageBox.Show(ex.ToString());
                Close();
            }
        }
Example #6
0
 public void OnStatusChanged(SlaveCore.StatusCommons status) {
   throw new NotImplementedException("Dummy Listener, don't subscribe it!");
 }
 protected override void OnStart(string[] args)
 {
     Core = new SlaveCore(this, false);
 }