Exemple #1
0
        public MainWindow()
        {
            InitializeComponent();

            Title = "prime pub [alpha " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version + "] - decentralised bootstrapper [ipfs]";

            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 pc = PublishManagerContext.LoadDefault(Dispatcher.CurrentDispatcher);

            if (pc == null)
            {
                logger.Error("Configuration not found.");
                return;
            }

            pc.L = logger;
            var dom = AppDomain.CurrentDomain;

            dom.UnhandledException +=
                (o, args) => dispatcher.Invoke(() => nativeLogger.Invoke("Fatal (app domain): " + (args.ExceptionObject as Exception)?.Message));

            Application.Current.DispatcherUnhandledException +=
                (o, args) => dispatcher.Invoke(() => nativeLogger.Invoke("Fatal (app): " + args.Exception.Message));

            _manager = new PublishManager(pc);

            DataContext = _statusViewModel = new StatusViewModel(_manager);

            Prime.Click   += Prime_Click;
            Radiant.Click += Radiant_Click;
            Both.Click    += Both_Click;
        }
Exemple #2
0
 public SshApi(PublishManagerContext context)
 {
     _context = context;
 }