Пример #1
0
        private void SaveSettings(object sender, EventArgs e)
        {
            if (this.DialogResult == DialogResult.OK)
            {
                Properties.Settings.Default.IP  = txt_ip.Text;
                Properties.Settings.Default.INT = Convert.ToInt32(txt_int.Text);
                Properties.Settings.Default.Save();

                AsyncClient client = new AsyncClient();
                client.StartClient();
            }
        }
 async void EventLoop()
 {
     while (true)
     {
         if (!configWindow.Visible)
         {
             try
             {
                 AsyncClient client = new AsyncClient();
                 client.StartClient();
                 await Task.Delay(Properties.Settings.Default.INT * 500);
             }
             catch
             {
                 MessageBox.Show("Connection Error\nCheck Network\n\n", "Network Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
                 configWindow.ShowDialog();
                 configWindow.Focus();
             }
         }
     }
 }