Ejemplo n.º 1
0
        private void OnPopConnectionClosed(bool CleanShutdown)
        {
            ButtonConnectPop.Invoke(new Action(() =>
            {
                IsPopRunning = false;
                if (!CleanShutdown)
                {
                    ButtonConnectPop.Enabled = true;
                    TimerPopRefresh.Stop();
                    ButtonConfig.Enabled = true;
                }

                ButtonConnectPop.Text = CleanShutdown
                ? "Waiting..."
                : "Start client";

                ListboxLog.Items.Add(CleanShutdown
                    ? "-- connection ended --"
                    : "-- connection failed --");
                ListboxLog.Items.Add("Messages received in this ping: " + FetchMessageCounter.ToString());
                ListboxLog.SelectedIndex = ListboxLog.Items.Count - 1;
                if (FetchMessageCounter > 0)
                {
                    MessageBox.Show("You have " + FetchMessageCounter.ToString() + " new messages!");
                }
            }));
        }
Ejemplo n.º 2
0
 private void EnableService()
 {
     ButtonConfig.Enabled = false;
     NewMessageCounter    = 0;
     if (StartConnection())
     {
         TimerPopRefresh.Interval = (int)(Service.GetConfig().RefreshRateSeconds * 1000);
         TimerPopRefresh.Start();
     }
 }
Ejemplo n.º 3
0
 private void DisableService()
 {
     Invoke(new Action(() =>
     {
         if (IsPopRunning)
         {
             Service.RequestStopService();
         }
         ButtonConnectPop.Text = "Start client";
         TimerPopRefresh.Stop();
         ButtonConfig.Enabled = true;
         ListboxLog.Items.Add("Inbox refresh disabled. Messages received since service started: " + NewMessageCounter.ToString());
         ListboxLog.SelectedIndex = ListboxLog.Items.Count - 1;
     }));
 }