示例#1
0
        private async Task ParseCompareAsync(string[] parts)
        {
            if (parts.Length != 2)
            {
                ThrowException("ex_syntaxError");
            }
            string webPageName = parts[1];

            WebPage webPage = GetVariable(webPageName, "webpage") as WebPage;

            bool result = await BackgroundTask.CheckAndExcuteWebPageAsync(webPage, true);

            Output?.Invoke(this, $"compare {webPage}, change result is {result}");
        }
        private async void ForceCompareButton_Click(object sender, RoutedEventArgs e)
        {
            MainWindow.progressDialog.Show();
            try
            {
                bool result = await BackgroundTask.CheckAndExcuteWebPageAsync(Item, true);

                MainWindow.progressDialog.Close();
                if (!result)
                {
                    await MainWindow.dialog.ShowInfomationAsync(FindResource("label_compareComplete") as string);
                }
                Notify(nameof(Item));
            }
            catch (Exception ex)
            {
                MainWindow.progressDialog.Close();
                await MainWindow.dialog.ShowErrorAsync(ex.ToString(), FindResource("error_compareFailed") as string);
            }
        }