Exemplo n.º 1
0
        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();
            });
        }
Exemplo n.º 2
0
 public StatusViewModel(DeploymentManager manager)
 {
     _manager    = manager;
     _ipfsDaemon = _manager.Daemon;
     IpfsStatus  = "Idle";
     DnsStatus   = "Idle";
     _ipfsDaemon.OnStateChanged += _ipfsDaemon_OnStateChanged;
     _manager.OnDnsRetrieved    += _manager_OnDnsRetrieved;
 }
Exemplo n.º 3
0
 public IpFsApi(DeploymentManager manager) : this(manager.Daemon)
 {
 }
Exemplo n.º 4
0
 public IpFsDaemon(DeploymentManager manager) : this(manager.L, manager.Dispatcher)
 {
 }