/// <summary> /// Places the progress bar. If we can attach inside the existing /// header, then insert inside that - otherwise, the progress bar /// is just inserted inside the test column. /// </summary> private void PlaceProgressBar() { _progressBar = new TestRunProgress(); _progressBar.Height = 12; HtmlElement hookupElement = null; ScriptObjectCollection hcc = HtmlPage.Document.GetElementsByTagName("div"); for (int i = 0; i < hcc.Count; ++i) { HtmlElement htmlElement = hcc[i] as HtmlElement; if (htmlElement != null) { if (htmlElement.CssClass == TestColumnHeader.TestColumnIndicator) { hookupElement = htmlElement; break; } } } if (hookupElement == null) { LogContainer.Controls.Add(_progressBar); } else { hookupElement.AppendChild(_progressBar); } }
private void ManageEventHandlers(bool add) { ScriptObjectCollection element = HtmlPage.Document.GetElementsByTagName("body"); HtmlElement body = (element != null && element.Count > 0 ? element[0] as HtmlElement : null); if (add) { if (body != null) { body.AttachEvent("mousedown", (EventHandler)OnCancellationEvent); } Application.Current.RootVisual.MouseLeftButtonDown += OnCancellationEvent; Application.Current.Host.Content.Resized += OnCancellationEvent; } else { if (body != null) { body.DetachEvent("mousedown", (EventHandler)OnCancellationEvent); } Application.Current.RootVisual.MouseLeftButtonDown -= OnCancellationEvent; Application.Current.Host.Content.Resized -= OnCancellationEvent; } }