예제 #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();
            });
        }
예제 #2
0
 public StatusViewModel(DeploymentManager manager)
 {
     _manager    = manager;
     _ipfsDaemon = _manager.Daemon;
     IpfsStatus  = "Idle";
     DnsStatus   = "Idle";
     _ipfsDaemon.OnStateChanged += _ipfsDaemon_OnStateChanged;
     _manager.OnDnsRetrieved    += _manager_OnDnsRetrieved;
 }
예제 #3
0
파일: IpFsApi.cs 프로젝트: treverson/prime
 public IpFsApi(DeploymentManager manager) : this(manager.Daemon)
 {
 }
예제 #4
0
 public IpFsDaemon(DeploymentManager manager) : this(manager.L, manager.Dispatcher)
 {
 }