示例#1
0
        async void UpdateApiStatus()
        {
            ApiMonitorResponse status = await apiClient.GetStatus();

            if (ApiOnline = status != null)
            {
                NameCoinOnline   = status.Nmc;
                NameServerOnline = status.Ns;
                LastBlockTime    = status.LastBlockTime;
                Logging          = status.Logging;
                LogFolder        = status.LogFolder;
                dotBitNsVersion  = status.Version;
            }
            if (!NameCoinOnline)
            {
                if (namecoinofflinecounter++ > NamecoinConfigInterval)
                {
                    namecoinofflinecounter = 0;
                    NmcConfigSettings.ValidateNmcConfig();
                    SendConfig(new NmcConfigJson()
                    {
                        User    = NmcConfigSettings.RpcUser,
                        Pass    = NmcConfigSettings.RpcPass,
                        Port    = NmcConfigSettings.RpcPort,
                        Logging = Logging.ToString(),
                    });
                }
            }
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();

            Title = AppName + " Monitor";
            lblServiceName.Content = AppName + " Service";
            lblAPIName.Content     = AppName + " API";

            serviceMonitor = new ServiceMonitor();
            serviceMonitor.OnStatusUpdated += serviceMonitor_OnStatusUpdated;
            serviceMonitor.SystemGoChanged += serviceMonitor_SystemGoChanged;

            productInfoManager = new ProductInfoManager();

            ConfigFile.ConfigUpdated      += NmcConfigSetter_ConfigUpdated;
            ConfigFile.NamecoinConfigInfo += NmcConfigSettings_NameCoinConfigInfo;
            NmcConfigSettings.ValidateNmcConfig();

            Program.OnAdditionalInstanceSignal += OnRequestShow;

            this.Closing += MainWindow_Closing;
            this.Closed  += MainWindow_Closed;

            this.StateChanged += MainWindow_StateChanged;

            MyNotifyIcon.DoubleClickCommandParameter = MyNotifyIcon;


            this.Loaded += MainWindow_Loaded;
        }