예제 #1
0
        public ChatsViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService notificationsService, ChatList chatList, IChatFilter filter = null)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _notificationsService = notificationsService;

            _chatList = chatList;

            Items = new ItemsCollection(protoService, aggregator, this, chatList, filter);

            ChatPinCommand     = new RelayCommand <Chat>(ChatPinExecute);
            ChatArchiveCommand = new RelayCommand <Chat>(ChatArchiveExecute);
            ChatMarkCommand    = new RelayCommand <Chat>(ChatMarkExecute);
            ChatNotifyCommand  = new RelayCommand <Chat>(ChatNotifyExecute);
            ChatDeleteCommand  = new RelayCommand <Chat>(ChatDeleteExecute);
            ChatClearCommand   = new RelayCommand <Chat>(ChatClearExecute);
            ChatSelectCommand  = new RelayCommand <Chat>(ChatSelectExecute);

            ChatsMarkCommand    = new RelayCommand(ChatsMarkExecute);
            ChatsNotifyCommand  = new RelayCommand(ChatsNotifyExecute);
            ChatsArchiveCommand = new RelayCommand(ChatsArchiveExecute);
            ChatsDeleteCommand  = new RelayCommand(ChatsDeleteExecute);
            ChatsClearCommand   = new RelayCommand(ChatsClearExecute);

            ClearRecentChatsCommand = new RelayCommand(ClearRecentChatsExecute);

            TopChatDeleteCommand = new RelayCommand <Chat>(TopChatDeleteExecute);

#if MOCKUP
            Items.AddRange(protoService.GetChats(20));
#endif

            SelectedItems = new MvxObservableCollection <Chat>();
        }
예제 #2
0
        public ChatsViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator)
            : base(protoService, cacheService, aggregator)
        {
            Items = new ItemsCollection(protoService, aggregator, this);

            DialogPinCommand           = new RelayCommand <Chat>(DialogPinExecute);
            DialogNotifyCommand        = new RelayCommand <Chat>(DialogNotifyExecute);
            DialogDeleteCommand        = new RelayCommand <Chat>(DialogDeleteExecute);
            DialogClearCommand         = new RelayCommand <Chat>(DialogClearExecute);
            DialogDeleteAndStopCommand = new RelayCommand <Chat>(DialogDeleteAndStopExecute);

            aggregator.Subscribe(this);
            protoService.Send(new GetChats(long.MaxValue, 0, 20));

#if MOCKUP
            Items.AddRange(protoService.GetChats(20));
#endif
        }
예제 #3
0
        public ChatListViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService notificationsService, ChatList chatList)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _notificationsService = notificationsService;

            Items = new ItemsCollection(protoService, aggregator, this, chatList);

            SearchFilters = new MvxObservableCollection <ISearchChatsFilter>();

            ChatOpenCommand    = new RelayCommand <Chat>(ChatOpenExecute);
            ChatPinCommand     = new RelayCommand <Chat>(ChatPinExecute);
            ChatArchiveCommand = new RelayCommand <Chat>(ChatArchiveExecute);
            ChatMarkCommand    = new RelayCommand <Chat>(ChatMarkExecute);
            ChatNotifyCommand  = new RelayCommand <Chat>(ChatNotifyExecute);
            ChatMuteForCommand = new RelayCommand <Tuple <Chat, int?> >(ChatMuteForExecute);
            ChatDeleteCommand  = new RelayCommand <Chat>(ChatDeleteExecute);
            ChatClearCommand   = new RelayCommand <Chat>(ChatClearExecute);
            ChatSelectCommand  = new RelayCommand <Chat>(ChatSelectExecute);

            ChatsMarkCommand    = new RelayCommand(ChatsMarkExecute);
            ChatsNotifyCommand  = new RelayCommand(ChatsNotifyExecute);
            ChatsArchiveCommand = new RelayCommand(ChatsArchiveExecute);
            ChatsDeleteCommand  = new RelayCommand(ChatsDeleteExecute);
            ChatsClearCommand   = new RelayCommand(ChatsClearExecute);

            FolderAddCommand    = new RelayCommand <(int, Chat)>(FolderAddExecute);
            FolderRemoveCommand = new RelayCommand <(int, Chat)>(FolderRemoveExecute);
            FolderCreateCommand = new RelayCommand <Chat>(FolderCreateExecute);

            ClearRecentChatsCommand = new RelayCommand(ClearRecentChatsExecute);

            TopChatDeleteCommand = new RelayCommand <Chat>(TopChatDeleteExecute);

#if MOCKUP
            Items.AddRange(protoService.GetChats(null));
#endif

            SelectedItems = new MvxObservableCollection <Chat>();
        }