12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.IO;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using Flyinsono.Client.Test.Log;
- namespace Flyinsono.Client.Test
- {
- /// <summary>
- /// Interaction logic for MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- private MainWindowViewModel _mainWindowViewModel;
- public MainWindow()
- {
- var logEngine = new LogEngineImplement((s) =>
- {
- AddLog(s);
- });
- Logger.RegisterEngine(logEngine);
- AppManager.Instance.Initialize();
- _mainWindowViewModel = new MainWindowViewModel(RunOnMainDispatcher);
-
- InitializeComponent();
- DataContext = _mainWindowViewModel;
- }
- private void RunOnMainDispatcher(Action action)
- {
- App.MainDispatcher.Invoke(action);
- }
- private void AddLog(LogItem s)
- {
- Dispatcher.BeginInvoke(() =>
- {
- if (_mainWindowViewModel != null)
- {
- _mainWindowViewModel.LogItems.Add(s);
- }
- });
- }
- }
- }
|