Ejemplo n.º 1
0
        public VMMainPage(ILocalizationService localizationService, IPhoneCallService phoneCallService, MapItemsModel mapsItemModel, IVibrationService vibrationService, IAvailabilityService availabilityService, IConnectionManager connectionManager)
        {
            _localizationService = localizationService;
            _phoneCallService = phoneCallService;
            _mapsItemModel = mapsItemModel;
            _vibrationService = vibrationService;
            _availabilityService = availabilityService;
            _connectionManager = connectionManager;

            _dispatcherTimerChronometer = new DispatcherTimer { Interval = new TimeSpan(0, 0, 0, 1) };
            _dispatcherTimerChronometer.Tick += _dispatcherTimer_Tick;

            var dispatcherTimerAvailability = new DispatcherTimer()
            {
                Interval = new TimeSpan(0, 0, 0, 30)
            };
            dispatcherTimerAvailability.Tick += _dispatcherTimerAvailability_Tick;
            dispatcherTimerAvailability.Start();

            _mapsItemModel.GetNearMapItemsCompleted += GetNearMapItemsCompleted;

            _localizationService.Geolocator.PositionChanged += _geolocator_PositionChanged;

            SetCurrentPositionAsync();
            ZoomLevel = 15;

            _lazyPhoneCallCommand = new Lazy<DelegateCommand>(() => new DelegateCommand(PhoneCallCommandExecute));

            _lazyGetNearStationsCommand = new Lazy<DelegateCommand>(() => new DelegateCommand(GetNearStationsCommandExecute));

            _lazyStartChronometerCommand = new Lazy<DelegateCommand>(() => new DelegateCommand(StartChronometerCommandExecute));
        }
        public SettingsNotificationsViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator, IVibrationService vibrationService)
            : base(protoService, cacheService, aggregator)
        {
            _vibrationService = vibrationService;

            Aggregator.Subscribe(this);
            PropertyChanged += OnPropertyChanged;
        }
        public SettingsNotificationsViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator, IVibrationService vibrationService)
            : base(protoService, cacheService, aggregator)
        {
            _vibrationService = vibrationService;

            ResetCommand = new RelayCommand(ResetExecute);

            Aggregator.Subscribe(this);
            PropertyChanged += OnPropertyChanged;
        }
Ejemplo n.º 4
0
        public NewReminderViewModel(INavService navService, IDataStore <Reminder> dataStore, IVibrationService vibrationService, IHapticsService hapticsService, IBatteryService batteryService) : base(navService, dataStore)
        {
            _vibrationService = vibrationService;
            _hapticsService   = hapticsService;
            _batteryService   = batteryService;

            SaveCommand           = new Command(OnSave, ValidateSave);
            CancelCommand         = new Command(OnCancel);
            this.PropertyChanged +=
                (_, __) => SaveCommand.ChangeCanExecute();
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        public SwipeMatchesViewModel(
            IRecruitmentQueryService recruitmentQueryService,
            IAlertService alertService,
            IVibrationService vibrationService)
        {
            this.recruitmentQueryService = recruitmentQueryService;
            this.alertService            = alertService;
            this.vibrationService        = vibrationService;

            Matches = new ObservableCollection <Candidate>();
            Matches.CollectionChanged += Matches_CollectionChanged;

            SwipeCommand = new Command <SwipedCardEventArgs>(OnSwipe);

            Title = "Matches";
        }
Ejemplo n.º 7
0
        public MainViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator, IPushService pushService, IVibrationService vibrationService, IContactsService contactsService, DialogsViewModel dialogs)
            : base(protoService, cacheService, aggregator)
        {
            _pushService      = pushService;
            _vibrationService = vibrationService;

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

            //Dialogs = new DialogCollection(protoService, cacheService);
            SearchDialogs = new ObservableCollection <TLDialog>();
            Dialogs       = dialogs;
            Contacts      = new ContactsViewModel(protoService, cacheService, aggregator, contactsService);
            Calls         = new CallsViewModel(protoService, cacheService, aggregator);

            aggregator.Subscribe(this);
        }
Ejemplo n.º 8
0
        public MainViewModel(IMTProtoService protoService, ICacheService cacheService, ITelegramEventAggregator aggregator, IUpdatesService updatesService, IPushService pushService, IVibrationService vibrationService, IContactsService contactsService, DialogsViewModel dialogs)
            : base(protoService, cacheService, aggregator)
        {
            _updatesService   = updatesService;
            _pushService      = pushService;
            _vibrationService = vibrationService;

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

            //Dialogs = new DialogCollection(protoService, cacheService);
            SearchDialogs = new ObservableCollection <TLDialog>();
            Dialogs       = dialogs;
            Contacts      = new ContactsViewModel(protoService, cacheService, aggregator, contactsService);
            Calls         = new CallsViewModel(protoService, cacheService, aggregator);

            _selfDestructTimer = new YoloTimer(CheckSelfDestructMessages, this);
            _selfDestructItems = new List <TLMessage>();

            aggregator.Subscribe(this);
        }
Ejemplo n.º 9
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator, INotificationsService pushService, IVibrationService vibrationService, ILiveLocationService liveLocationService, IContactsService contactsService, IPasscodeService passcodeService)
            : base(protoService, cacheService, aggregator)
        {
            _pushService         = pushService;
            _vibrationService    = vibrationService;
            _liveLocationService = liveLocationService;
            _passcodeService     = passcodeService;

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

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

            aggregator.Subscribe(this);

            LiveLocationCommand     = new RelayCommand(LiveLocationExecute);
            StopLiveLocationCommand = new RelayCommand(StopLiveLocationExecute);
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
0
        public SettingsNotificationsViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IVibrationService vibrationService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _vibrationService = vibrationService;

            Scopes = new MvxObservableCollection <SettingsNotificationsScope>
            {
                new SettingsNotificationsScope(protoService, typeof(NotificationSettingsScopePrivateChats), Strings.Resources.NotificationsForPrivateChats),
                new SettingsNotificationsScope(protoService, typeof(NotificationSettingsScopeGroupChats), Strings.Resources.NotificationsForGroups),
                new SettingsNotificationsScope(protoService, typeof(NotificationSettingsScopeChannelChats), Strings.Resources.NotificationsForChannels),
            };

            foreach (var scope in Scopes)
            {
                Children.Add(scope);
            }

            ResetCommand = new RelayCommand(ResetExecute);

            Aggregator.Subscribe(this);
            PropertyChanged += OnPropertyChanged;
        }
Ejemplo n.º 12
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)
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
 internal static void Initialize(IVibrationService vibrationService)
 {
     VibrationService = vibrationService;
 }