public MainWindow() { ViewModel.CMakeKits = CMakeKitsController.GetKits(); DataContext = ViewModel; InitializeComponent(); MyLogView.DataSource = new StepwiseLog(); MyLogView.DataSource.Steps.Add(new SpecificStepLog() { State = StepState.Success, Description = "欢迎使用", Content = new TextBlock() { TextWrapping = TextWrapping.Wrap, Text = Properties.Resources.Welcome } }); MyLogView.DataSource.Steps.Add(new SpecificStepLog() { State = StepState.Success, Description = "投喂区", Content = new Image() { Source = LoadImage(Properties.Resources.Donate), MaxWidth = 200 } }); MyLogView.DataSource.Steps.Add(new SpecificStepLog() { State = StepState.Success, Description = "许可证", Content = new TextBlock() { TextWrapping = TextWrapping.Wrap, Text = Properties.Resources.License } }); }
private void RescanCMakeKits_Click(object sender, RoutedEventArgs e) { try { new Thread(() => { MessageBox.Show("扫描过程可能出现无响应,请耐心等待1-2分钟的时间"); }).Start(); RescanCMakeKits.IsEnabled = false; DispatcherHelper.DoEvents(); CMakeKitsController.ScanKits(); ViewModel.CMakeKits = CMakeKitsController.GetKits(); ViewModel.CMakeKit = ViewModel.CMakeKits.FirstOrDefault(); } catch(Exception exception) { MessageBox.Show(this, $"扫描出错:{exception}", "扫描出错", MessageBoxButton.OK, MessageBoxImage.Error); } finally { RescanCMakeKits.IsEnabled = true; } }