private async void DismissExtendedSplash() { Window.Current.SizeChanged -= ExtendedSplash_OnResize; StateText = "正在检查后台通知"; await BackgroundHelper.Register <UpdateUnreadCountTask>(new TimeTrigger(15, false)); await BackgroundHelper.Register <ToastNotificationBackgroundTask>(new ToastNotificationActionTrigger()); StateText = "正在初始化表情"; await StaticResource.InitEmotion(); var cahcesize = rootFrame.CacheSize; rootFrame.CacheSize = 0; rootFrame.CacheSize = cahcesize; Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); StateText = "正在初始化用户数据"; if (await StaticResource.CheckForLogin()) { await InitUid(); rootFrame.Navigate(typeof(MainPage)); } else { rootFrame.Navigate(typeof(LoginPage)); } SystemNavigationManager.GetForCurrentView().BackRequested += ExtendedSplash_BackRequested; rootFrame.Navigated += RootFrame_Navigated; Window.Current.Content = rootFrame; }
private async Task IsFishComboEvent(IntPtr hWnd, SearchImage.RECT rect) { Point Scan = Point.Empty; while (!SearchImage.PixelSearch(SearchImage.GetBitmapArea(target, 305, 380, 325, 400), FishColorEvent).IsEmpty&& !IsFinished) { target2 = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom); if (!SearchImage.Find(target2, Resources.fish_Arrow_left, out Scan).IsEmpty&& !IsFinished) { await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_LEFT, 5); await Task.Delay(80); } if (!SearchImage.Find(target2, Resources.fish_Arrow_top, out Scan).IsEmpty&& !IsFinished) { await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_UP, 5); await Task.Delay(80); } if (!SearchImage.Find(target2, Resources.fish_Arrow_right, out Scan).IsEmpty&& !IsFinished) { await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5); await Task.Delay(80); } if (!SearchImage.Find(target2, Resources.fish_Arrow_Bottom, out Scan).IsEmpty&& !IsFinished) { await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_DOWN, 5); await Task.Delay(80); } await Task.Delay(20); } }
public override async void OnNavigatedTo(string parameter, NavigationMode mode, Dictionary <string, object> state) { LoadCommand.Execute(null); // register background tasks await BackgroundHelper.Register <MyUpdateTileTask>(new SystemTrigger(SystemTriggerType.TimeZoneChange, false)); }
private async void ExecuteUpdateTileCommand(string value) { try { Busy = true; var number = default(int); if (!int.TryParse(value, out number)) { return; } await Task.Delay(2000); var trigger = new ApplicationTrigger(); var task = await BackgroundHelper.Register <MyUpdateBadgeTask>(trigger); task.Completed += (s, e) => { Busy = false; }; var allowed = await trigger.RequestAsync(); if (allowed != ApplicationTriggerResult.Allowed) { // it was not allowed to run Busy = false; } } catch { Busy = false; } }
public async void RunTask(IntPtr hWnd, int Amount, SearchImage.RECT rect, int BotID, bool UseRewardCoupon) { Console.WriteLine("SawMill Bot created for HWID: {0}, Bot ID: {1}, Times: {2}", hWnd, BotID, Amount); IsFinished = true; IsFailed = false; Times = 0; Point Scan; Bitmap target; while (Program.botRunning) { int RandomStep = new Random().Next(0, 5); target = SearchImage.CaptureWindow(hWnd, rect.Right, rect.Bottom); if (!SearchImage.Find(target, Resources.chicken_right, out Scan).IsEmpty) { await Task.Delay(10); await BackgroundHelper.SendKey(hWnd, BackgroundHelper.KeyCodes.VK_RIGHT, 5); } await Task.Delay(10); } Console.WriteLine("SawMill Bot Stopped for HWID: {0}, Bot ID: {1}, Times played: {2}/{3}", hWnd, BotID, Times, Amount); }
private async Task ChangeBackgroundAsync() { if (ImageDataService.UsedList == null) { ImageDataService.UsedList = new List <Photo>(); } if (UserProfilePersonalizationSettings.IsSupported() && ImageDataService.CuratedWallpaperCollection?.Count > 0) { try { IsBusy = true; SelectedPhoto = await GetNewPhotoAsync(); if (SelectedPhoto != null) { await BackgroundHelper.SetBackgroundAsync(SelectedPhoto); } } catch (Exception ex) { Telemetry.LogException(ex); await DialogHelper.ShowDialogAsync("Something went wrong."); } finally { IsBusy = false; } } }
/// <inheritdoc /> /// <summary> /// </summary> /// <param name="gameTime"></param> public override void Draw(GameTime gameTime) { GameBase.Game.GraphicsDevice.Clear(Color.Black); BackgroundHelper.Draw(gameTime); Container?.Draw(gameTime); }
public PinUserControl() { InitializeComponent(); ItemPage.PreviewHold += () => { //if (root.Visibility == Visibility.Visible) root.Visibility = Visibility.Collapsed; }; ItemPage.PreviewUnhold += () => { //if (!Pined) root.Visibility = Visibility.Visible; }; switch (BackgroundHelper.GetBackgroundType()) { case BackgroundType.Light: root.Background = new SolidColorBrush(Colors.Black); root.Background.Opacity = 0.3; break; case BackgroundType.Dark: root.Background = new SolidColorBrush(Colors.White); root.Background.Opacity = 0.3; break; } //Loaded += (s, e) => //{ // _pined = FlipTileDataManager.DeskContainsImage(Image); //}; }
/// <inheritdoc /> /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> protected override void Update(GameTime gameTime) { if (!IsReadyToUpdate) { return; } base.Update(gameTime); if (SteamManager.IsInitialized) { SteamAPI.RunCallbacks(); } // Run scheduled background tasks CommonTaskScheduler.Run(); BackgroundManager.Update(gameTime); BackgroundHelper.Update(gameTime); NotificationManager.Update(gameTime); ChatManager.Update(gameTime); DialogManager.Update(gameTime); HandleGlobalInput(gameTime); QuaverScreenManager.Update(gameTime); Transitioner.Update(gameTime); SkinManager.HandleSkinReloading(); LimitFpsOnInactiveWindow(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (firstNavigation) { SetupSplashScreen(); // applying orientation restrictions (if any) if (App.Instance.Build.PlatformOptions.Contains(PlatformOption.ForcePortrait)) { SupportedOrientations = SupportedPageOrientation.Portrait; } else if (App.Instance.Build.PlatformOptions.Contains(PlatformOption.ForceLandscape)) { SupportedOrientations = SupportedPageOrientation.Landscape; } } // signalling orientation change Core.System.OnOrientationChange((Orientation & PageOrientation.Portrait) == PageOrientation.Portrait); // registering with core Core.RegisterPage(this); // attaching event handlers Core.ConnectionCompletelyFailed += new EventHandler(Core_ConnectionCompletelyFailed); Core.StreamResponseReceived += new EventHandler <StreamResponseEventArgs>(Core_StreamResponseReceived); Core.LocationChanged += new EventHandler(Core_LocationChanged); Core.LocationUnavailable += new EventHandler(Core_LocationUnavailable); // clean navigation journal (just in case) while (NavigationService.CanGoBack) { NavigationService.RemoveBackEntry(); } // first-time only navigation if (firstNavigation) { firstNavigation = false; // renew background task if needed BackgroundHelper.MaintainBackgroundTask(); // determine app to launch int appIndex = 0; string appIndexString = null; if (NavigationContext.QueryString.TryGetValue("app", out appIndexString)) { appIndex = DataHelper.StringToInt(appIndexString, 0); } ThreadHelper.Sync(() => Core.Start(App.Instance.Build.Applications[appIndex])); } }
/// <summary> /// Called when the background of the current map has been blurred. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void OnBackgroundBlurred(object sender, BackgroundBlurredEventArgs e) { if (e.Map != MapManager.Selected.Value && MapManager.GetBackgroundPath(e.Map) != MapManager.GetBackgroundPath(MapManager.Selected.Value)) { return; } BackgroundHelper.Background.Image = e.Texture; BackgroundHelper.FadeIn(); }
/// <summary> /// </summary> private void CreateExportButton() { CalibrateOffsetButton = new BorderedTextButton("Calibrate", Colors.MainAccent) { Parent = this, X = -50, Alignment = Alignment.MidRight, Height = 30, Width = 225, Text = { Font = Fonts.SourceSansProSemiBold, FontSize = 12 } }; CalibrateOffsetButton.Clicked += (o, e) => { var game = (QuaverGame)GameBase.Game; if (game.CurrentScreen.Type == QuaverScreenType.Editor) { NotificationManager.Show(NotificationLevel.Warning, "Finish what you're doing before calibrating a new offset"); return; } var path = $"Quaver.Resources/Maps/Offset/offset.qua"; var qua = Qua.Parse(GameBase.Game.Resources.Get(path)); if (AudioEngine.Track != null && !AudioEngine.Track.IsDisposed && AudioEngine.Track.IsPlaying) { AudioEngine.Track.Pause(); } game.CurrentScreen?.Exit(() => { MapManager.Selected.Value = Map.FromQua(qua, path, true); MapManager.Selected.Value.Qua = qua; // Make the user not allow to fail. ModManager.RemoveAllMods(); ModManager.AddMod(ModIdentifier.NoFail); // Load the background (usually the default one) BackgroundHelper.Load(MapManager.Selected.Value); DialogManager.Dismiss(Dialog); return(new GameplayScreen(qua, "", new List <Score>(), null, false, 0, true)); }); }; }
void EndSelect() { DoSelectStoryboard.Stop(); SelectingProgress = 0.0; MoveToBack(nextSelectedValuePresenter); UpdateMovingValuesPresentersPosition(1.0); selectedValuePresenter = nextSelectedValuePresenter; isSelectCompleted = true; SelectedValue = selectedValuePresenter == null ? null : selectedValuePresenter.Content; BackgroundHelper.DoInBackground(null, delegate() { SetValuesPresentersHitTestVisibility(true); }); }
/// <summary> /// Loads the new background and performs a fade in animation /// </summary> private void LoadNewBackgroundIfNecessary(Map previousMap) { if (previousMap != null && MapManager.GetBackgroundPath(previousMap) == MapManager.GetBackgroundPath(MapManager.Selected.Value)) { return; } View.Banner?.Brightness?.ClearAnimations(); View.Banner?.Brightness?.Animations.Add(new Animation(AnimationProperty.Alpha, Easing.Linear, View.Banner.Brightness.Alpha, 1, 200)); BackgroundHelper.FadeToBlack(); BackgroundHelper.Load(MapManager.Selected.Value); }
/// <summary> /// Makes sure that the background of the map is up-to-date. /// </summary> public void HandleBackgroundChange() { // If we've already got the background loaded up, then use it. if (BackgroundHelper.Map != null && MapManager.GetBackgroundPath(BackgroundHelper.Map) == MapManager.GetBackgroundPath(MapManager.Selected.Value)) { BackgroundHelper.Background.Image = BackgroundHelper.BlurredTexture; BackgroundHelper.FadeIn(0.5f); return; } // Otherwise queue a load on it. BackgroundHelper.Load(MapManager.Selected.Value); }
/// <summary> /// </summary> private void CreateBackground() { Background = new BackgroundImage(UserInterface.BlankBox, 100, false); BackgroundHelper.Loaded += OnBackgroundLoaded; if (BackgroundHelper.Map == MapManager.Selected.Value) { Background.Image = BackgroundHelper.RawTexture; FadeBackgroundIn(); return; } BackgroundHelper.Load(MapManager.Selected.Value); }
private async void RegisterBGTask_Click(object sender, RoutedEventArgs e) { var existing = BackgroundHelper.FindRegistration <OOPBackgroundTask.BadgeTask>(); if (existing == null) { // await BackgroundHelper.Register<OOPBackgroundTask.BadgeTask>(new ToastNotificationActionTrigger()); await BackgroundHelper.Register <OOPBackgroundTask.BadgeTask>(new TimeTrigger(15, false)); } BGTaskList.Text = ""; foreach (var t in BackgroundTaskRegistration.AllTasks) { BGTaskList.Text += t.Value.ToString() + "\n"; } }
public void GenerateDefault() { devExpressMenu = new VSDevExpressMenu(dte); rootMenuHierarchy[string.Empty] = devExpressMenu; string wizardMenuText = "Show tool window"; VsDevExpressMenuItem wizardMenu = devExpressMenu.CreateOrGetItem(wizardMenuText); wizardMenu.Click += WizardMenuClick; var portWindowCommand = dte.Commands.Cast <Command>().FirstOrDefault(x => x.Name == "View.DXVcsToolsportwindow"); wizardMenu.Shortcut = GetShortcutText(portWindowCommand); string blameMenuText = "Show blame window"; VsDevExpressMenuItem blameMenu = devExpressMenu.CreateOrGetItem(blameMenuText); blameMenu.Click += BlameMenuClick; var blameWindowCommand = dte.Commands.Cast <Command>().FirstOrDefault(x => x.Name == "View.DXVcsToolsblamewindow"); blameMenu.Shortcut = GetShortcutText(blameWindowCommand); if (Options.UseNavigateMenu) { VsDevExpressMenuItem navigateMenu = devExpressMenu.CreateOrGetItem("Configure navigate menu..."); navigateMenu.Click += NavigateMenuClick; } VsDevExpressMenuItem settingsMenu = devExpressMenu.CreateOrGetItem("Settings..."); settingsMenu.Click += SettingsMenuOnClick; if (Options.ConfigVersion < VersionInfo.ToIntVersion()) { VsDevExpressMenuItem resetConfigMenu = devExpressMenu.CreateOrGetItem(resetConfigHeader); resetConfigMenu.Click += ResetConfigMenuOnClick; } if (Options.EnableAutoUpdate) { VsDevExpressMenuItem updateMenu = devExpressMenu.CreateOrGetItem(updateHeader); updateMenu.Click += UpdateMenuOnClick; updateMenu.Enabled = false; updateMenu.IsSeparator = true; updateMenu.Icon = Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("DXVcsTools.Resources.Update.png")); UpdateOptions = null; BackgroundHelper.DoInBackground( () => UpdateOptions = AutoUpdateHelper.GetUpdateOptions(Options.AutoUpdaterPath), () => updateMenu.Enabled = UpdateOptions.Return(x => x.Version > VersionInfo.ToIntVersion(), () => false)); } }
private async void UnregisterBGTask_Click(object sender, RoutedEventArgs e) { await BackgroundHelper.Unregister <OOPBackgroundTask.BadgeTask>(); foreach (var t in BackgroundTaskRegistration.AllTasks) { t.Value.Unregister(true); } BGTaskList.Text = ""; foreach (var t in BackgroundTaskRegistration.AllTasks) { BGTaskList.Text += t.Value.ToString() + "\n"; } }
public static ImageSource GetImageSource(Uri uri, Dispatcher dispatcher) { if (uri == null) return null; BitmapImage bi = null; BackgroundHelper.DoWithDispatcher(dispatcher, () => { try { bi = new BitmapImage(uri); } catch { bi = new BitmapImage(new Uri("/Images/LoadingError.png", UriKind.Relative)); } }); return bi; }
public override void ViewWillLayoutSubviews() { base.ViewWillLayoutSubviews(); _imgView.Frame = new CoreGraphics.CGRect(View.Bounds.Width / 2 - ImageSize / 2, View.Bounds.Height / 2 - ImageSize / 2 - 30f, ImageSize, ImageSize); _statusLabel.Frame = new CoreGraphics.CGRect(0, _imgView.Frame.Bottom + 10f, View.Bounds.Width, 15f); _activityView.Center = new CoreGraphics.CGPoint(View.Bounds.Width / 2, _statusLabel.Frame.Bottom + 16f + 16F); try { View.BackgroundColor = BackgroundHelper.CreateRepeatingBackground(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Unable to produce background color for StartupView: {0}", e.Message); } }
// Constructor public MainPage() { InitializeComponent(); this.PivotDefault.DataContext = new DefaultItemListViewModel(); Loaded += (s, e) => { ItemRepository repository = ItemRepository.Instance; repository.Type = BackgroundHelper.GetBackgroundType(); repository.Init(); }; MarketplaceReviewServices marketplaceReviewServices = new MarketplaceReviewServices(this); marketplaceReviewServices.RateDays = 5; marketplaceReviewServices.Run(); }
public ItemPage() { InitializeComponent(); flipTileDataManager = new FlipTileDataManager(); if (BackgroundHelper.GetBackgroundType() == BackgroundType.Dark) { LayoutRoot.Background = new SolidColorBrush(Colors.Black); title.Foreground = new SolidColorBrush(Colors.White); } else { LayoutRoot.Background = new SolidColorBrush(Colors.White); title.Foreground = new SolidColorBrush(Colors.Black); } PinUserControl.Pin += PinImage; }
private void SwitchBackground() { lock (_lockObject) { var query = _viewModel.GetQuery(); if (!WallhavenAPI.API.IsLoggedIn() && !String.IsNullOrEmpty(_viewModel.Username) && !String.IsNullOrEmpty(_viewModel.Password)) { if (!WallhavenAPI.API.Login(_viewModel.Username, _viewModel.Password)) { MessageBox.Show("Couldn't log in with the credentials supplied, please try again, or clear the credential boxes."); return; } } var results = WallhavenAPI.API.Search(query); if (results.Any()) { var img = WallhavenAPI.API.GetFile(results[0]); var imageFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "WallhavenBGBot"); if (!Directory.Exists(imageFolder)) { Directory.CreateDirectory(imageFolder); } var filepath = Path.Combine(imageFolder, results[0].Split('/').Last()); File.WriteAllBytes(filepath, img); BackgroundHelper.UpdateBackground(filepath); if (_viewModel.AutomaticallyCleanAppDataFolder) { var oldFiles = Directory.GetFiles(imageFolder).Where(x => x != filepath).ToList(); foreach (var item in oldFiles) { File.Delete(item); } } } } }
public static ImageSource GetImageSource(Uri uri, Dispatcher dispatcher) { if (uri == null) { return(null); } BitmapImage bi = null; BackgroundHelper.DoWithDispatcher(dispatcher, () => { try { bi = new BitmapImage(uri); } catch { bi = null; } }); return(bi); }
public MainPage() { // Initialize page this.InitializeComponent(); App.SetColors(); // Register background task var currentInterval = ApplicationData.Current.LocalSettings.Values["currentInterval"]; if (currentInterval != null) { BackgroundHelper.RegisterBackgroundTask(Convert.ToUInt32(currentInterval)); } else { BackgroundHelper.RegisterBackgroundTask(360); } // Clear notifications NotificationHelper.DeleteAllNotifications(); }
private void IntervalBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var selectedItem = (ComboBoxItem)e.AddedItems.First(); uint timeInterval = 0; switch (selectedItem.Name) { case "IntervalNever": timeInterval = 0; break; case "Interval30": timeInterval = 30; break; case "Interval60": timeInterval = 60; break; case "Interval90": timeInterval = 90; break; case "Interval2h": timeInterval = 120; break; case "Interval6h": timeInterval = 360; break; case "IntervalOnce": timeInterval = 720; break; } BackgroundHelper.RegisterBackgroundTask(timeInterval); ApplicationData.Current.LocalSettings.Values["currentInterval"] = timeInterval; }
public void RefreshDeviceBookmarks() { if (IsPageEnabled) { List <Bookmark> serviceBookmarks = null; BackgroundHelper.Execute(() => { serviceBookmarks = BookmarkService.RetrieveDeviceBookmarks(); BackgroundHelper.ExecuteUIThread(() => { DeviceBookmarks.Clear(); foreach (Bookmark bookmark in serviceBookmarks) { DeviceBookmarks.Add(new ItemViewModel() { Title = bookmark.Title, Url = bookmark.Url }); } }); }); } }
void RaiseCurrentRecordChanged(T oldValue, T newValue) { bool coerceSuccess = true; if (!coerceCurrentRecordInProgress) { coerceSuccess = CoerceCurrentRecord(newValue); if (!coerceSuccess) { BackgroundHelper.DoInBackground((ThreadStart)(() => { coerceCurrentRecordInProgress = true; CurrentRecord = oldValue; coerceCurrentRecordInProgress = false; })); } } if (coerceSuccess) { RaiseCurrentRecordChangedOverride(oldValue, newValue); } }
/// <inheritdoc /> /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { base.LoadContent(); Resources.AddStore(new DllResourceStore("Quaver.Resources.dll")); SteamManager.SendAvatarRetrievalRequest(SteamUser.GetSteamID().m_SteamID); // Load all game assets. Fonts.Load(); BackgroundHelper.Initialize(); // Load the user's skin SkinManager.Load(); // Create the global FPS counter. CreateFpsCounter(); VolumeController = new VolumeController() { Parent = GlobalUserInterface }; BackgroundManager.Initialize(); Transitioner.Initialize(); // Make the cursor appear over the volume controller. ListHelper.Swap(GlobalUserInterface.Children, GlobalUserInterface.Children.IndexOf(GlobalUserInterface.Cursor), GlobalUserInterface.Children.IndexOf(VolumeController)); IsReadyToUpdate = true; Logger.Debug($"Currently running Quaver version: `{Version}`", LogType.Runtime); #if VISUAL_TESTS Window.Title = $"Quaver Visual Test Runner"; #else Window.Title = !IsDeployedBuild ? $"Quaver - {Version}" : $"Quaver v{Version}"; QuaverScreenManager.ScheduleScreenChange(() => new MenuScreen()); #endif }