Beispiel #1
0
        private void PlayBtn_Click(object sender, RoutedEventArgs e)
        {
            // XP: avoid message "Could not establish trust relationship for SSL/TLS secure channel"
            // Packager.exe -Play doesn't work on XP: "CHttpClient:SetLocation: InternetOpenUrl failed, LE=12031"
            if (Environment.OSVersion.Version.Major == 5)
            {
                MessageBox.Show("Playing apps is not supported on Windows XP");
                return;
            }

            borderMain.Opacity = 0.3;
            var playing = new Playing((AppDisplay)lvApps.SelectedItem, Playing.AppAction.Play, null);

            playing.Owner = this;
            playing.ShowDialog();
            borderMain.Opacity = 1;
        }
Beispiel #2
0
        private void DownloadBtn_Click(object sender, RoutedEventArgs e)
        {
            var app = (AppDisplay)lvApps.SelectedItem;
            var dlg = new Microsoft.Win32.SaveFileDialog();

            dlg.FileName   = app.Name + ".cameyo";            // Default file name
            dlg.DefaultExt = ".exe";                          // Default file extension
            dlg.Filter     = "Executable files (.exe)|*.exe"; // Filter files by extension

            // Show save file dialog box
            bool?result = dlg.ShowDialog();

            if (result == true)
            {
                var playing = new Playing((AppDisplay)lvApps.SelectedItem, Playing.AppAction.Download, dlg.FileName);
                playing.Owner = this;
                playing.Show();
            }
        }
        void StartRdpCapturePlay(object data)
        {
            var resp = (string)data;

            // Transmit resulting JSON to Packager
            var rdpAuthJsonFile = System.IO.Path.GetTempFileName();
            var rdpAuth         = ServerClient.DeserializeJson <RdpAuthData>(resp);

            if (rdpAuth == null)
            {
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                {
                    DisplayError("Failed starting session.");
                }));
                return;
            }
            string rdpTokenId = rdpAuth.parameters.rdp_token;

            File.WriteAllText(rdpAuthJsonFile, resp);   // Transmit to Packager, he'll know what to do with it...

            // Start Play session
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
            {
                borderMain.Opacity = 0.3;
                var serverApp      = new ServerApp()
                {
                    PkgId = rdpAuthJsonFile
                };
                var appDisplay = new AppDisplay(serverApp);
                var playing    = new Playing(appDisplay, Playing.AppAction.Play, null);
                playing.Owner  = this;
                playing.ShowDialog();
                borderMain.Opacity = 1;
            }));

            // Wait for resulting package or failure
            var thread = new Thread(new ParameterizedThreadStart(WaitForRdpCapturePkg));

            thread.Start(rdpTokenId);
            //WaitForRdpCapturePkg(rdpTokenId);
            //Close();
        }
Beispiel #4
0
        private void DownloadBtn_Click(object sender, RoutedEventArgs e)
        {
            var app = (AppDisplay)lvApps.SelectedItem;
            var dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.FileName = app.Name + ".cameyo";            // Default file name
            dlg.DefaultExt = ".exe";                        // Default file extension
            dlg.Filter = "Executable files (.exe)|*.exe";   // Filter files by extension

            // Show save file dialog box
            bool? result = dlg.ShowDialog();
            if (result == true)
            {
                var playing = new Playing((AppDisplay)lvApps.SelectedItem, Playing.AppAction.Download, dlg.FileName);
                playing.Owner = this;
                playing.Show();
            }
        }
Beispiel #5
0
        private void PlayBtn_Click(object sender, RoutedEventArgs e)
        {
            // XP: avoid message "Could not establish trust relationship for SSL/TLS secure channel"
            // Packager.exe -Play doesn't work on XP: "CHttpClient:SetLocation: InternetOpenUrl failed, LE=12031"
            if (Environment.OSVersion.Version.Major == 5)
            {
                MessageBox.Show("Playing apps is not supported on Windows XP");
                return;
            }

            borderMain.Opacity = 0.3;
            var playing = new Playing((AppDisplay)lvApps.SelectedItem, Playing.AppAction.Play, null);
            playing.Owner = this;
            playing.ShowDialog();
            borderMain.Opacity = 1;
        }
Beispiel #6
0
        void StartRdpCapturePlay(object data)
        {
            var resp = (string)data;

            // Transmit resulting JSON to Packager
            var rdpAuthJsonFile = System.IO.Path.GetTempFileName();
            var rdpAuth = ServerClient.DeserializeJson<RdpAuthData>(resp);
            if (rdpAuth == null)
            {
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                {
                    DisplayError("Failed starting session.");
                }));
                return;
            }
            string rdpTokenId = rdpAuth.parameters.rdp_token;
            File.WriteAllText(rdpAuthJsonFile, resp);   // Transmit to Packager, he'll know what to do with it...

            // Start Play session
            Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
            {
                borderMain.Opacity = 0.3;
                var serverApp = new ServerApp() { PkgId = rdpAuthJsonFile };
                var appDisplay = new AppDisplay(serverApp);
                var playing = new Playing(appDisplay, Playing.AppAction.Play, null);
                playing.Owner = this;
                playing.ShowDialog();
                borderMain.Opacity = 1;
            }));

            // Wait for resulting package or failure
            var thread = new Thread(new ParameterizedThreadStart(WaitForRdpCapturePkg));
            thread.Start(rdpTokenId);
            //WaitForRdpCapturePkg(rdpTokenId);
            //Close();
        }