private async void CheckVIP()
        {
            var purchaseVM = AppManager.GetPurchaseViewModel();
            var ok         = await purchaseVM.CheckVIP();

            if (!ok)
            {
                return;
            }
            if (!purchaseVM.IsVIP)
            {
                AppHelper AppHelper = new AppHelper();
                //0.0069444444444444, 0.0138888888888889 10/20分钟
                //bool canPrpmpt = AppHelper.ShouldPrompt(new WPFPurchasedDataManager(AppManager.PurchaseDataPath), 0.0069444444444444, 0.0138888888888889);
                bool canPrpmpt = AppHelper.ShouldPrompt(new WPFPurchasedDataManager(AppManager.PurchaseDataPath), 15, 30);
                if (canPrpmpt)
                {
                    //var windowManager = IoC.Get<IWindowManager>();
                    var view = new PurchaseTipsView();
                    var vm   = new PurchaseTipsViewModel()
                    {
                        BGM             = new Uri("Res//Sounds//PurchaseTipsBg.mp3", UriKind.RelativeOrAbsolute),
                        Content         = new DefaultPurchaseTipsContent(),
                        PurchaseContent = await LanService.Get("donate_text"),
                        RatingContent   = await LanService.Get("rating_text"),
                    };
                    vm.Initlize(purchaseVM);
                    view.DataContext = vm;
                    view.Show();
                }
            }
        }
        public async Task OnLoaded()
        {
            if (_firstLaunch)
            {
                AppManager.Run();
                //第一次时打开检查更新
                var handle = (new WindowInteropHelper(Application.Current.MainWindow)).Handle;
                await Task.Run(() =>
                {
                    AppManager.MainHandle = handle;
                    AppManager.CheckUpates(handle);
                });

                DZY.Util.Common.Helpers.AppHelper AppHelper = new DZY.Util.Common.Helpers.AppHelper();
                //0.0069444444444444, 0.0138888888888889 10/20分钟
                bool canPrpmpt = AppHelper.ShouldPrompt(new WPFPurchasedDataManager(AppManager.PurchaseDataPath), 30, 60);
                if (canPrpmpt)
                {
                    var windowManager = IoC.Get <IWindowManager>();

                    var view = new PurchaseTipsView();
                    var vm   = new PurchaseTipsViewModel()
                    {
                        BGM             = new Uri("Res//Sounds//PurchaseTipsBg.mp3", UriKind.RelativeOrAbsolute),
                        Content         = new DefaultPurchaseTipsContent(),
                        PurchaseContent = await LanService.Get("donate_text"),
                        RatingContent   = await LanService.Get("rating_text"),
                    };
                    vm.Initlize(AppManager.GetPurchaseViewModel());
                    view.DataContext = vm;
                    view.Show();
                }

                _firstLaunch = false;

                if (AppManager.Setting.General.MinimizeUI)
                {
                    TryClose();
                }
            }

            Wallpapers = new ObservableCollection <Wallpaper>(AppManager.Wallpapers);

            if (AppManager.Setting.General.RecordWindowSize)
            {
                Width  = AppManager.Setting.General.Width;
                Height = AppManager.Setting.General.Height;
            }
        }
Exemple #3
0
        public void SourceInitialized()
        {
            if (_firstLaunch)
            {
                //第一次时打开检查更新
                var handle = (new WindowInteropHelper(Application.Current.MainWindow)).Handle;
                Task.Run(() =>
                {
                    AppManager.MainHandle = handle;
                    AppManager.CheckUpates(handle);
                });

                AppHelper AppHelper = new AppHelper();
                //0.0069444444444444, 0.0138888888888889 10/20分钟
                bool canPrpmpt = AppHelper.ShouldPrompt(new WPFPurchasedDataManager(AppManager.PurchaseDataPath), 15, 30);
                if (canPrpmpt)
                {
                    var windowManager = IoC.Get <IWindowManager>();

                    var view = new PurchaseTipsView();
                    var vm   = new PurchaseTipsViewModel()
                    {
                        BGM = new Uri("Res//Sounds//PurchaseTipsBg.mp3", UriKind.RelativeOrAbsolute),
                    };
                    vm.Initlize(AppManager.GetPurchaseViewModel(), windowManager);
                    view.DataContext = vm;
                    view.Show();
                }

                if (AppManager.Setting.General.MinimizeUI)
                {
                    TryClose();
                }

                _firstLaunch = false;
            }
        }