private void Client_DataRecieved(object sender, SimpleTCP.Message e) { if (e.MessageString.Equals("Proceed")) { ActiveForm.Invoke((MethodInvoker) delegate() { this.Hide(); //c.deconnecter();//close connection Form1 f = new Form1(client); f.Show();//open second form }); } }
private void ReadFilterSendThreadMain() { if (ListBoxFeeds.Items.Count > 0) { tags.Clear(); tags = TextBoxTags.Text.Split(' ').ToList(); Links.Clear(); ControlClient client = new ControlClient(); SynItems items = client.ProcessFeeds(ListBoxFeeds.Items.Cast <string>().ToArray(), tags.ToArray(), ListBoxRecipients.Items.Cast <string>().ToArray()); client.Close(); ListBoxFeedItems.Invoke(new Action(() => ListBoxFeedItems.Items.Clear())); ListBoxFeedItems.Invoke(new Action(() => ListBoxFeedItems.Items.AddRange(items.Titles.ToArray()))); Links.AddRange(items.Links); MainTimer.Stop(); MainTimer.Interval = (double)(1000 * 60 * (NumericUpDownMinutes.Value + NumericUpDownHours.Value * 60 + NumericUpDownDays.Value * 60 * 24)); MainTimer.Start(); ActiveForm?.Invoke(new Action(() => ActiveForm.Text = "Mail sent at " + DateTime.Now)); } }
private async void FormMailTrigger_Load(object sender, EventArgs e) { MailTrigerHide = false; await Task.Run(() => { byte n = 1; while (true) { Thread.Sleep(600); if (ActiveForm != null) { ActiveForm.Invoke(new Action(() => l_autorization.Text += ".")); ++n; if (n >= 4) { ActiveForm.Invoke(new Action(() => l_autorization.Text = "log in")); n = 0; } } } }); }