コード例 #1
0
 private void ShutdownServerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (server.IsATerminalServer)
     {
         if (MessageBox.Show("Are you sure you want to shutdown this server?", "Confirmation Required", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
         {
             TerminalServicesAPI.ShutdownSystem(this.server, false);
         }
     }
 }
コード例 #2
0
ファイル: RdpMenuVisitor.cs プロジェクト: zivalin/Terminals
        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);
                }
            }
        }