Example #1
0
        private void server_Click(object sender, RoutedEventArgs e, evt Evt)
        {
            switch (ServerOS)
            {
            case "freeBSD":
                server_Click_1(sender, e, Evt);
                break;

            default:
                server_Click_2(sender, e, Evt);
                break;
            }
        }
Example #2
0
        private void server_Click_1(object sender, RoutedEventArgs e, evt Evt)
        {
            if (proc != null)
            {
                try
                {
                    if (proc.HasExited)
                    {
                        proc = null;
                        ledbutton.Visibility = System.Windows.Visibility.Hidden;
                    }
                    else
                    {
                        SwitchToThisWindow(proc.MainWindowHandle, true);
                        return;
                    }
                }
                catch
                {
                    proc = null;
                    ledbutton.Visibility = System.Windows.Visibility.Hidden;
                }
            }

            try
            {
                switch (Evt)
                {
                case evt.editClick:
                    break;

                case evt.edit2Click:
                    break;

                case evt.fullscreenClick:
                    break;

                case evt.smallScreen:
                    break;

                case evt.mnuClick:
                    proc = Process.Start(@"C:\Program Files (x86)\Private Shell\pshell.exe", "--profile " + ServerName.ToLower() + ".hafsjold.local");
                    ledbutton.Visibility = System.Windows.Visibility.Visible;
                    break;

                default:
                    break;
                }
            }
            catch { }
        }
Example #3
0
        private void server_Click_2(object sender, RoutedEventArgs e, evt Evt)
        {
            string rdpname = ServerName + @".rdp";
            string rdpfile = System.IO.Path.Combine(menuhd.MainWindow.menuFolder, rdpname);

            if (proc != null)
            {
                try
                {
                    if (proc.HasExited)
                    {
                        proc = null;
                        ledbutton.Visibility = System.Windows.Visibility.Hidden;
                    }
                    else
                    {
                        SwitchToThisWindow(proc.MainWindowHandle, true);
                        return;
                    }
                }
                catch
                {
                    proc = null;
                    ledbutton.Visibility = System.Windows.Visibility.Hidden;
                }
            }

            FileInfo fi = new FileInfo(rdpfile);

            if (!fi.Exists)
            {
                getFile(rdpfile, ServerName);
            }
            clsRDP rdp = new clsRDP(rdpfile);

            switch (Evt)
            {
            case evt.editClick:
                proc = Process.Start(@"c:\windows\system32\mstsc.exe", "/edit " + rdpfile);
                ledbutton.Visibility = System.Windows.Visibility.Visible;
                break;

            case evt.edit2Click:
                try
                {
                    Process.Start(@"C:\Program Files\Notepad++\notepad++.exe", rdpfile);
                }
                catch
                {
                    Process.Start(@"C:\Program Files (x86)\Notepad++\notepad++.exe", rdpfile);
                }
                break;

            case evt.fullscreenClick:
                proc = Process.Start(@"c:\windows\system32\mstsc.exe", "/f " + rdpfile);
                ledbutton.Visibility = System.Windows.Visibility.Visible;
                break;

            case evt.smallScreen:
                proc = Process.Start(@"c:\windows\system32\mstsc.exe", "/w:1024 /h:768 " + rdpfile);
                ledbutton.Visibility = System.Windows.Visibility.Visible;
                break;

            case evt.mnuClick:
                rdp.checkPosition();
                if (rdp.useFuulScreen)
                {
                    proc = Process.Start(@"c:\windows\system32\mstsc.exe", "/f " + rdpfile);
                }
                else
                {
                    proc = Process.Start(rdpfile);
                }
                ledbutton.Visibility = System.Windows.Visibility.Visible;
                break;

            default:
                break;
            }
        }