Esempio n. 1
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);
                }
            }
        }
Esempio n. 2
0
 private void SendMessageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     TerminalServer.SendMessageToSession(this.selectedSession);
 }