Beispiel #1
0
 public Playing(AppDisplay appDisplay, AppAction appAction, string targetFileName)
 {
     InitializeComponent();
     this.appDisplay = appDisplay;
     this.appAction = appAction;
     this.targetFileName = targetFileName;
 }
Beispiel #2
0
 public Playing(AppDisplay appDisplay, AppAction appAction, string targetFileName)
 {
     InitializeComponent();
     this.appDisplay     = appDisplay;
     this.appAction      = appAction;
     this.targetFileName = targetFileName;
 }
Beispiel #3
0
        private void ShowDetails(AppDisplay appDisplay)
        {
            if (appDisplay == null)
            {
                AppsGrid.RowDefinitions[2].Height = new GridLength(0);
                return;
            }
            AppsGrid.RowDefinitions[2].Height = new GridLength(200);

            // Fill in available info
            if (File.Exists(appDisplay.ImagePath))
            {
                try
                {
                    BitmapImage img = new BitmapImage();
                    img.BeginInit();
                    img.UriSource = new Uri(appDisplay.ImagePath);
                    img.EndInit();
                    DetailsImg.Source = img;
                }
                catch
                {
                    DetailsImg.Source = null;
                }
            }
            else
            {
                DetailsImg.Source = null;
            }

            //DetailsVersion.Text = "v" + appDisplay.Version;
            DetailsName.Text = appDisplay.Name;

            DetailsPkgId.Text = "#" + appDisplay.PkgId;         // Used also to synchronize between this routine and ShowDetailsAsync
            //DetailsSize.Text = Utils.BytesToStr(appDisplay.Size);
            //DetailsVersion.Text = "v" + appDisplay.Version;
            DetailsSize.Visibility    = Visibility.Collapsed;   // Deprecated
            DetailsVersion.Visibility = Visibility.Collapsed;   // Deprecated
            DownloadBtn.Visibility    = Visibility.Collapsed;   // Deprecated

            // Empty async items
            DetailsDescription.Text = "";

            // Start ShowDetailsAsync
            PreloaderStart();
            var threadStart = new ParameterizedThreadStart(ShowDetailsAsync);
            var thread      = new Thread(threadStart);

            thread.Start(appDisplay);
        }
        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 #5
0
        private void ShowDetails(AppDisplay appDisplay)
        {
            if (appDisplay == null)
            {
                AppsGrid.RowDefinitions[2].Height = new GridLength(0);
                return;
            }
            AppsGrid.RowDefinitions[2].Height = new GridLength(200);

            // Fill in available info
            if (File.Exists(appDisplay.ImagePath))
            {
                try
                {
                    BitmapImage img = new BitmapImage();
                    img.BeginInit();
                    img.UriSource = new Uri(appDisplay.ImagePath);
                    img.EndInit();
                    DetailsImg.Source = img;
                }
                catch
                {
                    DetailsImg.Source = null;
                }
            }
            else
                DetailsImg.Source = null;

            //DetailsVersion.Text = "v" + appDisplay.Version;
            DetailsName.Text = appDisplay.Name;

            DetailsPkgId.Text = "#" + appDisplay.PkgId;   // Used also to synchronize between this routine and ShowDetailsAsync
            DetailsSize.Text = Utils.BytesToStr(appDisplay.Size);
            DetailsVersion.Text = "v" + appDisplay.Version;

            // Empty async items
            DetailsDescription.Text = "";

            // Start ShowDetailsAsync
            PreloaderStart();
            var threadStart = new ParameterizedThreadStart(ShowDetailsAsync);
            var thread = new Thread(threadStart);
            thread.Start(appDisplay);
        }
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();
        }