示例#1
0
 private void UpdateList(object sender, VideoChatContact e)
 {
     foreach (var con in contacts)
     {
         if (con.UserName.Equals(e.Username))
         {
             con.IsOnline = e.IsOnline;
         }
     }
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="modulProperties"></param>
        public VideoChatModule() : base(new VideoChatProperties())
        {
            _view = new VideoChatModuleView(this);

            ///init the Session field with informations from VideoChatProperties
            _session = new Session(Context.Instance, GetProperties().GetProperty(GetProperties().Key_API_KEY, "no api key"), GetProperties().GetProperty(GetProperties().Key_SESSION_ID, "no session id"));


            _session.Connected      += Session_Connected;
            _session.Disconnected   += Session_Disconnected;
            _session.Error          += Session_Error;
            _session.StreamReceived += Session_StreamReceived;
            _session.StreamDropped  += Session_StreamDropped;


            IDatabaseConnection             db      = (IDatabaseConnection)SurrogateFramework.MainController.ConnectionHandler.GetConnection(FrameworkConstants.DatabaseName);
            IDictionary <string, SqlDbType> columns = new Dictionary <string, SqlDbType>
            {
                { "ID", SqlDbType.Int },
                { "username", SqlDbType.Text },
                { "Firstname", SqlDbType.Text },
                { "Name", SqlDbType.Text }
            };

            try
            {
                SqlDataReader resultsReader = db.ExecuteQuery(String.Format("SELECT * FROM {0}", VideoChatProperties.TableName));
                if (resultsReader.HasRows)
                {
                    while (resultsReader.Read())
                    {
                        var contact = new VideoChatContact(resultsReader.GetInt32(0), resultsReader.GetString(1), resultsReader.GetString(2), resultsReader.GetString(3));
                        _availableContacts.Add(contact.Username, contact);
                    }
                }
                resultsReader.Close();
            }
            catch (Exception sqlException)
            {
                _availableContacts.Add("simonjw", new VideoChatContact(1, "simonjw", "simon", "wimmer"));
                _availableContacts.Add("drmueller", new VideoChatContact(2, "drmueller", "Dr. Hans", "Mueller"));
                MessageBox.Show("Es konnten keine Kontakte aus der Datenbanktabelle geladen werden. Beispieldaten wurden eingefügt.", "Fehler in Datenbankverbindung");
                log.Debug(sqlException.Message);
            }

            InvokeContactData();
        }
示例#3
0
 private void FillList(object sender, VideoChatContact e)
 {
     contacts.Add(new VideoChatItem(e));
 }