private void Load_Mails(MailClient client) { if (!client.IsConnected) { return; } Loads++; string[][] Mails = client.Load_Mail_List(); if (Mails != null) { m_dbConnection.Open(); foreach (string[] Mail in Mails) { SQLiteCommand insertSQL = new SQLiteCommand("INSERT INTO MailList (MessageId, Receiver, Sender, Date, Subject, Container) VALUES ('" + Mail[0] + "','" + client.Client_Mail + "','" + Mail[1] + "','" + Mail[2] + "','" + Mail[3] + "','Inbox')", m_dbConnection); try { insertSQL.ExecuteNonQuery(); } catch { } } m_dbConnection.Close(); } App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { client.MailListMap_Selected(client.HeadUser.SelectedItem, new RoutedEventArgs()); })); Loads--; }
/// <summary> /// Load Clients form Properties.Settings /// </summary> private void Load_Clients() { if (String.IsNullOrEmpty(Properties.Settings.Default.Users) || String.IsNullOrEmpty(Properties.Settings.Default.Password)) { return; } MailClient newclient = new MailClient(Properties.Settings.Default.Users, Properties.Settings.Default.Password, Properties.Settings.Default.Pop3, Properties.Settings.Default.Port, Properties.Settings.Default.UseSsl); ClientPanel.Children.Add(newclient); }
private void Loader_DoWork(object sender, DoWorkEventArgs e) { dispatcherTimer.Stop(); App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate(){ foreach (MailClient obj in Main_Window.ClientPanel.Children) { if (obj is MailClient) { MailClient client = obj as MailClient; ThreadStart processTaskThread = delegate { Load_Mails(client); }; Thread thread = new Thread(processTaskThread); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } } })); Thread.Sleep(0300); dispatcherTimer.Start(); }
private void Load_Mails(MailClient client) { if (!client.IsConnected) return; Loads++; string[][] Mails = client.Load_Mail_List(); if (Mails != null) { m_dbConnection.Open(); foreach (string[] Mail in Mails) { SQLiteCommand insertSQL = new SQLiteCommand("INSERT INTO MailList (MessageId, Receiver, Sender, Date, Subject, Container) VALUES ('" + Mail[0] + "','" + client.Client_Mail + "','" + Mail[1] + "','" + Mail[2] + "','" + Mail[3] + "','Inbox')", m_dbConnection); try { insertSQL.ExecuteNonQuery(); } catch { } } m_dbConnection.Close(); } App.Current.Dispatcher.Invoke(DispatcherPriority.Normal, new Action(delegate() { client.MailListMap_Selected(client.HeadUser.SelectedItem, new RoutedEventArgs()); })); Loads--; }
/// <summary> /// Load Clients form Properties.Settings /// </summary> private void Load_Clients() { if (String.IsNullOrEmpty(Properties.Settings.Default.Users) || String.IsNullOrEmpty(Properties.Settings.Default.Password)) return; MailClient newclient = new MailClient(Properties.Settings.Default.Users, Properties.Settings.Default.Password, Properties.Settings.Default.Pop3, Properties.Settings.Default.Port, Properties.Settings.Default.UseSsl); ClientPanel.Children.Add(newclient); }