private void OpenLocation_Click(object sender, RoutedEventArgs e)
        {
            RuleSetHelpers.EnsureRuleSetExistsInLocalAppData();

            string ruleSetPath = RuleSetHelpers.GetRuleSetPath();

            if (File.Exists(ruleSetPath))
            {
                try
                {
                    Process.Start("explorer.exe", $"/select, \"{ruleSetPath}\"");
                }
                catch (Exception ex) when(ex is InvalidOperationException ||
                                          ex is FileNotFoundException ||
                                          ex is Win32Exception)
                {
                    MessageBox.Show(ex.Message, null, MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            e.Handled = true;
        }
Example #2
0
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            RuleSetHelpers.EnsureRuleSetExistsInLocalAppData(showErrorMessage: true);
        }