private void VmOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            if (args.PropertyName == "MenuPaneState")
            {
                var paneState = (sender as MainViewModel).MenuPaneState;
                _paneState = paneState;

                HamburgerControl.Width = _paneState ? 250 : 48;
                HamburgerTopGrid.Width = _paneState ? 250 : 48;
            }
            else if (args.PropertyName == "OffContentVisibility")
            {
                SplitterColumn.Width = new GridLength(ViewModelLocator.GeneralMain.OffContentVisibility ? 16 : 0);
            }
            else if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
            {
                if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
                {
                    AdControl.Resume();
                }
                else
                {
                    AdControl.Suspend();
                }
            }
        }
Exemple #2
0
        private void VmOnPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            if (args.PropertyName == "MenuPaneState")
            {
                var paneState = (sender as MainViewModel).MenuPaneState;
                _paneState             = paneState;
                HamburgerControl.Width = paneState ? 250 : 48;
                HamburgerTopGrid.Width = paneState ? 250 : 48;
                TitleBarLeft.Margin    = new Thickness(Math.Max(_paneState ? 250 : 48, CoreApplication.GetCurrentView().TitleBar.SystemOverlayLeftInset), 0, 0, 0);
            }
            else if (args.PropertyName == "OffContentVisibility")
            {
                SplitterColumn.Width = new GridLength(ViewModelLocator.GeneralMain.OffContentVisibility ? 16 : 0);

                var width = ViewModelLocator.GeneralMain.OffContentVisibility ? (DataContext as MainViewModel).OffContentStatusBarWidth + 16 : 0;
                TitleBarRight.Margin = new Thickness(0, 0, Math.Max(width, CoreApplication.GetCurrentView().TitleBar.SystemOverlayRightInset), 0);
            }
            else if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
            {
                if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
                {
                    AdControl.Resume();
                }
                else
                {
                    AdControl.Suspend();
                }
            }
        }
Exemple #3
0
 private void GeneralMainOnPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     if (args.PropertyName == nameof(ViewModelLocator.GeneralMain.AdsContainerVisibility))
     {
         if (ViewModelLocator.GeneralMain.AdsContainerVisibility)
         {
             AdControl.Resume();
         }
         else
         {
             AdControl.Suspend();
         }
     }
 }
Exemple #4
0
        private async void AdTimerCallback(object state)
        {
            var passed = (int)(ResourceLocator.ApplicationDataService["AdsTimeToday"] ?? 0);

            passed += 10;
            ResourceLocator.ApplicationDataService["AdsTimeToday"] = passed;
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                      () => AdControl.Resume());

            if (!Settings.AdsEnable || (Settings.AdsSecondsPerDay != 0 && passed > Settings.AdsSecondsPerDay))
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                          () => ViewModelLocator.GeneralMain.AdsContainerVisibility = false);

                _timer?.Dispose();
                _timer = null;
            }
        }