Exemple #1
0
        public AnimationDrawer()
        {
            InitializeComponent();

            _handler = new AnimatedRepeaterHandler <Animation>(Repeater, ScrollingHost);
            _handler.DownloadFile = DownloadFile;

            _throttler          = new DispatcherTimer();
            _throttler.Interval = TimeSpan.FromMilliseconds(Constants.AnimatedThrottle);
            _throttler.Tick    += (s, args) =>
            {
                _throttler.Stop();
                _handler.LoadVisibleItems(false);
            };

            ElementCompositionPreview.GetElementVisual(this).Clip = Window.Current.Compositor.CreateInsetClip();

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

            Separator.SizeChanged += (s, args) =>
            {
                shadow.Size = args.NewSize.ToVector2();
            };

            var observable = Observable.FromEventPattern <TextChangedEventArgs>(FieldAnimations, "TextChanged");
            var throttled  = observable.Throttle(TimeSpan.FromMilliseconds(Constants.TypingTimeout)).ObserveOnDispatcher().Subscribe(x =>
            {
                ViewModel.FindAnimations(FieldAnimations.Text);
                //var items = ViewModel.Stickers.SearchStickers;
                //if (items != null && string.Equals(FieldStickers.Text, items.Query))
                //{
                //    await items.LoadMoreItemsAsync(1);
                //    await items.LoadMoreItemsAsync(2);
                //}
            });
        }
Exemple #2
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;
        }
Exemple #3
0
        public PaymentFormPage()
        {
            InitializeComponent();

            DropShadowEx.Attach(BuyShadow);
        }
Exemple #4
0
 private void PurchaseShadow_Loaded(object sender, RoutedEventArgs e)
 {
     DropShadowEx.Attach(PurchaseShadow);
 }
        public StickersView()
        {
            InitializeComponent();

            var shadow1 = DropShadowEx.Attach(HeaderSeparator, 20, 0.25f);
            var shadow2 = DropShadowEx.Attach(Separator, 20, 0.25f);

            HeaderSeparator.SizeChanged += (s, args) =>
            {
                shadow1.Size = args.NewSize.ToVector2();
            };

            Separator.SizeChanged += (s, args) =>
            {
                shadow2.Size = args.NewSize.ToVector2();
            };

            var observable = Observable.FromEventPattern <TextChangedEventArgs>(FieldStickers, "TextChanged");
            var throttled  = observable.Throttle(TimeSpan.FromMilliseconds(Constants.TypingTimeout)).ObserveOnDispatcher().Subscribe(async x =>
            {
                var items = ViewModel.Stickers.SearchStickers;
                if (items != null && string.Equals(FieldStickers.Text, items.Query))
                {
                    await items.LoadMoreItemsAsync(1);
                    await items.LoadMoreItemsAsync(2);
                }
            });

            var observable2 = Observable.FromEventPattern <TextChangedEventArgs>(FieldAnimations, "TextChanged");
            var throttled2  = observable2.Throttle(TimeSpan.FromMilliseconds(Constants.TypingTimeout)).ObserveOnDispatcher().Subscribe(x =>
            {
                ViewModel.Stickers.FindAnimations(FieldAnimations.Text);
                //var items = ViewModel.Stickers.SearchStickers;
                //if (items != null && string.Equals(FieldStickers.Text, items.Query))
                //{
                //    await items.LoadMoreItemsAsync(1);
                //    await items.LoadMoreItemsAsync(2);
                //}
            });

            switch (SettingsService.Current.Stickers.SelectedTab)
            {
            case Services.Settings.StickersTab.Emoji:
                Pivot.SelectedIndex = 0;
                break;

            case Services.Settings.StickersTab.Animations:
                Pivot.SelectedIndex = 1;
                break;

            case Services.Settings.StickersTab.Stickers:
                Pivot.SelectedIndex = 2;
                break;
            }

            if (ApiInformation.IsPropertyPresent("Windows.UI.Xaml.UIElement", "Shadow"))
            {
                var themeShadow = new ThemeShadow();
                BackgroundElement.Shadow       = themeShadow;
                BackgroundElement.Translation += new Vector3(0, 0, 32);

                themeShadow.Receivers.Add(ShadowElement);
            }
        }