Beispiel #1
0
        public RosterViewModel()
        {
            _model = new RosterModel(new HistoryStorage());
            _model.MessageReceived   += _model_MessageReceived;
            _model.StatusChanged     += _model_StatusChanged;
            _model.StatisticsUpdated += _model_StatisticsUpdated;

            DblClick  = new DelegateCommand(p => DoDblClick());
            OpenFonts = new DelegateCommand(p => DoOpenFonts());
            OpenBasicConfiguration = new DelegateCommand(p => DoOpenBasicConfiguration());
            OpenUser              = new DelegateCommand(p => DoOpenUser());
            Exit                  = new DelegateCommand(p => App.Current.Shutdown());
            CheckUpdates          = new DelegateCommand(p => DoCheckUpdates());
            OpenAbout             = new DelegateCommand(p => DoOpenAbout());
            Closed                = new DelegateCommand(p => DoClosed(p));
            SourceInitialized     = new DelegateCommand(p => DoSourceInitialized(p));
            ContactFavorite       = new DelegateCommand(p => DoContactFavorite());
            ContactUnFavorite     = new DelegateCommand(p => DoContactUnFavorite());
            ContactRemove         = new DelegateCommand(p => DoContactRemove());
            ContactRemoveAndClear = new DelegateCommand(p => DoContactRemoveAndClear());
            Hide                  = new DelegateCommand(p => DoHide(p));

            // Запускаем потоки
            _model.Start();

            AppTray.Show         += AppTray_Show;
            AppTray.Toggle       += AppTray_Toggle;
            AppTray.About        += AppTray_About;
            AppTray.CheckUpdates += AppTray_CheckUpdates;
            AppTray.OpenWindow   += AppTray_OpenWindow;
        }
Beispiel #2
0
        public ChatViewModel(IRosterModel model, Contact contact)
        {
            _model = model;

            ChatContact = contact;

            DisplayFromHistory(true);

            Paste        = new DelegateCommand(p => DoPaste());
            Encrypt      = new DelegateCommand(p => DoEncrypt());
            Send         = new DelegateCommand(p => DoSend());
            Find         = new DelegateCommand(p => DoFind());
            Print        = new DelegateCommand(p => DoPrint());
            NewLine      = new DelegateCommand(p => DoNewLine());
            Tag          = new DelegateCommand(p => DoTag(p));
            Smile        = new DelegateCommand(p => DoSmile());
            Quote        = new DelegateCommand(p => DoQuote(p));
            Attach       = new DelegateCommand(p => DoAttach());
            Close        = new DelegateCommand(p => DoClose(p));
            History      = new DelegateCommand(p => DoHistory());
            Activated    = new DelegateCommand(p => DoActivated(p));
            Deactivated  = new DelegateCommand(p => DoDeactivated(p));
            StateChanged = new DelegateCommand(p => DoStateChanged(p));
            Closed       = new DelegateCommand(p => DoClosed(p));
            Loaded       = new DelegateCommand(p => DoLoaded(p));

            _smilePopupIsOpen = false;

            _smileList = new List <Image>();
            if (!Settings.IsDesign)
            {
                foreach (var smiley in Settings.SmileysSelector)
                {
                    Image image = new Image();
                    image.Tag = smiley.Value;
                    XamlAnimatedGif.AnimationBehavior.SetSourceUri(
                        image,
                        new Uri(Path.Combine(Settings.SmileysLocation, smiley.Key)));

                    _smileList.Add(image);
                }
            }

            _textOutgoing = "";
        }
 public ChatView(IRosterModel model, Contact contact)
 {
     InitializeComponent();
     DataContext = new ChatViewModel(model, contact);
 }