public async void HandleReloadJavaScript()
        {
            DispatcherHelpers.AssertOnDispatcher();

            HideRedboxDialog();

            var message = !_isUsingJsProxy
                ? "Fetching JavaScript bundle."
                : "Connecting to remote debugger.";

            var progressDialog  = new ProgressDialog("Please wait...", message);
            var dialogOperation = progressDialog.ShowAsync();

            if (_isUsingJsProxy)
            {
                await ReloadJavaScriptInProxyMode(dialogOperation.Cancel, progressDialog.Token);
            }
            else if (_jsBundleFile == null)
            {
                await ReloadJavaScriptFromServerAsync(dialogOperation.Cancel, progressDialog.Token);
            }
            else
            {
                await ReloadJavaScriptFromFileAsync(progressDialog.Token);

                dialogOperation.Cancel();
            }
        }
        public async void HandleReloadJavaScript()
        {
            DispatcherHelpers.AssertOnDispatcher();

            HideRedboxDialog();
            HideDevOptionsDialog();

            var message = !IsRemoteDebuggingEnabled
                ? "Fetching JavaScript bundle."
                : "Connecting to remote debugger.";

            var progressDialog = new ProgressDialog("Please wait...", message);

#if WINDOWS_UWP
            var    dialogOperation = progressDialog.ShowAsync();
            Action cancel          = dialogOperation.Cancel;
#else
            progressDialog.ShowDialog();
            Action cancel = progressDialog.Hide;
#endif
            if (IsRemoteDebuggingEnabled)
            {
                await ReloadJavaScriptInProxyMode(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else if (_jsBundleFile == null)
            {
                await ReloadJavaScriptFromServerAsync(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else
            {
                await ReloadJavaScriptFromFileAsync(progressDialog.Token);

                cancel();
            }
        }
Example #3
0
        public async void HandleReloadJavaScript()
        {
            DispatcherHelpers.AssertOnDispatcher();

            HideRedboxDialog();
            HideDevOptionsDialog();

            Action            cancel;
            CancellationToken token;

            if (IsProgressDialogEnabled)
            {
                var message = !IsRemoteDebuggingEnabled
                ? "Fetching JavaScript bundle."
                : "Connecting to remote debugger.";

                ProgressDialog progressDialog = new ProgressDialog("Please wait...", message);

#if WINDOWS_UWP
                var dialogOperation = progressDialog.ShowAsync();
                cancel = dialogOperation.Cancel;
#else
                if (Application.Current != null && Application.Current.MainWindow != null && Application.Current.MainWindow.IsLoaded)
                {
                    progressDialog.Owner = Application.Current.MainWindow;
                }
                else
                {
                    progressDialog.Topmost = true;
                    progressDialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                }

                cancel = progressDialog.Close;
                progressDialog.Show();
#endif
                token = progressDialog.Token;
            }
            else
            {
                // Progress not enabled - provide empty implementations
                cancel = () => { };
                token  = default(CancellationToken);
            }

            if (IsRemoteDebuggingEnabled)
            {
                await ReloadJavaScriptInProxyMode(cancel, token).ConfigureAwait(false);
            }
            else if (_shouldLoadFromPackagerServer)
            {
                await ReloadJavaScriptFromServerAsync(cancel, token).ConfigureAwait(false);
            }
            else
            {
                await ReloadJavaScriptFromFileAsync(token);

                cancel();
            }
        }
        private Action ShowProgressDialog(ProgressDialog progressDialog)
        {
#if WINDOWS_UWP
            var operation = progressDialog.ShowAsync();
            return(operation.Cancel);
#else
            progressDialog.Show();
            return(progressDialog.Close);
#endif
        }
        public async void HandleReloadJavaScript()
        {
            DispatcherHelpers.AssertOnDispatcher();

            HideRedboxDialog();
            HideDevOptionsDialog();

            var message = !IsRemoteDebuggingEnabled
                ? "Fetching JavaScript bundle."
                : "Connecting to remote debugger.";

            var progressDialog = new ProgressDialog("Please wait...", message);

#if WINDOWS_UWP
            var    dialogOperation = progressDialog.ShowAsync();
            Action cancel          = dialogOperation.Cancel;
#else
            if (Application.Current != null && Application.Current.MainWindow != null && Application.Current.MainWindow.IsLoaded)
            {
                progressDialog.Owner = Application.Current.MainWindow;
            }
            else
            {
                progressDialog.Topmost = true;
                progressDialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }

            Action cancel = progressDialog.Close;
            progressDialog.Show();
#endif
            if (IsRemoteDebuggingEnabled)
            {
                await ReloadJavaScriptInProxyMode(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else if (_jsBundleFile == null)
            {
                await ReloadJavaScriptFromServerAsync(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else
            {
                await ReloadJavaScriptFromFileAsync(progressDialog.Token);

                cancel();
            }
        }
        public async void HandleReloadJavaScript()
        {
            DispatcherHelpers.AssertOnDispatcher();

            HideRedboxDialog();
            HideDevOptionsDialog();

            var message = !IsRemoteDebuggingEnabled
                ? "Fetching JavaScript bundle."
                : "Connecting to remote debugger.";

            var progressDialog = new ProgressDialog("Please wait...", message);
#if WINDOWS_UWP
            var dialogOperation = progressDialog.ShowAsync();
            Action cancel = dialogOperation.Cancel;
#else
            progressDialog.ShowDialog();
            Action cancel = progressDialog.Hide;
#endif
            if (IsRemoteDebuggingEnabled)
            {
                await ReloadJavaScriptInProxyMode(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else if (_jsBundleFile == null)
            {
                await ReloadJavaScriptFromServerAsync(cancel, progressDialog.Token).ConfigureAwait(false);
            }
            else
            {
                await ReloadJavaScriptFromFileAsync(progressDialog.Token);
                cancel();
            }
        }