Ejemplo n.º 1
0
        private async void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            IPC.ProviderStatus status = null;

            await Task.Run(() => {
                bool busy = !app.ipclock.WaitOne(300);
                if (!busy)
                {
                    status = app.ipc.Status();
                    app.SetServiceStatus(status);
                    app.ipclock.Release();
                }
            });

            // show login success or error notification after the user has clicked on Connect
            if (notifyLogin && status != null)
            {
                if (status.providerStatus != IPC.ProviderStatus.WaitConfig)
                {
                    if (status.providerStatus == IPC.ProviderStatus.LoggedIn)
                    {
                        Info(strings.provider_logged_in);
                    }
                    else if (status.providerStatus == IPC.ProviderStatus.ErrorUserPin)
                    {
                        Error(strings.provider_error_userpin);
                    }
                    else
                    {
                        Error(strings.provider_error_login);
                    }
                    notifyLogin = false;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Callback for the periodic Status command
        /// </summary>
        /// <param name="status">Status returned by the service</param>
        public void OnStatusRefresh(IPC.ProviderStatus status)
        {
            string s = tray.Resources.strings.ipc_error;

            if (status != null)
            {
                if (status.status != IPC.ResponseStatus.Error)
                {
                    IPC.ProviderStatus.providerStatusMessages.TryGetValue(status.providerStatus, out s);
                }
            }
            lblStatus.Text = s;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Send status information received from the service to all open windows
 /// </summary>
 /// <param name="val">service status response</param>
 public void SetServiceStatus(IPC.ProviderStatus val)
 {
     if (val == null)
     {
         return;
     }
     status = val;
     lock (wndlock) {
         if (wndFilterRules != null && wndFilterRules.IsVisible)
         {
             wndFilterRules.Dispatcher.InvokeAsync(
                 new Action(delegate { wndFilterRules.OnStatusRefresh(status); }));
         }
         if (wndCubeSelect != null && wndCubeSelect.IsVisible)
         {
             wndCubeSelect.Dispatcher.InvokeAsync(
                 new Action(delegate { wndCubeSelect.OnStatusRefresh(status); }));
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Callback for the periodic Status command
        /// </summary>
        /// <param name="status">Status returned by the service</param>
        public void OnStatusRefresh(IPC.ProviderStatus status)
        {
            bool   IsLoggedIn_ = false;
            string s           = tray.Resources.strings.ipc_error;

            if (status != null)
            {
                if (status.status == IPC.ResponseStatus.Error)
                {
                    btnConnect.IsEnabled    = false;
                    btnDisconnect.IsEnabled = false;
                }
                else
                {
                    IPC.ProviderStatus.providerStatusMessages.TryGetValue(status.providerStatus, out s);
                    if (status.providerStatus == IPC.ProviderStatus.LoggedIn)
                    {
                        IsLoggedIn_ = true;
                    }
                    // enable or disable the connect and disconnect buttons
                    if (status.providerType == IPC.ProviderType.Soft)
                    {
                        btnDisconnect.IsEnabled = false;
                        btnConnect.IsEnabled    = false;
                    }
                    else if (status.providerType == IPC.ProviderType.SE3 ||
                             status.providerType == IPC.ProviderType.SECube)
                    {
                        btnDisconnect.IsEnabled = IsLoggedIn_;
                        btnConnect.IsEnabled    = !IsLoggedIn_;
                    }
                }
            }
            IsLoggedIn     = IsLoggedIn_;
            lblStatus.Text = s;
        }