public void AddUsers(object sender, EventArgs e) { UserEventArgs arg = (UserEventArgs)e; this.Dispatcher.BeginInvoke((ThreadStart) delegate() { ActiveUsers.Items.Add(arg.User_Name); UserSessionInfo.Add(Shifr.Coder(arg.User_Name + ": приєднався. " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + "\n")); }); }
public void AddInfoToSession(object sender, EventArgs e) { MessageEventArgs arg = (MessageEventArgs)e; this.Dispatcher.BeginInvoke((ThreadStart) delegate() { string[] str = arg.Message.Split(':'); int index = ActiveUsers.Items.IndexOf(arg.User_Name); if (index != -1) { UserSessionInfo[index] += Shifr.Coder(arg.Message) + "\n"; } if (ActiveUsers.SelectedIndex != -1) { UserSession.Text = UserSessionInfo[ActiveUsers.SelectedIndex]; } }); }