private void MainWindow_Loaded(object sender, RoutedEventArgs e) { var dispatcher = Dispatcher; Action <string> nativeLogger = (Terminal.DataContext as TerminalViewModel).AddItem; var logger = Logging.I.DefaultLogger; DefaultMessenger.I.Default.Register <NewLogMessage>(this, m => { dispatcher.Invoke(() => nativeLogger.Invoke(LanguageCorrection(m.Message))); }); var manager = new DeploymentManager(dispatcher, logger, () => { dispatcher.Invoke(() => WindowState = WindowState.Normal); }); DataContext = new StatusViewModel(manager); var dom = AppDomain.CurrentDomain; dom.UnhandledException += (o, args) => dispatcher.Invoke(() => nativeLogger.Invoke("Fatal (dom): " + (args.ExceptionObject as Exception)?.Message)); Application.Current.DispatcherUnhandledException += (o, args) => dispatcher.Invoke(() => nativeLogger.Invoke("Fatal (app): " + args.Exception.Message)); ThreadPool.QueueUserWorkItem(w => { manager.Bootstrap(); }); }
public StatusViewModel(DeploymentManager manager) { _manager = manager; _ipfsDaemon = _manager.Daemon; IpfsStatus = "Idle"; DnsStatus = "Idle"; _ipfsDaemon.OnStateChanged += _ipfsDaemon_OnStateChanged; _manager.OnDnsRetrieved += _manager_OnDnsRetrieved; }
public IpFsApi(DeploymentManager manager) : this(manager.Daemon) { }
public IpFsDaemon(DeploymentManager manager) : this(manager.L, manager.Dispatcher) { }