예제 #1
0
 private void LogoffSessionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.selectedSession != null)
     {
         if (MessageBox.Show("Are you sure you want to log off the selected session?", "Confirmation Required", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
         {
             TerminalServicesAPI.LogOffSession(this.selectedSession, false);
         }
     }
 }
예제 #2
0
        private void sd_Click(object sender, EventArgs e)
        {
            var menu = sender as ToolStripMenuItem;

            if (menu != null)
            {
                if (menu.Text == Resources.Shutdown)
                {
                    var server = menu.Tag as TerminalServer;
                    if (server != null && MessageBox.Show(Resources.Areyousureyouwanttoshutthismachineoff, Resources.Confirmation, MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        TerminalServicesAPI.ShutdownSystem(server, false);
                    }
                }
                else if (menu.Text == Resources.Reboot)
                {
                    var server = menu.Tag as TerminalServer;
                    if (server != null && MessageBox.Show(Resources.Areyousureyouwanttorebootthismachine, Resources.Confirmation, MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        TerminalServicesAPI.ShutdownSystem(server, true);
                    }
                }
                else if (menu.Text == Resources.Logoff)
                {
                    var session = menu.Tag as Session;
                    if (session != null && MessageBox.Show(Resources.Areyousureyouwanttologthissessionoff, Resources.Confirmation, MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        TerminalServicesAPI.LogOffSession(session, false);
                    }
                }
                else if (menu.Text == Resources.SendMessage)
                {
                    var session = menu.Tag as Session;
                    TerminalServer.SendMessageToSession(session);
                }
            }
        }