private void AcceptTos(int processId) { var enbWindowHandle = WindowOperations.FindENBWindow(processId); WindowOperations.SetFocus(enbWindowHandle); WindowOperations.AcceptTos(enbWindowHandle); }
private void StopIntroPlay(int processId) { var enbWindowHandle = WindowOperations.FindENBWindow(processId); WindowOperations.SetFocus(enbWindowHandle); WindowOperations.PostEscapeMessageToClientProcess(enbWindowHandle); this.UpdateStatus("Interrupted sizzle", processId.ToString()); }
private void FlashClient(Process process) { if (process == null) { return; } WindowOperations.FlashWindowEx(WindowOperations.FindENBWindow(process.Id), 3); }
public ActionResponse Select(string name) { var result = WindowOperations.SetWindowByProcessName(name); return(new ActionResponse() { Succeeded = result, ErrorMessage = !result ? "Process Not Found" : "" }); }
public async void OkBtn_Click(object sender, RoutedEventArgs e) { _InProgressClosing = true; chkBoxCreatePreview.IsEnabled = false; chkBoxCreateZip.IsEnabled = false; OkBtn.IsEnabled = false; GenerateLivelyInfo(layout); Rect reviewPanel; #region previewgif //preview clip (animated gif file). if (SaveData.config.PreviewGIF.CaptureGif) { //generate screen capture images. for (int i = 0; i < gifTotalFrames; i++) { reviewPanel = WindowOperations.GetAbsolutePlacement(PreviewBorder, true); CaptureWindow.CopyScreen(saveDirectory, i.ToString(CultureInfo.InvariantCulture) + ".jpg", (int)(((int)reviewPanel.Left + (int)(reviewPanel.Right)) / 2f) - 192 / 2, (int)(((int)reviewPanel.Top + (int)(reviewPanel.Bottom)) / 2f) - 108 / 2, 192, 108); //384,216 await Task.Delay(gifAnimationDelay); this.Dispatcher.Invoke(() => { if ((i + 1) > gifProgressBar.Maximum) { gifProgressBar.Value = gifProgressBar.Maximum; } else { gifProgressBar.Value = i + 1; } }); } //create animated gif from captured images. await Task.Run(() => CreateGif()); } else { await Task.Delay(1000); //wait 1sec before capturing thumbnail..incase wallpaper is not loaded yet. } #endregion #region thumbnail // 200x200 thumbnail image capture. reviewPanel = WindowOperations.GetAbsolutePlacement(PreviewBorder, true); CaptureWindow.CopyScreen(saveDirectory, "lively_t.jpg", (int)(((int)reviewPanel.Left + (int)(reviewPanel.Right)) / 2f) - 200 / 2, (int)(((int)reviewPanel.Top + (int)(reviewPanel.Bottom)) / 2f) - 200 / 2, 200, 200); #endregion _InProgressClosing = false; this.Close(); }
/// <summary> /// Initializes the <see cref="AvaliableWindowsDataTable"/>. /// </summary> private static void InitDataTableRows() { AvaliableWindowsDataTable.Rows.Clear(); IEnumerable <Window> windows = WindowOperations.InitOpenWindows(true); foreach (Window window in windows) { DataRow row = AvaliableWindowsDataTable.NewRow(); row[0] = window.WindowIcon; row[1] = window.WindowName; AvaliableWindowsDataTable.Rows.Add(row); } }
private void SetClientLocation(NotifyingDataContext presetGroupRowContext) { if (presetGroupRowContext == null) { return; } var process = this.GetProcessSafe(presetGroupRowContext); if (process == null) { return; } var left = this.ParseInt(presetGroupRowContext["Left"]); var top = this.ParseInt(presetGroupRowContext["Top"]); var processMainWindowHandle = WindowOperations.FindENBWindow(process.Id); WindowOperations.MoveClientWindow(processMainWindowHandle, left, top); }
private void SetWindowText(NotifyingDataContext presetGroupRowContext) { if (presetGroupRowContext == null) { return; } var accountName = this.ParseString(presetGroupRowContext["AccountName"]); if (String.IsNullOrWhiteSpace(accountName)) { return; } var process = this.GetProcessSafe(presetGroupRowContext); if (process == null) { return; } WindowOperations.SetWindowText(WindowOperations.FindENBWindow(process.Id), $"Earth & Beyond - {accountName}"); }
private void LauncherTimerTick(object state) { var launcherInfo = state as LauncherInfo; if (launcherInfo == null) { return; } if (!this.IsLauncherProcessStillRunning(launcherInfo.ProcessId)) { launcherInfo.State = LauncherState.Stopped; this.UpdateStatus("LauncherTimerTick/Stopped", launcherInfo.ProcessId.ToString()); this.launcherTimer.Dispose(); return; } switch (launcherInfo.State) { case LauncherState.WaitingOnPlayButton: var isPlayButtonDisplayed = WindowOperations.IsLaucherPlayButtonDisplayed(Process.GetProcessById(launcherInfo.ProcessId).MainWindowHandle); if (isPlayButtonDisplayed) { launcherInfo.State = LauncherState.DisplayingPlayButton; this.UpdateStatus("LauncherTimerTick/DisplayingPlayButton", launcherInfo.ProcessId.ToString()); } return; case LauncherState.DisplayingPlayButton: launcherInfo.State = LauncherState.ClickedPlayButton; var launcherWindowHandle = Process.GetProcessById(launcherInfo.ProcessId).MainWindowHandle; WindowOperations.SetFocus(launcherWindowHandle); WindowOperations.LauncherPlayButton(launcherWindowHandle); break; } }
public async void OkBtn_Click(object sender, RoutedEventArgs e) { _InProgressClosing = true; chkBoxCreatePreview.IsEnabled = false; chkBoxCreateZip.IsEnabled = false; OkBtn.IsEnabled = false; GenerateLivelyInfo(layout); Rect previewPanelPos; Size previewPanelSize = WindowOperations.GetElementPixelSize(PreviewBorder); #region preview_images //preview clip (animated gif file). if (SaveData.config.PreviewGIF.CaptureGif) { //generate screen capture images. for (int i = 0; i < gifTotalFrames; i++) { //updating the position incase window is moved. previewPanelPos = WindowOperations.GetAbsolutePlacement(PreviewBorder, true); CaptureWindow.CopyScreen( saveDirectory, i.ToString(CultureInfo.InvariantCulture) + ".jpg", (int)previewPanelPos.Left, (int)previewPanelPos.Top, (int)previewPanelSize.Width, (int)previewPanelSize.Height); //SaveData.config.PreviewGIF.GifSize.Width + SaveData.config.PreviewGIF.GifOffsets.X, //SaveData.config.PreviewGIF.GifSize.Height + SaveData.config.PreviewGIF.GifOffsets.Y); //384,216 await Task.Delay(gifAnimationDelay); if ((i + 1) > gifProgressBar.Maximum) { gifProgressBar.Value = gifProgressBar.Maximum; } else { gifProgressBar.Value = i + 1; } } //create animated gif from captured images. await Task.Run(() => CreateGif()); } else { //wait before capturing thumbnail..incase wallpaper is not loaded yet. await Task.Delay(100); } //200x200 thumbnail image capture. //updating the position incase window is moved. previewPanelPos = WindowOperations.GetAbsolutePlacement(PreviewBorder, true); CaptureWindow.CopyScreen( saveDirectory, "lively_t.jpg", (int)previewPanelPos.Left + (int)previewPanelSize.Width / 5, (int)previewPanelPos.Top, (int)previewPanelSize.Height, (int)previewPanelSize.Height); #endregion _InProgressClosing = false; System.Windows.Application.Current.Dispatcher.Invoke(DispatcherPriority.Background, new ThreadStart(delegate { App.W.LoadWallpaperFromWpDataFolder(); })); this.Close(); }
private void PreviewWallpaper_Loaded(object sender, RoutedEventArgs e) { WindowOperations.SetProgramToFramework(this, processHWND, PreviewBorder); }
/// <summary> /// The blocking timer tick event. /// </summary> /// <param name="sender">The <see cref="object"/> sender.</param> /// <param name="e">The <see cref="EventArgs"/> e.</param> private static void BlockingTimerTick(object sender, EventArgs e) { WindowOperations.CheckTeamViewerMainWindowTitle(); }
private void ClientTimerTick(object state) { var clientInfo = state as ClientInfo; if (clientInfo == null) { return; } if (!this.IsClientProcessStillRunning(clientInfo.ProcessId)) { clientInfo.State = ClientState.Stopped; this.UpdateStatus("ClientTimerTick/Stopped", clientInfo.ProcessId.ToString()); this.RemoveClientTimer(clientInfo.ProcessId); return; } switch (clientInfo.State) { case ClientState.WaitingOnTOS: var displayingTOS = WindowOperations.IsTOSWindowDisplayed(clientInfo.ProcessId); if (displayingTOS) { clientInfo.State = ClientState.DisplayingTOS; this.UpdateStatus("ClientTimerTick/DisplayingTOS", clientInfo.ProcessId.ToString()); if (this.settings.Data.AutoAssignPresets) { this.AcceptTos(clientInfo.ProcessId); } } return; case ClientState.DisplayingTOS: var notDisplayingTOS = !WindowOperations.IsTOSWindowDisplayed(clientInfo.ProcessId); if (notDisplayingTOS) { clientInfo.State = ClientState.WaitingOnMain; this.UpdateStatus("ClientTimerTick/WaitingOnMain", clientInfo.ProcessId.ToString()); } return; case ClientState.WaitingOnMain: var windowHandle = WindowOperations.FindENBWindow(clientInfo.ProcessId); if (windowHandle == IntPtr.Zero) { return; } var isVisible = WindowOperations.IswindowVisible(windowHandle); if (!isVisible) { return; } clientInfo.State = ClientState.DisplayingMain; this.UpdateStatus("ClientTimerTick/DisplayingMain", clientInfo.ProcessId.ToString()); break; case ClientState.DisplayingMain: var threadCount = Process.GetProcessById(clientInfo.ProcessId).Threads.Count; if (threadCount < 20) { return; } clientInfo.State = ClientState.ReadyForInteraction; this.UpdateStatus("ClientTimerTick/ReadyForInteraction", clientInfo.ProcessId.ToString()); this.FillClientListInBackgroundWorker(); return; case ClientState.ReadyForInteraction: if (!this.settings.Data.AutoInterruptSizzle) { this.CheckIfWeNeedToSpawnMoreGameClientsInBackgroundWorker(); this.RemoveClientTimer(clientInfo.ProcessId); return; } clientInfo.State = ClientState.WaitingForSizzleKickoff1; this.UpdateStatus("ClientTimerTick/WaitingForSizzleKickoff1", clientInfo.ProcessId.ToString()); return; case ClientState.WaitingForSizzleKickoff1: if (!this.settings.Data.AutoInterruptSizzle) { this.RemoveClientTimer(clientInfo.ProcessId); return; } clientInfo.State = ClientState.WaitingForSizzleKickoff2; this.UpdateStatus("ClientTimerTick/WaitingForSizzleKickoff2", clientInfo.ProcessId.ToString()); return; case ClientState.WaitingForSizzleKickoff2: if (!this.settings.Data.AutoInterruptSizzle) { this.RemoveClientTimer(clientInfo.ProcessId); } this.StopIntroPlay(clientInfo.ProcessId); this.CheckIfWeNeedToSpawnMoreGameClientsInBackgroundWorker(); this.RemoveClientTimer(clientInfo.ProcessId); return; default: return; } }