private void Browser_ConfigurationDownloadFinished(bool success, string filePath = null)
        {
            if (success)
            {
                var communication = runtime.RequestReconfiguration(filePath);

                if (communication.Success)
                {
                    logger.Info($"Sent reconfiguration request for '{filePath}' to the runtime.");

                    splashScreen = uiFactory.CreateSplashScreen(appConfig);
                    splashScreen.SetIndeterminate();
                    splashScreen.UpdateStatus(TextKey.OperationStatus_InitializeSession, true);
                    splashScreen.Show();
                }
                else
                {
                    logger.Error($"Failed to communicate reconfiguration request for '{filePath}'!");
                    messageBox.Show(TextKey.MessageBox_ReconfigurationError, TextKey.MessageBox_ReconfigurationErrorTitle, icon: MessageBoxIcon.Error);
                }
            }
            else
            {
                logger.Error($"Failed to download configuration file '{filePath}'!");
                messageBox.Show(TextKey.MessageBox_ConfigurationDownloadError, TextKey.MessageBox_ConfigurationDownloadErrorTitle, icon: MessageBoxIcon.Error);
            }
        }
        private void Operations_ProgressChanged(ProgressChangedEventArgs args)
        {
            if (args.CurrentValue.HasValue)
            {
                splashScreen?.SetValue(args.CurrentValue.Value);
            }

            if (args.IsIndeterminate == true)
            {
                splashScreen?.SetIndeterminate();
            }

            if (args.MaxValue.HasValue)
            {
                splashScreen?.SetMaxValue(args.MaxValue.Value);
            }

            if (args.Progress == true)
            {
                splashScreen?.Progress();
            }

            if (args.Regress == true)
            {
                splashScreen?.Regress();
            }
        }
Esempio n. 3
0
        private void Browser_ConfigurationDownloadRequested(string fileName, DownloadEventArgs args)
        {
            var allow           = false;
            var hasQuitPassword = !string.IsNullOrWhiteSpace(Settings.Security.QuitPasswordHash);
            var hasUrl          = !string.IsNullOrWhiteSpace(Settings.Security.ReconfigurationUrl);

            if (hasQuitPassword)
            {
                if (hasUrl)
                {
                    var expression = Regex.Escape(Settings.Security.ReconfigurationUrl).Replace(@"\*", ".*");
                    var regex      = new Regex($"^{expression}$", RegexOptions.IgnoreCase);
                    var sebUrl     = args.Url.Replace(Uri.UriSchemeHttp, context.AppConfig.SebUriScheme).Replace(Uri.UriSchemeHttps, context.AppConfig.SebUriSchemeSecure);

                    allow = Settings.Security.AllowReconfiguration && (regex.IsMatch(args.Url) || regex.IsMatch(sebUrl));
                }
                else
                {
                    allow = Settings.Security.AllowReconfiguration;
                }
            }
            else
            {
                allow = Settings.ConfigurationMode == ConfigurationMode.ConfigureClient || Settings.Security.AllowReconfiguration;
            }

            if (allow)
            {
                args.AllowDownload = true;
                args.Callback      = Browser_ConfigurationDownloadFinished;
                args.DownloadPath  = Path.Combine(context.AppConfig.TemporaryDirectory, fileName);

                splashScreen.Show();
                splashScreen.BringToForeground();
                splashScreen.SetIndeterminate();
                splashScreen.UpdateStatus(TextKey.OperationStatus_InitializeSession, true);

                logger.Info($"Allowed download request for configuration file '{fileName}'.");
            }
            else
            {
                args.AllowDownload = false;
                logger.Info($"Denied download request for configuration file '{fileName}'.");
            }
        }
        private void Browser_ConfigurationDownloadRequested(string fileName, DownloadEventArgs args)
        {
            if (Settings.Security.AllowReconfiguration)
            {
                args.AllowDownload = true;
                args.Callback      = Browser_ConfigurationDownloadFinished;
                args.DownloadPath  = Path.Combine(context.AppConfig.TemporaryDirectory, fileName);

                splashScreen.Show();
                splashScreen.BringToForeground();
                splashScreen.SetIndeterminate();
                splashScreen.UpdateStatus(TextKey.OperationStatus_InitializeSession, true);

                logger.Info($"Allowed download request for configuration file '{fileName}'.");
            }
            else
            {
                args.AllowDownload = false;
                logger.Info($"Denied download request for configuration file '{fileName}'.");
            }
        }