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; } }
private void _tipsVM_Deactivated(object sender, EventArgs e) { var temp = sender as PurchaseTipsViewModel; temp.Deactivated -= _tipsVM_Deactivated; AppData.Purchased = _tipsVM.Purchased || AppData.Purchased; _eventAggregator.PublishOnBackgroundThread(new VipEvent() { IsVIP = AppData.Purchased }); AppData.Reviewed = _tipsVM.Rated || AppData.Reviewed; SaveAppData(); _tipsVM = null; if (semaphoreSlim.CurrentCount == 0) { semaphoreSlim.Release(); } }
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; } }
public async Task ShowPurchaseTip() { if (!Initialized) { return; } if (_tipsVM != null) { ActionUI(_tipsVM.GetView()); return; } _tipsVM = new PurchaseTipsViewModel { BGM = new Uri("Resources//Sounds//PurchaseTipsBg.mp3", UriKind.RelativeOrAbsolute), Content = new DefaultPurchaseTipsContent(), PurchaseContent = "真可怜,给他买个包子吧", RatingContent = "造孽啊,给个精神抚慰吧", //CancelContent = "不管,饿死算球" }; //StoreHelper store = new StoreHelper(_mainHandler); _tipsVM.Initlize(GetPurchaseViewModel()); //_tipsVM.DisplayName = "Duang Duang Duang ! ! !"; _tipsVM.Deactivated += _tipsVM_Deactivated; dynamic setting = new ExpandoObject(); setting.Width = 800; setting.Height = 450; setting.ResizeMode = ResizeMode.NoResize; setting.WindowStartupLocation = WindowStartupLocation.CenterScreen; _windowManager.ShowWindow(_tipsVM, null, setting); await semaphoreSlim.WaitAsync(); }