示例#1
0
        private void BuildNotifyIconConnectionContextMenu()
        {
            #region Connections

            #region Update Connection Status Handler removal
            foreach (EventHandler handler in updateHandlers)
            {
                UpdateConnectionStatus -= handler;
            }

            updateHandlers.Clear();
            #endregion

            var connectionsToolStrip = new System.Windows.Forms.ToolStripMenuItem("Conexiones");

            connectionsToolStrip.DropDownItems.Add(BuildConnectionToolStripButton("Disco W", _service.Disco_W, ConnectableHandlers.ConnectWDrive, ConnectableHandlers.DisconnectDrive));

            var dsicToolStrip = new System.Windows.Forms.ToolStripMenuItem("DSIC");

            #region dummy
            // Solves weird issue (ToolStrip Buttons getting cut off)
            // Post: https://stackoverflow.com/questions/1550077/toolstripbutton-text-gets-cut-off-in-contextmenustrip

            var dummyToolStrip = new System.Windows.Forms.ToolStripMenuItem("dummy")
            {
                Visible = false
            };

            dsicToolStrip.DropDownItems.Add(dummyToolStrip);
            #endregion

            dsicToolStrip.DropDownItems.Add(BuildConnectionToolStripButton("Asig (M:)", _service.Asig_DSIC, ConnectableHandlers.ConnectDrive, ConnectableHandlers.DisconnectDrive));
            dsicToolStrip.DropDownItems.Add(BuildConnectionToolStripButton("Homes (W:)", _service.Disco_DSIC, ConnectableHandlers.ConnectDrive, ConnectableHandlers.DisconnectDrive));
            dsicToolStrip.DropDownItems.Add(BuildConnectionToolStripButton("Portal", _service.VPN_DSIC, ConnectableHandlers.ConnectPortalDSIC));

            connectionsToolStrip.DropDownItems.Add(dsicToolStrip);

            notifyIcon.ContextMenuStrip.Items.Add(connectionsToolStrip);
            #endregion

            #region Access to...
            var accessToToolStrip = new System.Windows.Forms.ToolStripMenuItem("Acceder a...");

            var evirToolStrip = new System.Windows.Forms.ToolStripMenuItem("Escritorios Remotos (DSIC)");
            evirToolStrip.DropDownItems.Add("Linux", null, (s, e) => RemoteDesktop.ConnectToLinuxDesktop());
            evirToolStrip.DropDownItems.Add("Windows", null, (s, e) => RemoteDesktop.ConnectToWindowsDesktop());

            accessToToolStrip.DropDownItems.Add(evirToolStrip);

            var sshToolStrip = new System.Windows.Forms.ToolStripMenuItem("Conexiones SSH");
            sshToolStrip.DropDownItems.Add("DISCA", null, (s, e) => ConnectableHandlers.ConnectToSSH(_service, SSHConnection.DISCA_SSH));
            sshToolStrip.DropDownItems.Add("Kahan", null, (s, e) => ConnectableHandlers.ConnectToSSH(_service, SSHConnection.KAHAN_SSH));

            accessToToolStrip.DropDownItems.Add(sshToolStrip);

            notifyIcon.ContextMenuStrip.Items.Add(accessToToolStrip);
            #endregion
        }
示例#2
0
        static void Main(string[] args)
        {
            // Service test calls
            IAccesoUPVService service = ServiceTest();

            // VPN test calls

            service.VPN_UPV.SetNameAuto();
            VPNTest(service.VPN_UPV);

            service.VPN_DSIC.SetNameAuto();
            VPNTest(service.VPN_DSIC);

            // Drive test calls

            Console.WriteLine("Press any key to start Drive testing...");
            Console.ReadKey();
            Console.Clear();

            try
            {
                if (!service.VPN_UPV.IsReachable())
                {
                    ConnectTest(service.VPN_UPV);
                }

                Console.Write("Type your user: "******"Press the drive letter: ");

                char letter = default;
                while (letter == default || !DriveLetterTools.IsValid(letter))
                {
                    if (letter != default)
                    {
                        Console.Write("Invalid input. Please try again: ");
                    }
                    letter = (char)Console.Read();
                    Console.WriteLine();
                }
                service.Disco_W.Letter = letter;

                Console.WriteLine("Type your domain:");
                foreach (var value in Enum.GetValues(typeof(UPVDomain)))
                {
                    Console.WriteLine($"{(int)value} - {(UPVDomain)value}");
                }
                Console.Write("Type here: ");
                service.Disco_W.Domain = (UPVDomain)int.Parse(Console.ReadLine());

                DriveTest(service.Disco_W);

                try
                {
                    Console.Write("Type your DSIC password: "******"DSIC Drive testing was canceled by the user.");
                };

                // Remote desktop test

                Console.WriteLine("Connecting to Linux Desktop...");
                RemoteDesktop.ConnectToLinuxDesktop();

                Console.WriteLine("Press any key when the Linux Desktop is closed");
                Console.ReadKey();

                Console.WriteLine("Connecting to Windows Desktop...");
                RemoteDesktop.ConnectToWindowsDesktop();

                Console.WriteLine("Press any key when the Windows Desktop is closed");
                Console.ReadKey();

                if (service.VPN_UPV.IsConnected)
                {
                    DisconnectTest(service.VPN_UPV);
                }
            }
            catch (OperationCanceledException)
            {
                Console.WriteLine("The VPN connection process was canceled by the user.\nDrive testing ended.");
            }

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }
示例#3
0
 private void WindowsButton_Click(object sender, EventArgs e)
 {
     RemoteDesktop.ConnectToWindowsDesktop();
 }
示例#4
0
 private void EvirWindowsButton_Click(object sender, RoutedEventArgs e) => RemoteDesktop.ConnectToWindowsDesktop();