private bool IsClassNameAllowed(WindowInfo window) { string className = window.ClassName; if (!string.IsNullOrEmpty(className)) { return ignoreList.All(ignore => !className.Equals(ignore, StringComparison.InvariantCultureIgnoreCase)); } return true; }
private bool IsValidWindow(WindowInfo window) { return window != null && window.IsVisible && !string.IsNullOrEmpty(window.Text) && IsClassNameAllowed(window) && window.Rectangle.IsValid(); }
private bool IsValidWindow(WindowInfo window) { return(window != null && window.IsVisible && !string.IsNullOrEmpty(window.Text) && IsClassNameAllowed(window) && window.Rectangle.IsValid()); }
private void SelectHandle() { WindowState = FormWindowState.Minimized; bool capturing = false; try { Thread.Sleep(250); SimpleWindowInfo simpleWindowInfo = GetWindowInfo(); if (simpleWindowInfo != null) { selectedWindow = new WindowInfo(simpleWindowInfo.Handle); lblControlText.Text = selectedWindow.ClassName ?? string.Empty; selectedRectangle = simpleWindowInfo.Rectangle; lblSelectedRectangle.Text = selectedRectangle.ToString(); btnSelectRectangle.Enabled = btnCapture.Enabled = true; if (Options.StartCaptureAutomatically) { capturing = true; StartCapture(); } } else { btnCapture.Enabled = false; } } finally { if (!capturing) this.ForceActivate(); } }
private void btnSelectHandle_Click(object sender, EventArgs e) { Hide(); SimpleWindowInfo simpleWindowInfo; try { Thread.Sleep(250); simpleWindowInfo = GetWindowInfo(); } finally { Show(); } if (simpleWindowInfo != null) { selectedWindow = new WindowInfo(simpleWindowInfo.Handle); lblControlText.Text = selectedWindow.ClassName ?? String.Empty; btnCapture.Enabled = true; } else { btnCapture.Enabled = false; } }