예제 #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                return;
            }
            //OnUpdateStyles();

            //TODO: replace hard-coded config
            JabberSession = new JabberSession(Dispatcher.CurrentDispatcher);
            ConferencesModels = new ObservableCollection<ConferenceViewModel>();
            JabberSession.BeginAuthentication(new ConnectionConfig
                                                    {
                                                        User = "******",
                                                        Server = "jabber.uruchie.org",
                                                        Password = "******"
                                                    });

            JabberSession.Conferences.Add(new JID("main", "conference.jabber.uruchie.org", "CIA"));
            JabberSession.Conferences.Add(new JID("cyclops", "conference.jabber.uruchie.org", "CIA2"));
            JabberSession.Conferences.Add(new JID("CIA", "conference.jabber.uruchie.org", "CIA2"));
            JabberSession.Conferences.Add(new JID("support", "conference.jabber.uruchie.org", "CIA2"));
            JabberSession.Conferences.SynchronizeWith(ConferencesModels, conference => new ConferenceViewModel(conference));

            UpdateStyles = new RelayCommand(OnUpdateStyles);
        }
예제 #2
0
        public ConferenceViewModel(Conference conference)
        {
            Conference = conference;
            Conference.Banned += new System.EventHandler<Core.Model.CustomEventArgs.BannedEventArgs>(Conference_Banned);
            Conference.Kicked += new System.EventHandler<Core.Model.CustomEventArgs.KickedEventArgs>(Conference_Kicked);
            Conference.Disconnected += new System.EventHandler<Core.Model.CustomEventArgs.DisconnectEventArgs>(Conference_Disconnected);

            Messages = new ObservableCollection<MessageViewModel>();
            Conference.Messages.SynchronizeWith(Messages, msg => new MessageViewModel(msg));

            SendMessage = new RelayCommand(OnSendMessage, () => !string.IsNullOrEmpty(CurrentlyTypedMessage));
        }