示例#1
0
 private TLContainer()
 {
     _lifetime = new LifetimeService();
     _passcode = new PasscodeService(SettingsService.Current.PasscodeLock);
     _playback = new PlaybackService(SettingsService.Current);
     _locale   = LocaleService.Current;
 }
示例#2
0
 public CardsController(
     ILifetimeService lifetimeService,
     ICardService cardService)
 {
     _lifetimeService = lifetimeService;
     _cardService     = cardService;
 }
示例#3
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);
        }
示例#4
0
        public Shell(IContainerProvider container, IWindowsIntegrationService windowsIntegrationService, II18nService i18nService,
                     INotificationService notificationService, IWin32InputService win32InputService, IAppearanceService appearanceService,
                     IPlaybackService playbackService, IMetadataService metadataService, ILifetimeService lifetimeService,
                     IEventAggregator eventAggregator)
        {
            InitializeComponent();

            this.container = container;
            this.windowsIntegrationService = windowsIntegrationService;
            this.notificationService       = notificationService;
            this.win32InputService         = win32InputService;
            this.playbackService           = playbackService;
            this.metadataService           = metadataService;
            this.appearanceService         = appearanceService;
            this.i18nService     = i18nService;
            this.lifetimeService = lifetimeService;
            this.eventAggregator = eventAggregator;

            this.shellService = container.Resolve <Func <string, string, string, string, string, IShellService> >()(
                typeof(NowPlaying.NowPlaying).FullName, typeof(FullPlayer.FullPlayer).FullName, typeof(CoverPlayer).FullName,
                typeof(MicroPlayer).FullName, typeof(NanoPlayer).FullName);

            this.InitializeServices();
            this.InitializeWindows();
            this.InitializeTrayIcon();
            this.InitializeCommands();
        }
示例#5
0
        public SignInViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILifetimeService lifecycleService, INotificationsService notificationsService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _lifetimeService      = lifecycleService;
            _notificationsService = notificationsService;

            SendCommand  = new RelayCommand(SendExecute, () => !IsLoading);
            ProxyCommand = new RelayCommand(ProxyExecute);
        }
示例#6
0
        public RootPage(NavigationService service)
        {
            if (SettingsService.Current.Appearance.RequestedTheme != ElementTheme.Default)
            {
                RequestedTheme = SettingsService.Current.Appearance.GetCalculatedElementTheme();
            }

            InitializeComponent();

            _lifetime = TLContainer.Current.Lifetime;

            _navigationViewSelected = RootDestination.Chats;
            _navigationViewItems    = new MvxObservableCollection <object>
            {
                //RootDestination.Separator,

                RootDestination.NewChat,
                RootDestination.NewSecretChat,
                RootDestination.NewChannel,

                RootDestination.Separator,

                RootDestination.Chats,
                RootDestination.Contacts,
                RootDestination.Calls,
                RootDestination.Settings,

                //RootDestination.Separator,

                //RootDestination.Wallet,

                RootDestination.Separator,

                RootDestination.SavedMessages,
                RootDestination.News
            };

            NavigationViewList.ItemsSource = _navigationViewItems;

            service.Frame.Navigating += OnNavigating;
            service.Frame.Navigated  += OnNavigated;
            _navigationService        = service;

            InitializeTitleBar();
            InitializeNavigation(service.Frame);
            InitializeLocalization();

            Navigation.Content = _navigationService.Frame;

            var shadow = DropShadowEx.Attach(ThemeShadow, 20, 0.25f);

            ThemeShadow.SizeChanged += (s, args) =>
            {
                shadow.Size = args.NewSize.ToVector2();
            };
        }
示例#7
0
        public SessionService(int session, bool selected, IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILifetimeService lifecycleService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _lifetimeService = lifecycleService;
            _id = session;

            aggregator.Subscribe(this);

            IsActive    = selected;
            UnreadCount = ProtoService.UnreadCount;
        }
示例#8
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);
        }
示例#9
0
        public MainViewModel(ICommandFactory commandFactory,
                             ILogService logService,
                             ILifetimeService lifetimeService,
                             IOrderDiffGenerator orderDiffGenerator)
        {
            _commandFactory     = commandFactory ?? throw new ArgumentNullException(nameof(commandFactory));
            _logService         = logService ?? throw new ArgumentNullException(nameof(logService));
            _lifetimeService    = lifetimeService ?? throw new ArgumentNullException(nameof(lifetimeService));
            _orderDiffGenerator = orderDiffGenerator ?? throw new ArgumentNullException(nameof(orderDiffGenerator));
            Model = new MainModel();

            _logService.Information("PROGRAM STARTING!");
            InitComponents();
            Build();
        }
示例#10
0
        public SessionService(int session, bool selected, IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILifetimeService lifecycleService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _lifetimeService = lifecycleService;
            _id = session;

            aggregator.Subscribe(this);

            IsActive = selected;

            var unreadCount = CacheService.GetUnreadCount(new ChatListMain());

            Handle(unreadCount.UnreadChatCount);
            Handle(unreadCount.UnreadMessageCount);
        }
示例#11
0
        public RootPage(NavigationService service)
        {
            InitializeComponent();

            _lifetime = TLContainer.Current.Lifetime;

            service.Frame.Navigating += OnNavigating;
            service.Frame.Navigated  += OnNavigated;
            _navigationService        = service;

            InitializeTitleBar();
            InitializeNavigation(service.Frame);
            InitializeLocalization();

            Navigation.Content = _navigationService.Frame;
        }
示例#12
0
        public TLWindowContext(Window window, int id)
            : base(window)
        {
            _id = id;

            _window = window;

            _lifetime = TLContainer.Current.Lifetime;

            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 500));
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            UpdateTitleBar();

            window.Activated += OnActivated;
        }
示例#13
0
        public RootPage(NavigationService service)
        {
            RequestedTheme = SettingsService.Current.Appearance.GetCalculatedElementTheme();
            InitializeComponent();

            _lifetime = TLContainer.Current.Lifetime;

            _navigationViewSelected = RootDestination.Chats;
            _navigationViewItems    = new MvxObservableCollection <object>
            {
                RootDestination.SavedMessages,
                // ------------
                RootDestination.Separator,
                // ------------
                RootDestination.NewChat,
                RootDestination.NewSecretChat,
                RootDestination.NewChannel,
                // ------------
                RootDestination.Separator,
                // ------------
                RootDestination.Chats,
                RootDestination.Contacts,
                RootDestination.Calls,
                RootDestination.Settings,
                // ------------
                RootDestination.Separator,
                // ------------
                RootDestination.Tips,
                RootDestination.News
            };

            NavigationViewList.ItemsSource = _navigationViewItems;

            service.Frame.Navigating += OnNavigating;
            service.Frame.Navigated  += OnNavigated;
            _navigationService        = service;

            InitializeNavigation(service.Frame);
            InitializeLocalization();

            Navigation.Content = _navigationService.Frame;

            DropShadowEx.Attach(ThemeShadow);
        }
示例#14
0
        public TLWindowContext(Window window, int id)
            : base(window)
        {
            _id = id;

            _window = window;
            if (!ApiInfo.IsUniversalApiContract5Present)
            {
                _window.Activated += OnActivated;
            }

            _lifetime = TLContainer.Current.Lifetime;

            //_placeholderHelper = PlaceholderImageHelper.GetForCurrentView();

            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(320, 500));
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;

            UpdateTitleBar();

            var app = App.Current as App;

            app.UISettings.ColorValuesChanged += UISettings_ColorValuesChanged;

            _window.CoreWindow.Closed += (s, e) =>
            {
                try
                {
                    //_placeholderHelper = null;
                    app.UISettings.ColorValuesChanged -= UISettings_ColorValuesChanged;
                }
                catch { }
            };
            _window.Closed += (s, e) =>
            {
                try
                {
                    //_placeholderHelper = null;
                    app.UISettings.ColorValuesChanged -= UISettings_ColorValuesChanged;
                }
                catch { }
            };
        }
示例#15
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);
        }
示例#16
0
 private TLContainer()
 {
     _lifetime = new LifetimeService();
 }
示例#17
0
 public TLRootNavigationService(ISessionService sessionService, Frame frame, int session, string id)
     : base(frame, session, id)
 {
     _lifetimeService = TLContainer.Current.Lifetime;
     _sessionService  = sessionService;
 }
示例#18
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)
示例#19
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);
        }