Ejemplo n.º 1
0
 private void remoteShellToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (Client c in GetSelectedClients())
     {
         FrmRemoteShell frmRs = FrmRemoteShell.CreateNewOrGetExisting(c);
         frmRs.Show();
         frmRs.Focus();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new remote shell form for the client or gets the current open form, if there exists one already.
        /// </summary>
        /// <param name="client">The client used for the remote shell form.</param>
        /// <returns>
        /// Returns a new remote shell form for the client if there is none currently open, otherwise creates a new one.
        /// </returns>
        public static FrmRemoteShell CreateNewOrGetExisting(Client client)
        {
            if (OpenedForms.ContainsKey(client))
            {
                return(OpenedForms[client]);
            }
            FrmRemoteShell f = new FrmRemoteShell(client);

            f.Disposed += (sender, args) => OpenedForms.Remove(client);
            OpenedForms.Add(client, f);
            return(f);
        }
Ejemplo n.º 3
0
        private void openDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = _currentDir;

            if (lstDirectory.SelectedItems.Count == 1)
            {
                var      item = lstDirectory.SelectedItems[0];
                FileType type = (FileType)item.Tag;

                if (type == FileType.Directory)
                {
                    path = GetAbsolutePath(item.SubItems[0].Text);
                }
            }

            FrmRemoteShell frmRs = FrmRemoteShell.CreateNewOrGetExisting(_connectClient);

            frmRs.Show();
            frmRs.Focus();
            frmRs.RemoteShellHandler.SendCommand($"cd \"{path}\"");
        }