Exemplo n.º 1
0
        public SettingsVoIPViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, IVoipService voipService)
            : base(protoService, cacheService, settingsService, aggregator)
        {
            _voipService = voipService;

            Input  = new MvxObservableCollection <DeviceInformation>();
            Output = new MvxObservableCollection <DeviceInformation>();
            Video  = new MvxObservableCollection <DeviceInformation>();

            SystemCommand = new RelayCommand(SystemExecute);

            _ = OnNavigatedToAsync(null, NavigationMode.New, null);
        }
Exemplo n.º 2
0
        public MainViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, INotificationsService pushService, IContactsService contactsService, IPasscodeService passcodeService, ILifetimeService lifecycle, ISessionService session, IVoipService voipService, 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;
            _emojiSetService    = emojiSetService;
            _cloudUpdateService = cloudUpdateService;
            _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);

            UpdateAppCommand = new RelayCommand(UpdateAppExecute);

            FilterEditCommand   = new RelayCommand <ChatFilterViewModel>(FilterEditExecute);
            FilterAddCommand    = new RelayCommand <ChatFilterViewModel>(FilterAddExecute);
            FilterDeleteCommand = new RelayCommand <ChatFilterViewModel>(FilterDeleteExecute);
        }
Exemplo n.º 3
0
        public VoIPPage(IProtoService protoService, ICacheService cacheService, IEventAggregator aggregator, IVoipService voipService)
        {
            InitializeComponent();

            _protoService = protoService;
            _cacheService = cacheService;
            _aggregator   = aggregator;

            _service = voipService;

            _durationTimer          = new DispatcherTimer();
            _durationTimer.Interval = TimeSpan.FromMilliseconds(500);
            _durationTimer.Tick    += DurationTimer_Tick;

            _debugTimer          = new DispatcherTimer();
            _debugTimer.Interval = TimeSpan.FromMilliseconds(500);
            _debugTimer.Tick    += DebugTimer_Tick;

            #region Reset

            LargeEmoji0.Source = null;
            LargeEmoji1.Source = null;
            LargeEmoji2.Source = null;
            LargeEmoji3.Source = null;

            #endregion

            #region Composition

            _descriptionVisual = ElementCompositionPreview.GetElementVisual(DescriptionLabel);
            _largeVisual       = ElementCompositionPreview.GetElementVisual(LargePanel);
            _compositor        = _largeVisual.Compositor;

            var graphicsEffect = new GaussianBlurEffect
            {
                Name       = "Blur",
                BlurAmount = 0,
                BorderMode = EffectBorderMode.Hard,
                Source     = new CompositionEffectSourceParameter("backdrop")
            };

            var effectFactory = _compositor.CreateEffectFactory(graphicsEffect, new[] { "Blur.BlurAmount" });
            var effectBrush   = effectFactory.CreateBrush();
            var backdrop      = _compositor.CreateBackdropBrush();
            effectBrush.SetSourceParameter("backdrop", backdrop);

            _blurBrush        = effectBrush;
            _blurVisual       = _compositor.CreateSpriteVisual();
            _blurVisual.Brush = _blurBrush;

            // Why does this crashes due to an access violation exception on certain devices?
            ElementCompositionPreview.SetElementChildVisual(BlurPanel, _blurVisual);

            var viewfinder = DropShadowEx.Attach(ViewfinderShadow, 20, 0.25f);
            viewfinder.RelativeSizeAdjustment = Vector2.One;

            #endregion

            //var titleBar = ApplicationView.GetForCurrentView().TitleBar;
            //titleBar.ButtonBackgroundColor = Colors.Transparent;
            //titleBar.ButtonForegroundColor = Colors.White;
            //titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
            //titleBar.ButtonInactiveForegroundColor = Colors.White;

            //Window.Current.SetTitleBar(BlurPanel);

            if (voipService.Call != null)
            {
                Update(voipService.Call, voipService.CallStarted);
            }

            if (voipService.Manager != null)
            {
                Connect(voipService.Manager);
            }

            Connect(voipService.Capturer);

            _viewfinder = ElementCompositionPreview.GetElementVisual(ViewfinderPanel);

            ViewfinderPanel.PointerPressed  += Viewfinder_PointerPressed;
            ViewfinderPanel.PointerMoved    += Viewfinder_PointerMoved;
            ViewfinderPanel.PointerReleased += Viewfinder_PointerReleased;
        }
Exemplo n.º 4
0
 public DialogThreadViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILocationService locationService, INotificationsService pushService, IPlaybackService playbackService, IVoipService voipService, INetworkService networkService, IMessageFactory messageFactory)
     : base(protoService, cacheService, settingsService, aggregator, locationService, pushService, playbackService, voipService, networkService, messageFactory)
 {
 }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
 public DialogScheduledViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILocationService locationService, INotificationsService pushService, IPlaybackService playbackService, IVoipService voipService, IGroupCallService groupCallService, INetworkService networkService, IStorageService storageService, ITranslateService translateService, IMessageFactory messageFactory)
     : base(protoService, cacheService, settingsService, aggregator, locationService, pushService, playbackService, voipService, groupCallService, networkService, storageService, translateService, messageFactory)
 {
 }
Exemplo n.º 7
0
 public DialogEventLogViewModel(IProtoService protoService, ICacheService cacheService, ISettingsService settingsService, IEventAggregator aggregator, ILocationService locationService, INotificationsService pushService, IPlaybackService playbackService, IVoipService voipService, IGroupCallService groupCallService, INetworkService networkService, IMessageFactory messageFactory)
     : base(protoService, cacheService, settingsService, aggregator, locationService, pushService, playbackService, voipService, groupCallService, networkService, messageFactory)
 {
     HelpCommand = new RelayCommand(HelpExecute);
 }