Beispiel #1
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService pushService, IVibrationService vibrationService, ILiveLocationService liveLocationService, IContactsService contactsService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoIPService voipService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _pushService         = pushService;
            _vibrationService    = vibrationService;
            _liveLocationService = liveLocationService;
            _passcodeService     = passcodeService;
            _lifetimeService     = lifecycle;
            _sessionService      = session;
            _voipService         = voipService;

            _typingManagers     = new ConcurrentDictionary <int, InputTypingManager>();
            _chatTypingManagers = new ConcurrentDictionary <int, InputTypingManager>();

            //Dialogs = new DialogCollection(protoService, cacheService);
            Chats    = new ChatsViewModel(protoService, cacheService, settingsService, aggregator);
            Contacts = new ContactsViewModel(protoService, cacheService, settingsService, aggregator, contactsService);
            Calls    = new CallsViewModel(protoService, cacheService, settingsService, aggregator);
            Settings = new SettingsViewModel(protoService, cacheService, settingsService, aggregator, pushService, contactsService);

            ChildViewModels.Add(Chats);
            ChildViewModels.Add(Contacts);
            ChildViewModels.Add(Calls);
            ChildViewModels.Add(Settings);
            ChildViewModels.Add(_voipService as TLViewModelBase);

            aggregator.Subscribe(this);

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

            ReturnToCallCommand = new RelayCommand(ReturnToCallExecute);
        }
Beispiel #2
0
        private void RegisterChildViewModel <T>() where T : ChildViewModel
        {
            var viewModel = (T)Activator.CreateInstance(typeof(T), this, _userData);

            ChildViewModels.Add(viewModel);
            var button = new Button()
            {
                Content          = viewModel.Name,
                Command          = _activateViewModelCommand,
                CommandParameter = viewModel,
                Margin           = new Thickness(5)
            };

            button.SetResourceReference(Button.StyleProperty, "ButtonStyle");

            ChildViewModelButtons.Add(button);
        }
        public SettingsPrivacyAndSecurityViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IContactsService contactsService, SettingsPrivacyShowStatusViewModel statusTimestamp, SettingsPrivacyAllowCallsViewModel phoneCall, SettingsPrivacyAllowChatInvitesViewModel chatInvite)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _contactsService = contactsService;

            _showStatusRules       = statusTimestamp;
            _allowCallsRules       = phoneCall;
            _allowChatInvitesRules = chatInvite;

            PasswordCommand      = new RelayCommand(PasswordExecute);
            ClearDraftsCommand   = new RelayCommand(ClearDraftsExecute);
            ClearContactsCommand = new RelayCommand(ClearContactsExecute);
            ClearPaymentsCommand = new RelayCommand(ClearPaymentsExecute);
            AccountTTLCommand    = new RelayCommand(AccountTTLExecute);
            PeerToPeerCommand    = new RelayCommand(PeerToPeerExecute);

            ChildViewModels.Add(_showStatusRules);
            ChildViewModels.Add(_allowCallsRules);
            ChildViewModels.Add(_allowChatInvitesRules);

            aggregator.Subscribe(this);
        }
 public void EditParticipant(Participant participant)
 {
     ChildViewModels.Add(new EditParticipantViewModel("Edit " + participant.FirstName + " " + participant.LastName + " (" + participant.Affiliation.Abbreviation + ")",
                                                      mainWindow, this, _database, participant));
     SelectedChildViewModel = ChildViewModels.Last();
 }