public void show(MainWindow con, ListBox lb, string kto, string text, int tem) { if (!lb.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { UserWiad itm = new UserWiad(); itm.Nick = kto; itm.Wiad = text; itm.Typ = tem; lb.Items.Add(itm); lb.ScrollIntoView(itm); }); } else { UserWiad itm = new UserWiad(); itm.Nick = kto; itm.Wiad = text; itm.Typ = tem; lb.Items.Add(itm); lb.ScrollIntoView(itm); } }
public void text(MainWindow con, TextBox tbw, ListBox lb, bool wart) { if (!tbw.CheckAccess() && !lb.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { Visibility stan; if (wart == true) stan = System.Windows.Visibility.Hidden; else stan = System.Windows.Visibility.Visible; lb.Visibility = stan; if (wart == false) stan = System.Windows.Visibility.Hidden; else stan = System.Windows.Visibility.Visible; tbw.Visibility = stan; }); } else { Visibility stan; if (wart == true) stan = System.Windows.Visibility.Hidden; else stan = System.Windows.Visibility.Visible; lb.Visibility = stan; if (wart == false) stan = System.Windows.Visibility.Hidden; else stan = System.Windows.Visibility.Visible; tbw.Visibility = stan; } }
public Packets(Label tssl, MainWindow c, Dictionary<string, dynamic> val, String ver) { ibox = new InfoBox(); tsslInfo = tssl; con = c; values = val; wersja = ver; }
public StartClient(MainWindow c, Panel panel1, Panel panel2) { panel = new HidePanel(con, panel1, panel2); log = new Log(); con = c; //thread = th; }
public Loader(MainWindow c, TcpClient tcpc, Stream stm, Label tssl) { ibox = new InfoBox(); log = new Log(); con = c; tcpclnt = tcpc; stream = stm; tsslInfo = tssl; }
public FriendsChanger(MainWindow c, ListView lv, TcpClient tcpc, Stream stm, Label tssl) { lvZnajomi = lv; con = c; tcpclnt = tcpc; stream = stm; tsslInfo = tssl; loader = new Loader(con, tcpclnt, stream, tsslInfo); }
public void writeInfo(MainWindow con, Label tsslInfo, string text) { if (!tsslInfo.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { tsslInfo.Content = text; }); } else tsslInfo.Content = text; }
public void write(MainWindow con, TextBox tbWiad, string text) { if (!tbWiad.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { tbWiad.Text += text + Environment.NewLine; }); } else tbWiad.Text += text + Environment.NewLine; }
public void clear(MainWindow con, ListView lv) { if (!lv.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { lv.Items.Clear(); }); } else { lv.Items.Clear(); } }
public void check(string str, string wersja, MainWindow con) { if (str != wersja) { if (!con.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { con.Hide(); }); } else con.Hide(); MessageBox.Show("Wersja chatu jest nieaktualna!", "Wymagany update"); //tcpclnt.Close(); Environment.Exit(0); } }
public void fill(MainWindow con, TextBox tdo, string str) { if (!con.CheckAccess()) { con.Dispatcher.Invoke(DispatcherPriority.Send, (Action)delegate { if (tdo.Text == "") { tdo.Text = str; } }); } else { if (tdo.Text == "") { tdo.Text = str; } } }
public void switch_(MainWindow con, String typ, Label tsslInfo, Dictionary<String, dynamic> values, String wersja, HidePanel panel, Loader loader, StartClient client, String ip_adress, Action nasluch, Button btnLoguj, ListBox lbWiadomosci, TextBox tbDo, TextBox tbWiad, ListView lvZnajomi, NewTextMessage ntmess, NewMessage mess, FriendsChanger fchanger, System.Media.SoundPlayer player) { Packets packet = new Packets(tsslInfo, con, values, wersja); switch (typ) { //POLACZENIE I ZAPYTANIE O LOGOWANIE case "serv1": packet.serv1(); break; //LOGOWANIE case "l1": ibox.writeInfo(con, tsslInfo, "Zalogowano"); panel.hide(true); loader.loadMessages(); break; case "l2": MessageBox.Show("Ktoś był zalogowany! " + Environment.NewLine + " Trwa zamykanie poprzedniej sesji " + Environment.NewLine + "i wykonywanie ponownego połączenia do serwera."); client.reconnect(ip_adress, nasluch, tsslInfo, btnLoguj); //tcpclnt1 = client.retClient(); break; case "l3": ibox.writeInfo(con, tsslInfo, "Nieprawidłowe dane lub login nie istnieje"); break; case "l4": ibox.writeInfo(con, tsslInfo, "Jesteś już zalogowany!"); break; //WIADOMOSCI case "wiad": packet.wiad(ntmess, mess, player, tbWiad, lbWiadomosci, tbDo); //client.reconnect(ip_adress, nasluch, tsslInfo, btnLoguj); //tcpclnt1 = client.retClient(); break; case "wiad2": packet.wiad2(ntmess, mess, tbWiad, lbWiadomosci); break; //INFO case "info1": packet.info1(ntmess, mess, tbWiad, lbWiadomosci); break; case "info2": ibox.writeInfo(con, tsslInfo, "Wiadomość wysłana!"); break; case "info3a": packet.info3a(loader, ntmess, mess, tbWiad, lbWiadomosci); break; case "info3b": ibox.writeInfo(con, tsslInfo, "Brak nowych wiadomości!"); loader.loadFriends(); break; case "znajomi": packet.znajomi(lvZnajomi, fchanger, loader); break; case "online": packet.online(ntmess, mess, tbWiad, lbWiadomosci, fchanger); break; case "wylacz": client.reconnect(ip_adress, nasluch, tsslInfo, btnLoguj); //tcpclnt1 = client.retClient(); break; default: ibox.writeInfo(con, tsslInfo, "Nieznany pakiet z serwera!" + typ); break; } }
public HidePanel(MainWindow c, Panel p1, Panel p2) { con = c; panel1 = p1; panel2 = p2; }