public SettingsEmojiSetView(IProtoService protoService, IEmojiSetService emojiSetService, IEventAggregator aggregator)
        {
            this.InitializeComponent();

            _protoService = protoService;
            _aggregator   = aggregator;

            Title               = "Emoji Set";
            PrimaryButtonText   = Strings.Resources.OK;
            SecondaryButtonText = Strings.Resources.Cancel;

#if DEBUG
            CloseButtonText   = "Reset";
            CloseButtonClick += (s, args) =>
            {
                args.Cancel = true;

                foreach (var item in List.ItemsSource as ItemsCollection)
                {
                    if (item.IsOfficial)
                    {
                        continue;
                    }

                    _protoService.Send(new DeleteFileW(item.Document.Id));
                    _protoService.Send(new DeleteFileW(item.Thumbnail.Id));
                }
            };
#endif

            _aggregator.Subscribe(this);
            List.ItemsSource = _collection = new ItemsCollection(emojiSetService);
        }
        public SettingsAppearanceViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IThemeService themeService, IEmojiSetService emojiSetService)
            : base(protoService, cacheService, settingsService, aggregator, themeService)
        {
            _emojiSetService = emojiSetService;

            DistanceUnitsCommand = new RelayCommand(DistanceUnitsExecute);
            EmojiSetCommand      = new RelayCommand(EmojiSetExecute);
        }
示例#3
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService pushService, IContactsService contactsService, IVibrationService vibrationService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoIPService voipService, ISettingsSearchService settingsSearchService, IEmojiSetService emojiSetService, IPlaybackService playbackService, IShortcutsService shortcutService)
            : base(protoService, cacheService, settingsService, aggregator)
#endif
        {
            _pushService      = pushService;
            _contactsService  = contactsService;
            _vibrationService = vibrationService;
            _passcodeService  = passcodeService;
            _lifetimeService  = lifecycle;
            _sessionService   = session;
            _voipService      = voipService;
            _emojiSetService  = emojiSetService;
#if CLOUDUPDATES
            _cloudUpdateService = cloudUpdateService;
#endif
            _playbackService = playbackService;
            _shortcutService = shortcutService;

            Filters = new ChatFilterCollection();

            Chats         = new ChatsViewModel(protoService, cacheService, settingsService, aggregator, pushService, new ChatListMain());
            ArchivedChats = new ChatsViewModel(protoService, cacheService, settingsService, aggregator, pushService, new ChatListArchive());
            Contacts      = new ContactsViewModel(protoService, cacheService, settingsService, aggregator, contactsService);
            Calls         = new CallsViewModel(protoService, cacheService, settingsService, aggregator);
            Settings      = new SettingsViewModel(protoService, cacheService, settingsService, aggregator, settingsSearchService);

            // This must represent pivot tabs
            Children.Add(Chats);
            Children.Add(Contacts);
            Children.Add(Calls);
            Children.Add(Settings);

            // Any additional child
            Children.Add(ArchivedChats);
            Children.Add(_voipService as TLViewModelBase);

            aggregator.Subscribe(this);

            ReturnToCallCommand = new RelayCommand(ReturnToCallExecute);

            ToggleArchiveCommand = new RelayCommand(ToggleArchiveExecute);

            CreateSecretChatCommand = new RelayCommand(CreateSecretChatExecute);

            SetupFiltersCommand = new RelayCommand(SetupFiltersExecute);
#if CLOUDUPDATES
            UpdateAppCommand = new RelayCommand(UpdateAppExecute);
#endif
            FilterEditCommand       = new RelayCommand <ChatFilterViewModel>(FilterEditExecute);
            FilterAddCommand        = new RelayCommand <ChatFilterViewModel>(FilterAddExecute);
            FilterMarkAsReadCommand = new RelayCommand <ChatFilterViewModel>(FilterMarkAsReadExecute);
            FilterDeleteCommand     = new RelayCommand <ChatFilterViewModel>(FilterDeleteExecute);
        }
        public SettingsAppearanceViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IThemeService themeService, IEmojiSetService emojiSetService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _themeService    = themeService;
            _emojiSetService = emojiSetService;

            ChatThemes = new ObservableCollection <ChatTheme>();

            EmojiSetCommand = new RelayCommand(EmojiSetExecute);

            ThemeCreateCommand = new RelayCommand <ChatTheme>(ThemeCreateExecute);
        }
        public SettingsEmojiSetPopup(IProtoService protoService, IEmojiSetService emojiSetService, IEventAggregator aggregator)
        {
            InitializeComponent();

            _protoService = protoService;
            _aggregator   = aggregator;

            Title               = "Emoji Set";
            PrimaryButtonText   = Strings.Resources.OK;
            SecondaryButtonText = Strings.Resources.Cancel;

            List.ItemsSource = _collection = new ItemsCollection(emojiSetService);
        }
示例#6
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService pushService, IContactsService contactsService, IVibrationService vibrationService, ILiveLocationService liveLocationService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoIPService voipService, ISettingsSearchService settingsSearchService, IEmojiSetService emojiSetService, IPlaybackService playbackService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _pushService         = pushService;
            _contactsService     = contactsService;
            _vibrationService    = vibrationService;
            _liveLocationService = liveLocationService;
            _passcodeService     = passcodeService;
            _lifetimeService     = lifecycle;
            _sessionService      = session;
            _voipService         = voipService;
            _emojiSetService     = emojiSetService;
            _playbackService     = playbackService;

            Chats         = new ChatsViewModel(protoService, cacheService, settingsService, aggregator, pushService, new ChatListMain());
            ArchivedChats = new ChatsViewModel(protoService, cacheService, settingsService, aggregator, pushService, new ChatListArchive());
            Contacts      = new ContactsViewModel(protoService, cacheService, settingsService, aggregator, contactsService);
            Calls         = new CallsViewModel(protoService, cacheService, settingsService, aggregator);
            Settings      = new SettingsViewModel(protoService, cacheService, settingsService, aggregator, pushService, contactsService, settingsSearchService);

            // This must represent pivot tabs
            Children.Add(Chats);
            Children.Add(Contacts);
            Children.Add(Calls);
            Children.Add(Settings);

            // Any additional child
            Children.Add(ArchivedChats);
            Children.Add(_voipService as TLViewModelBase);

            aggregator.Subscribe(this);

            LiveLocationCommand     = new RelayCommand(LiveLocationExecute);
            StopLiveLocationCommand = new RelayCommand(StopLiveLocationExecute);

            ReturnToCallCommand = new RelayCommand(ReturnToCallExecute);

            ToggleArchiveCommand = new RelayCommand(ToggleArchiveExecute);
        }
示例#7
0
 public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService pushService, IContactsService contactsService, IVibrationService vibrationService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoIPService voipService, ISettingsSearchService settingsSearchService, IEmojiSetService emojiSetService, ICloudUpdateService cloudUpdateService, IPlaybackService playbackService, IShortcutsService shortcutService)
     : base(protoService, cacheService, settingsService, aggregator)
 public ItemsCollection(IEmojiSetService emojiSetService)
 {
     _emojiSetService = emojiSetService;
 }
示例#9
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IStorageService storageService, IEventAggregator aggregator, INotificationsService pushService, IContactsService contactsService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoipService voipService, IGroupCallService groupCallService, ISettingsSearchService settingsSearchService, IEmojiSetService emojiSetService, ICloudUpdateService cloudUpdateService, IPlaybackService playbackService, IShortcutsService shortcutService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _pushService        = pushService;
            _contactsService    = contactsService;
            _passcodeService    = passcodeService;
            _lifetimeService    = lifecycle;
            _sessionService     = session;
            _voipService        = voipService;
            _groupCallService   = groupCallService;
            _emojiSetService    = emojiSetService;
            _cloudUpdateService = cloudUpdateService;
            _playbackService    = playbackService;
            _shortcutService    = shortcutService;

            Filters         = new ChatFilterCollection();
            NavigationItems = new List <IEnumerable <ChatFilterViewModel> >
            {
                Filters,
                new ChatFilterViewModel[]
                {
                    new ChatFilterViewModel(int.MaxValue - 1, Strings.Resources.Contacts, "\uE95E", "\uE95D"),
                    new ChatFilterViewModel(int.MaxValue - 2, Strings.Resources.Calls, "\uE991", "\uE990"),
                    new ChatFilterViewModel(int.MaxValue - 3, Strings.Resources.Settings, "\uE98F", "\uE98E"),
                }
            };

            ChatList chatList = CacheService.MainChatListPosition > 0 && CacheService.ChatFilters.Count > 0
                ? new ChatListFilter(CacheService.ChatFilters[0].Id)
                : new ChatListMain();

            Chats    = new ChatListViewModel(protoService, cacheService, settingsService, aggregator, pushService, chatList);
            Contacts = new ContactsViewModel(protoService, cacheService, settingsService, aggregator, contactsService);
            Calls    = new CallsViewModel(protoService, cacheService, settingsService, aggregator);
            Settings = new SettingsViewModel(protoService, cacheService, settingsService, storageService, aggregator, settingsSearchService);

            // This must represent pivot tabs
            Children.Add(Chats);
            Children.Add(Contacts);
            Children.Add(Calls);
            Children.Add(Settings);

            // Any additional child
            Children.Add(_voipService as TLViewModelBase);

            Subscribe();

            ReturnToCallCommand = new RelayCommand(ReturnToCallExecute);

            ToggleArchiveCommand = new RelayCommand(ToggleArchiveExecute);

            CreateSecretChatCommand = new RelayCommand(CreateSecretChatExecute);

            SetupFiltersCommand = new RelayCommand(SetupFiltersExecute);

            UpdateAppCommand = new RelayCommand(UpdateAppExecute);

            FilterEditCommand       = new RelayCommand <ChatFilterViewModel>(FilterEditExecute);
            FilterAddCommand        = new RelayCommand <ChatFilterViewModel>(FilterAddExecute);
            FilterMarkAsReadCommand = new RelayCommand <ChatFilterViewModel>(FilterMarkAsReadExecute);
            FilterDeleteCommand     = new RelayCommand <ChatFilterViewModel>(FilterDeleteExecute);
        }