Bugzilla – Attachment 304144 Details for
Bug 494034
Some tests hang
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
IDP Log In
|
Forgot Password
[patch]
work in progress
preview.patch (text/plain), 215.67 KB, created by
Mario Carrion
on 2009-07-09 16:10:36 UTC
(
hide
)
Description:
work in progress
Filename:
MIME Type:
Creator:
Mario Carrion
Created:
2009-07-09 16:10:36 UTC
Size:
215.67 KB
patch
obsolete
>diff --git a/UIAutomationWinforms/UIAutomationWinforms/Makefile.am b/UIAutomationWinforms/UIAutomationWinforms/Makefile.am >index b3a0ff5..5a31de9 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Makefile.am >+++ b/UIAutomationWinforms/UIAutomationWinforms/Makefile.am >@@ -296,8 +296,8 @@ FILES = \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/AutomationNamePropertyEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/ButtonInvokePatternInvokedEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/CheckboxAutomationHasKeyboardFocusPropertyEvent.cs \ >- Mono.UIAutomation.Winforms.Events/DateTimePicker/PartAutomationIsEnabledPropertyEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/PartAutomationHasKeyboardFocusPropertyEvent.cs \ >+ Mono.UIAutomation.Winforms.Events/DateTimePicker/PartAutomationIsEnabledPropertyEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/PartListItemAutomationHasKeyboardFocusPropertyEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/PartListItemSelectionItemPatternElementSelectedEvent.cs \ > Mono.UIAutomation.Winforms.Events/DateTimePicker/PartListItemSelectionItemPatternIsSelectedEvent.cs \ >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/BalloonWindow/EmbeddedImageProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/BalloonWindow/EmbeddedImageProviderBehavior.cs >index fc2a8d4..d8163ee 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/BalloonWindow/EmbeddedImageProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/BalloonWindow/EmbeddedImageProviderBehavior.cs >@@ -67,13 +67,12 @@ namespace Mono.UIAutomation.Winforms.Behaviors.BalloonWindow > // from ThemeWin32Classic.cs > int borderSize = 8; > int iconSize = 0; >- if (Helper.SynchronizedGet<SWF.NotifyIcon.BalloonWindow, bool> (balloonWindow, >- b => !(balloonWindow.Icon == SWF.ToolTipIcon.None))) >+ if (balloonWindow.InvokeSync (c => !(c.Icon == SWF.ToolTipIcon.None))) > iconSize = 16; > if (iconSize == 0) > return Rect.Empty; > int imageX, imageY, imageWidth, imageHeight; >- >+ > Rect balloonRect > = (Rect) Provider.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id); > >@@ -81,7 +80,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.BalloonWindow > imageY = (int) balloonRect.Y + borderSize; > imageWidth = iconSize; > imageHeight = iconSize; >- >+ > Rect imageRect = new Rect (imageX, imageY, imageWidth, imageHeight); > balloonRect.Intersect (imageRect); > return balloonRect; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs >index 249a850..5c29b84 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Button/InvokeProviderBehavior.cs >@@ -90,12 +90,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Button > > public virtual void Invoke () > { >- if (Helper.SynchronizedGet<SWF.Button, bool> (button, b => !b.Enabled)) >+ if (button.InvokeSync (c => !c.Enabled)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (button, delegate { >- button.PerformClick (); >- }); >+ button.InvokeSync (delegate { button.PerformClick (); }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs >index 823d052..2c7e89a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/CheckBox/ToggleProviderBehavior.cs >@@ -87,28 +87,30 @@ namespace Mono.UIAutomation.Winforms.Behaviors.CheckBox > > public void Toggle () > { >- if (!Helper.SynchronizedGet<SWF.CheckBox, bool> (checkbox, c => c.Enabled)) >+ if (checkbox.InvokeSync (c => !c.Enabled)) > throw new ElementNotEnabledException (); > >- switch (Helper.SynchronizedGet<SWF.CheckBox, SWF.CheckState> (checkbox, >- c => c.CheckState)) { >+ SWF.CheckState newState = SWF.CheckState.Checked; >+ >+ switch (checkbox.InvokeSync (c => c.CheckState)) { > case SWF.CheckState.Checked: >- PerformToggle (checkbox, SWF.CheckState.Unchecked); >+ newState = SWF.CheckState.Unchecked; > break; > case SWF.CheckState.Unchecked: >- if (Helper.SynchronizedGet<SWF.CheckBox, bool> (checkbox, >- c => c.ThreeState)) >- PerformToggle (checkbox, SWF.CheckState.Indeterminate); >+ if (checkbox.InvokeSync (c => c.ThreeState)) >+ newState = SWF.CheckState.Indeterminate; > else >- PerformToggle (checkbox, SWF.CheckState.Checked); >+ newState = SWF.CheckState.Checked; > break; > // Control could still have been set to intermediate > // programatically, regardless of ThreeState value. > case SWF.CheckState.Indeterminate: > default: >- PerformToggle (checkbox, SWF.CheckState.Checked); >+ newState = SWF.CheckState.Checked; > break; > } >+ >+ checkbox.InvokeSync (delegate { PerformToggle (newState); }); > } > > public ToggleState ToggleState { >@@ -129,14 +131,8 @@ namespace Mono.UIAutomation.Winforms.Behaviors.CheckBox > > #region Private Methods > >- private void PerformToggle (SWF.CheckBox checkbox, SWF.CheckState state) >+ private void PerformToggle (SWF.CheckState state) > { >- if (checkbox.InvokeRequired == true) { >- checkbox.BeginInvoke (new PerformToggleDelegate (PerformToggle), >- new object [] { checkbox, state }); >- return; >- } >- > // NOTE: We can count on presence of InvokeOnClick; > // it is a protected member of CheckBox. > // >@@ -153,6 +149,4 @@ namespace Mono.UIAutomation.Winforms.Behaviors.CheckBox > } > #endregion > } >- >- delegate void PerformToggleDelegate (SWF.CheckBox checkbox, SWF.CheckState state); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ButtonInvokeBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ButtonInvokeBehavior.cs >index f1c4450..b0eef15 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ButtonInvokeBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ButtonInvokeBehavior.cs >@@ -83,29 +83,15 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > > public void Invoke () > { >- if (Helper.SynchronizedGet<SWF.Control, bool> (Provider.Control, >- b => !b.Enabled)) >+ if (Provider.Control.InvokeSync (b => !b.Enabled)) > throw new ElementNotEnabledException (); >- >- PerformComboBoxClick ((SWF.ComboBox) Provider.Control); >- } >- >- #endregion > >- #region Private Methods >- >- private void PerformComboBoxClick (SWF.ComboBox combobox) >- { >- if (Provider.Control.InvokeRequired == true) { >- Provider.Control.BeginInvoke (new PerformComboBoxClickDelegate (PerformComboBoxClick), >- new object [] { combobox }); >- return; >- } >- combobox.DroppedDown = !combobox.DroppedDown; >+ SWF.ComboBox combobox = (SWF.ComboBox) Provider.Control; >+ combobox.InvokeSync (delegate { >+ combobox.DroppedDown = !combobox.DroppedDown; >+ }); > } > >- #endregion >+ #endregion > } >- >- delegate void PerformComboBoxClickDelegate (SWF.ComboBox combobox); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ExpandCollapseProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ExpandCollapseProviderBehavior.cs >index 598f04f..d1ec37a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ExpandCollapseProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ExpandCollapseProviderBehavior.cs >@@ -80,8 +80,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > public ExpandCollapseState ExpandCollapseState { > get { > SWF.ComboBox combobox = (SWF.ComboBox) Provider.Control; >- if (Helper.SynchronizedGet<SWF.ComboBox, bool> (combobox, >- c => c.DroppedDown)) >+ if (combobox.InvokeSync (c => c.DroppedDown)) > return ExpandCollapseState.Expanded; > else > return ExpandCollapseState.Collapsed; >@@ -92,11 +91,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > { > SWF.ComboBox combobox = (SWF.ComboBox) Provider.Control; > >- if (Helper.SynchronizedGet<SWF.ComboBox, bool> (combobox, >- c => !c.Enabled)) >+ if (combobox.InvokeSync (c => !c.Enabled)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (combobox, delegate { >+ combobox.InvokeSync (delegate { > combobox.DroppedDown = false; > }); > } >@@ -105,11 +103,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > { > SWF.ComboBox combobox = (SWF.ComboBox) Provider.Control; > >- if (Helper.SynchronizedGet<SWF.ComboBox, bool> (combobox, >- c => !c.Enabled)) >+ if (combobox.InvokeSync (c => !c.Enabled)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (combobox, delegate { >+ combobox.InvokeSync (delegate { > combobox.DroppedDown = true; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ListBoxSelectionProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ListBoxSelectionProviderBehavior.cs >index c606dca..23483f8 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ListBoxSelectionProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ListBoxSelectionProviderBehavior.cs >@@ -71,8 +71,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > > public override bool IsSelectionRequired { > get { >- return Helper.SynchronizedGet<SWF.ComboBox, bool> ((SWF.ComboBox) Provider.Control, >- c => c.SelectedIndex != -1); >+ return ((SWF.ComboBox) Provider.Control).InvokeSync (c => c.SelectedIndex != -1); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/SelectionProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/SelectionProviderBehavior.cs >index 60cb5b7..52baf6c 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/SelectionProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/SelectionProviderBehavior.cs >@@ -96,8 +96,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > > public virtual bool IsSelectionRequired { > get { >- return Helper.SynchronizedGet<SWF.ComboBox, bool> ((SWF.ComboBox) Provider.Control, >- c => c.SelectedIndex != -1); >+ return ((SWF.ComboBox) Provider.Control).InvokeSync (c => c.SelectedIndex != -1); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ValueProviderBehavior.cs >index 58d1187..23bedbf 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ComboBox/ValueProviderBehavior.cs >@@ -83,11 +83,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > #region IValueProvider Interface > > public bool IsReadOnly { >- get { return Helper.SynchronizedGet<Control, bool> (Provider.Control, c => !c.Enabled); } >+ get { return Provider.Control.InvokeSync (c => !c.Enabled); } > } > > public string Value { >- get { return Helper.SynchronizedGet<Control, string> (Provider.Control, c => c.Text); } >+ get { return Provider.Control.InvokeSync (c => c.Text); } > } > > public void SetValue (string value) >@@ -95,7 +95,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ComboBox > if (IsReadOnly == true) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (Provider.Control, delegate { >+ Provider.Control.InvokeSync (delegate { > Provider.Control.Text = value; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/TransformProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/TransformProviderBehavior.cs >index f09a49e..8405e0f 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/TransformProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/TransformProviderBehavior.cs >@@ -91,18 +91,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > > public bool CanMove { > get { >- //return Helper.SynchronizedGet<SWF.Form, bool> (form, >- return Helper.SynchronizedGet<SWF.Form, bool> ((SWF.Form) Provider.Control, >- f => f.WindowState == SWF.FormWindowState.Normal); >+ return form.InvokeSync (f => f.WindowState == SWF.FormWindowState.Normal); > } > } > > public bool CanResize { > get { >- //switch (Helper.SynchronizedGet<SWF.Form, SWF.FormBorderStyle> (form, >- //switch (Helper.SynchronizedGet<SWF.Form, SWF.FormBorderStyle> ((SWF.Form) Provider.Control, >- // v => v.FormBorderStyle)) { >- switch (form.FormBorderStyle) { >+ switch (form.InvokeSync (f => f.FormBorderStyle)) { > case SWF.FormBorderStyle.Fixed3D: > case SWF.FormBorderStyle.FixedDialog: > case SWF.FormBorderStyle.FixedSingle: >@@ -125,7 +120,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > if (!CanMove) > throw new InvalidOperationException ("CanMove is false"); > >- Helper.SynchronizedSet (form, delegate { >+ form.InvokeSync (delegate { > form.Location = new Point ((int) x, (int) y); > }); > } >@@ -137,7 +132,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > if (!CanResize) > throw new InvalidOperationException ("CanResize is false"); > >- Helper.SynchronizedSet (form, delegate { >+ form.InvokeSync (delegate { > form.Size = new Size ((int) width, (int) height); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/WindowProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/WindowProviderBehavior.cs >index 91d3ef1..3061af9 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/WindowProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Form/WindowProviderBehavior.cs >@@ -141,8 +141,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > > public void SetVisualState (WindowVisualState state) > { >- SWF.FormWindowState newState = Helper.SynchronizedGet<SWF.Form, SWF.FormWindowState> (form, >- f => f.WindowState); >+ SWF.FormWindowState newState = form.InvokeSync (f => f.WindowState); > switch (state) { > case WindowVisualState.Maximized: > newState = SWF.FormWindowState.Maximized; >@@ -155,48 +154,28 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > break; > } > >- Helper.SynchronizedSet (form, delegate { >- form.WindowState = newState; >- }); >+ form.InvokeSync (delegate { form.WindowState = newState; }); > } > > public void Close () > { >- Helper.SynchronizedSet (form, delegate { >- form.Close (); >- }); >+ form.InvokeSync (delegate { form.Close (); }); > } > > public bool Minimizable { >- get { >- //return Helper.SynchronizedGet<SWF.Form, bool> (form, >- return Helper.SynchronizedGet<SWF.Form, bool> ((SWF.Form) Provider.Control, >- f => f.MinimizeBox); >- } >+ get { return form.InvokeSync (f => f.MinimizeBox); } > } > > public bool Maximizable { >- get { >- //return Helper.SynchronizedGet<SWF.Form, bool> (form, >- return Helper.SynchronizedGet<SWF.Form, bool> ((SWF.Form) Provider.Control, >- f => f.MaximizeBox); >- } >+ get { return form.InvokeSync (f => f.MaximizeBox); } > } > > public bool IsTopmost { >- get { >- //return Helper.SynchronizedGet<SWF.Form, bool> (form, >- return Helper.SynchronizedGet<SWF.Form, bool> ((SWF.Form) Provider.Control, >- f => f.TopMost); >- } >+ get { return form.InvokeSync (f => f.TopMost); } > } > > public bool IsModal { >- get { >- return Helper.SynchronizedGet<SWF.Form, bool> ((SWF.Form) Provider.Control, >-// return Helper.SynchronizedGet<SWF.Form, bool> (form, >- f => f.Modal); >- } >+ get { return form.InvokeSync (f => f.Modal); } > } > > public WindowInteractionState InteractionState { >@@ -211,8 +190,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Form > > public WindowVisualState VisualState { > get { >- switch (Helper.SynchronizedGet<SWF.Form, SWF.FormWindowState> (form, >- f => f.WindowState)) { >+ switch (form.InvokeSync (f => f.WindowState)) { > case SWF.FormWindowState.Maximized: > return WindowVisualState.Maximized; > case SWF.FormWindowState.Minimized: >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/ScrollProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/ScrollProviderBehavior.cs >index 80b8e1b..1202c71 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/ScrollProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/ScrollProviderBehavior.cs >@@ -105,12 +105,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > if (HorizontallyScrollable == false) > return ScrollPatternIdentifiers.NoScroll; > else { >- return Helper.SynchronizedGet<SWF.ScrollBar, double> (hscrollbar, >- delegate { >- if (hscrollbar.Maximum == 0) >+ return hscrollbar.InvokeSync (c => { >+ if (c.Maximum == 0) > return ScrollPatternIdentifiers.NoScroll; > else >- return (hscrollbar.Value * 100) / hscrollbar.Maximum; >+ return (double) ((c.Value * 100) / c.Maximum); > }); > } > } >@@ -138,12 +137,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > if (VerticallyScrollable == false) > return ScrollPatternIdentifiers.NoScroll; > else { >- return Helper.SynchronizedGet<SWF.ScrollBar, double> (vscrollbar, >- delegate { >- if (vscrollbar.Maximum == 0) >+ return vscrollbar.InvokeSync (c => { >+ if (c.Maximum == 0) > return ScrollPatternIdentifiers.NoScroll; > else >- return (vscrollbar.Value * 100) / vscrollbar.Maximum; >+ return (double) ((c.Value * 100) / c.Maximum); > }); > } > } >@@ -179,9 +177,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > if (horizontalPercent < 0 || horizontalPercent > 100) > throw new ArgumentOutOfRangeException (); > else { >- double maximum = Helper.SynchronizedGet<SWF.ScrollBar, double> (hscrollbar, >- h => h.Maximum); >- PerformScrollByPercent (hscrollbar, (int) ((horizontalPercent * maximum) / 100)); >+ double maximum = hscrollbar.InvokeSync (h => h.Maximum); >+ hscrollbar.InvokeSync (delegate { >+ hscrollbar.Value = (int) ((horizontalPercent * maximum) / 100); >+ }); > } > } > >@@ -189,9 +188,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > if (verticalPercent < 0 || verticalPercent > 100) > throw new ArgumentOutOfRangeException (); > else { >- double maximum = Helper.SynchronizedGet<SWF.ScrollBar, double> (vscrollbar, >- v => v.Maximum); >- PerformScrollByPercent (vscrollbar, (int) ((verticalPercent * maximum) / 100)); >+ double maximum = vscrollbar.InvokeSync (v => v.Maximum); >+ hscrollbar.InvokeSync (delegate { >+ vscrollbar.Value = (int) ((verticalPercent * maximum) / 100); >+ }); > } > } > } >@@ -242,28 +242,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > invoke > = (Action<SWF.ScrollBar>) Delegate.CreateDelegate (typeof (Action<SWF.ScrollBar>), > methodInfo); >- PerformScrollByAmount (scrollbar); >- } >- >- private void PerformScrollByAmount (SWF.ScrollBar scrollbar) >- { >- if (scrollbar.InvokeRequired == true) { >- scrollbar.BeginInvoke (new ScrollByAmountDelegate (PerformScrollByAmount), >- new object [] { scrollbar }); >- return; >- } >- invoke (scrollbar); >- invoke = null; >- } >- >- private void PerformScrollByPercent (SWF.ScrollBar scrollbar, int value) >- { >- if (scrollbar.InvokeRequired == true) { >- scrollbar.BeginInvoke (new ScrollByPercentDelegate (PerformScrollByPercent), >- new object [] { scrollbar, value }); >- return; >- } >- scrollbar.Value = value; >+ >+ scrollbar.InvokeSync (delegate { >+ invoke (scrollbar); >+ invoke = null; >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/SelectionItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/SelectionItemProviderBehavior.cs >index ef45426..174f86a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/SelectionItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/Generic/SelectionItemProviderBehavior.cs >@@ -123,7 +123,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > if (IsSelected) > return; > >- Helper.SynchronizedSet (itemProvider.ContainerControl, delegate { >+ itemProvider.ContainerControl.InvokeSync (delegate { > itemProvider.Select (); > }); > } >@@ -163,7 +163,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.Generic > > private void PerformUnselect () > { >- Helper.SynchronizedSet (itemProvider.ContainerControl, delegate { >+ itemProvider.ContainerControl.InvokeSync (delegate { > itemProvider.Unselect (); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/LinkLabel/InvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/LinkLabel/InvokeProviderBehavior.cs >index 6afb4b9..4279568 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/LinkLabel/InvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/LinkLabel/InvokeProviderBehavior.cs >@@ -86,49 +86,46 @@ namespace Mono.UIAutomation.Winforms.Behaviors.LinkLabel > #region IHypertext Specialization > > public int NumberOfLinks { >- get { >- return Helper.SynchronizedGet<SWF.LinkLabel, int> (linkLabel, >- l=> l.Links.Count); >- } >+ get { return linkLabel.InvokeSync (c => c.Links.Count); } > } > > public int Start (int index) > { >- return Helper.SynchronizedGet<SWF.LinkLabel, int> (linkLabel, delegate { >- if (index >= linkLabel.Links.Count || index < 0) >+ return linkLabel.InvokeSync (c => { >+ if (index >= c.Links.Count || index < 0) > return -1; > else >- return linkLabel.Links [index].Start; >+ return c.Links [index].Start; > }); > } > > public int Length (int index) > { >- return Helper.SynchronizedGet<SWF.LinkLabel, int> (linkLabel, delegate { >- if (index >= linkLabel.Links.Count || index < 0) >+ return linkLabel.InvokeSync (c => { >+ if (index >= c.Links.Count || index < 0) > return -1; > else >- return linkLabel.Links [index].Length; >+ return c.Links [index].Length; > }); > } > > public string Uri (int index) > { >- return Helper.SynchronizedGet<SWF.LinkLabel, string> (linkLabel, delegate { >- if (index >= linkLabel.Links.Count || index < 0) >+ return linkLabel.InvokeSync (c => { >+ if (index >= c.Links.Count || index < 0) > return null; > else >- return linkLabel.Links [index].LinkData as string; >+ return c.Links [index].LinkData as string; > }); > } > > public bool Enabled (int index) > { >- return Helper.SynchronizedGet<SWF.LinkLabel, bool> (linkLabel, delegate { >- if (!linkLabel.Enabled || index >= linkLabel.Links.Count || index < 0) >+ return linkLabel.InvokeSync (c => { >+ if (!c.Enabled || index >= c.Links.Count || index < 0) > return false; > else >- return linkLabel.Links [index].Enabled; >+ return c.Links [index].Enabled; > }); > } > >@@ -137,9 +134,8 @@ namespace Mono.UIAutomation.Winforms.Behaviors.LinkLabel > if (!Enabled (index)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (linkLabel, delegate { >- >- if (index >= linkLabel.Links.Count || index < 0) >+ linkLabel.InvokeSync (c => { >+ if (index >= c.Links.Count || index < 0) > return; > > MethodInfo methodInfo = typeof (SWF.LinkLabel).GetMethod ("OnLinkClicked", >@@ -152,9 +148,9 @@ namespace Mono.UIAutomation.Winforms.Behaviors.LinkLabel > methodInfo); > > SWF.LinkLabelLinkClickedEventArgs args >- = new SWF.LinkLabelLinkClickedEventArgs (linkLabel.Links [index], >+ = new SWF.LinkLabelLinkClickedEventArgs (c.Links [index], > SWF.MouseButtons.Left); >- invokeMethod (linkLabel, args); >+ invokeMethod (c, args); > }); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListBox/SelectionProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListBox/SelectionProviderBehavior.cs >index 4778816..053bdd2 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListBox/SelectionProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListBox/SelectionProviderBehavior.cs >@@ -95,9 +95,8 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListBox > get { > SWF.ListBox listBoxControl = (SWF.ListBox) Provider.Control; > >- return Helper.SynchronizedGet<SWF.ListBox, bool> (listBoxControl, >- l => l.SelectionMode == SWF.SelectionMode.MultiExtended >- || l.SelectionMode == SWF.SelectionMode.MultiSimple); >+ return listBoxControl.InvokeSync (c => c.SelectionMode == SWF.SelectionMode.MultiExtended >+ || c.SelectionMode == SWF.SelectionMode.MultiSimple); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ScrollItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ScrollItemProviderBehavior.cs >index 3b0dcd6..c6d3f4f 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ScrollItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ScrollItemProviderBehavior.cs >@@ -70,7 +70,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListItem > public void ScrollIntoView () > { > IListProvider itemProvider = ((ListItemProvider) Provider).ListProvider; >- Helper.SynchronizedSet (itemProvider.Control, delegate { >+ itemProvider.Control.InvokeSync (delegate { > itemProvider.ScrollItemIntoView ((ListItemProvider) Provider); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ToggleProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ToggleProviderBehavior.cs >index 2b99a51..481d99d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ToggleProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListItem/ToggleProviderBehavior.cs >@@ -79,7 +79,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListItem > { > ListItemProvider provider = (ListItemProvider) Provider; > >- Helper.SynchronizedSet (provider.ListProvider.Control, delegate { >+ provider.ListProvider.Control.InvokeSync (delegate { > provider.ListProvider.ToggleItem (provider); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GridProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GridProviderBehavior.cs >index 2cc608c..e0c7d4d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GridProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GridProviderBehavior.cs >@@ -89,15 +89,15 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > > public int ColumnCount { > get { >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, delegate { >- if (listView.View == SWF.View.Details) >- return listView.Columns.Count; >+ return listView.InvokeSync (c => { >+ if (c.View == SWF.View.Details) >+ return c.Columns.Count; > else { //Is View.List > if (RowCount == 0) > return -1; > >- bool module = listView.Items.Count % RowCount > 0; >- return (listView.Items.Count / RowCount) + (module ? 1 : 0); >+ bool module = c.Items.Count % RowCount > 0; >+ return (c.Items.Count / RowCount) + (module ? 1 : 0); > } > }); > } >@@ -105,11 +105,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > > public int RowCount { > get { >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, delegate { >- if (listView.View == SWF.View.Details) >- return listView.Items.Count; >+ return listView.InvokeSync (c => { >+ if (c.View == SWF.View.Details) >+ return c.Items.Count; > else //Is View.List >- return listView.UIARows; >+ return c.UIARows; > }); > } > } >@@ -125,8 +125,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > > ListViewProvider provider = (ListViewProvider) Provider; > >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- l => l.View == SWF.View.Details)) { >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) { > // FIXME: In Vista when listView.Groups == 0 no Groups are added, > // and we should iterate when listView.Groups > 0 > SWF.ListViewItem item = listView.Items [row]; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GroupGridProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GroupGridProviderBehavior.cs >index 4de1211..eb0a4f4 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GroupGridProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/GroupGridProviderBehavior.cs >@@ -97,12 +97,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > > public int ColumnCount { > get { >- return Helper.SynchronizedGet<SWF.ListView, int> (viewGroupProvider.ListView, >- delegate { >+ return viewGroupProvider.ListView.InvokeSync (c => { > if (viewGroupProvider.ListView.View == SWF.View.Details) >- return viewGroupProvider.ListView.Columns.Count; >+ return c.Columns.Count; > else { >- int maxColums = viewGroupProvider.ListView.UIAColumns; >+ int maxColums = c.UIAColumns; > int itemsInGroup = ItemsInGroupCount (); > > if (itemsInGroup < maxColums) >@@ -138,14 +137,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > > private int ItemsInGroupCount () > { >- return Helper.SynchronizedGet<SWF.ListView, int> (viewGroupProvider.ListView, >- delegate { >+ return viewGroupProvider.ListView.InvokeSync (c => { > ListViewProvider listViewProvider > = (ListViewProvider) ProviderFactory.FindProvider (viewGroupProvider.ListView); > if (listViewProvider.IsDefaultGroup (viewGroupProvider.Group) == true) { > int itemsInGroup = 0; >- for (int index = 0; index < viewGroupProvider.ListView.Items.Count; index++) { >- if (viewGroupProvider.ListView.Items [index].Group == null) >+ for (int index = 0; index < c.Items.Count; index++) { >+ if (c.Items [index].Group == null) > itemsInGroup++; > } > return itemsInGroup; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemCheckBoxToggleProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemCheckBoxToggleProviderBehavior.cs >index b63b6d6..b56bc25 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemCheckBoxToggleProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemCheckBoxToggleProviderBehavior.cs >@@ -85,7 +85,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > { > ListItemProvider provider = checkboxProvider.ItemProvider; > >- Helper.SynchronizedSet (provider.ListProvider.Control, delegate { >+ provider.ListProvider.Control.InvokeSync (delegate { > provider.ListProvider.ToggleItem (provider); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemClipboardProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemClipboardProviderBehavior.cs >index dbf67ba..ac2466c 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemClipboardProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemClipboardProviderBehavior.cs >@@ -77,7 +77,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > position = (int) System.Math.Min (position, text.Length); > > string newValue = viewItem.Text.Insert (position, SWF.Clipboard.GetText ()); >- Helper.SynchronizedSet (viewItem.ListView, delegate { >+ viewItem.ListView.InvokeSync (delegate { > viewItem.Text = newValue; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditGridItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditGridItemProviderBehavior.cs >index 04b83a8..b2df7f4 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditGridItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditGridItemProviderBehavior.cs >@@ -106,20 +106,14 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > public int Row { > get { > SWF.ListView listView = editProvider.ItemProvider.ListView; >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, >- delegate { >- return listView.Items.IndexOf (editProvider.ItemProvider.ListViewItem); >- }); >+ return listView.InvokeSync (c => c.Items.IndexOf (editProvider.ItemProvider.ListViewItem) ); > } > } > > public int Column { > get { > SWF.ListView listView = editProvider.ItemProvider.ListView; >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, >- delegate { >- return listView.Columns.IndexOf (editProvider.ColumnHeader); >- }); >+ return listView.InvokeSync (c => c.Columns.IndexOf (editProvider.ColumnHeader) ); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditValueProviderBehavior.cs >index da17383..5877bfb 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEditValueProviderBehavior.cs >@@ -102,17 +102,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > } > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- l => !l.LabelEdit); >- } >+ get { return listView.InvokeSync (l => !l.LabelEdit); } > } > > public string Value { > get { >- return Helper.SynchronizedGet<SWF.ListView, string> (listView, >- delegate { >- int indexOf = listView.Columns.IndexOf (columnHeader); >+ return listView.InvokeSync (c => { >+ int indexOf = c.Columns.IndexOf (columnHeader); > > if (indexOf < 0 || indexOf >= listViewItem.SubItems.Count) > return string.Empty; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEmbeddedImageProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEmbeddedImageProviderBehavior.cs >index 95e1a7c..2ecf887 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEmbeddedImageProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemEmbeddedImageProviderBehavior.cs >@@ -68,15 +68,15 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > if (item == null || item.ListView == null) > return System.Windows.Rect.Empty; > >- return Helper.SynchronizedGet<SWF.ListView, System.Windows.Rect> (item.ListView, delegate { >+ return item.ListView.InvokeSync (c => { > if (item.ImageIndex == -1 && item.ImageKey == string.Empty) > return System.Windows.Rect.Empty; > > SWF.ImageList imageList = null; >- if (item.ListView.View == SWF.View.LargeIcon) >- imageList = item.ListView.LargeImageList; >+ if (c.View == SWF.View.LargeIcon) >+ imageList = c.LargeImageList; > else >- imageList = item.ListView.SmallImageList; >+ imageList = c.SmallImageList; > > if (imageList == null) > return System.Windows.Rect.Empty; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemGridItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemGridItemProviderBehavior.cs >index 2879443..93d5e27 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemGridItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemGridItemProviderBehavior.cs >@@ -107,10 +107,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > get { > SWF.ListView view = (SWF.ListView) viewProvider.Control; > >- return Helper.SynchronizedGet<SWF.ListView, int> (view, delegate { >- if (view.View == SWF.View.List) //From Top to Bottom >+ return view.InvokeSync (c => { >+ if (c.View == SWF.View.List) //From Top to Bottom > return MaxRows == 0 ? -1 : IndexOf % MaxRows; >- else if (view.View == SWF.View.Details) >+ else if (c.View == SWF.View.Details) > return itemProvider.Index; > else //From Left to Right > return MaxColumns == 0 ? -1 : IndexOf / MaxColumns; >@@ -122,10 +122,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > get { > SWF.ListView view = (SWF.ListView) viewProvider.Control; > >- return Helper.SynchronizedGet<SWF.ListView, int> (view, delegate { >- if (view.View == SWF.View.List) //From Top to Bottom >+ return view.InvokeSync (c => { >+ if (c.View == SWF.View.List) //From Top to Bottom > return MaxRows == 0 ? -1 : IndexOf / MaxRows; >- else if (view.View == SWF.View.Details) // Always 0 >+ else if (c.View == SWF.View.Details) // Always 0 > return 0; > else //From Left to Right > return IndexOf - (Row * MaxColumns); >@@ -153,19 +153,18 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > get { > SWF.ListViewItem item = (SWF.ListViewItem) itemProvider.ObjectItem; > >- return Helper.SynchronizedGet<SWF.ListView, int> (view, delegate { >- >- if (view.View == SWF.View.List || view.ShowGroups == false) >- return view.Items.IndexOf (item); >+ return view.InvokeSync (c => { >+ if (c.View == SWF.View.List || c.ShowGroups == false) >+ return c.Items.IndexOf (item); > > if (viewProvider.IsDefaultGroup (group) == true) { > int indexOf = 0; > bool found = false; > > //TODO: Is this OK?? >- for (int index = 0; index < view.Items.Count; index++) { >- if (view.Items [index].Group == null) { >- if (view.Items [index] == item) { >+ for (int index = 0; index < c.Items.Count; index++) { >+ if (c.Items [index].Group == null) { >+ if (c.Items [index] == item) { > found = true; > break; > } >@@ -181,11 +180,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > } > > private int MaxColumns { >- get { return Helper.SynchronizedGet<SWF.ListView, int> (view, v => v.UIAColumns); } >+ get { return view.InvokeSync (v => v.UIAColumns); } > } > > private int MaxRows { >- get { return Helper.SynchronizedGet<SWF.ListView, int> (view, v => v.UIARows); } >+ get { return view.InvokeSync (v => v.UIARows); } > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemValueProviderBehavior.cs >index 6f073a9..7809aff 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemValueProviderBehavior.cs >@@ -86,16 +86,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > if (IsReadOnly == true) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (viewItem.ListView, delegate { >+ viewItem.ListView.InvokeSync (delegate { > viewItem.Text = value; > }); > } > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.ListView, bool> (viewItem.ListView, >- v => !v.LabelEdit); >- } >+ get { return viewItem.ListView.InvokeSync (v => !v.LabelEdit); } > } > > public string Value { >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/SelectionProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/SelectionProviderBehavior.cs >index 488fd1b..af2dfcb 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/SelectionProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ListView/SelectionProviderBehavior.cs >@@ -95,8 +95,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ListView > public bool CanSelectMultiple { > get { > SWF.ListView listview = (SWF.ListView) Provider.Control; >- return Helper.SynchronizedGet<SWF.ListView, bool> (listview, >- l => l.MultiSelect); >+ return listview.InvokeSync (c => c.MultiSelect); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/MaskedTextBox/InsertDeleteTextProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/MaskedTextBox/InsertDeleteTextProviderBehavior.cs >index 27c52c3..74a555d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/MaskedTextBox/InsertDeleteTextProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/MaskedTextBox/InsertDeleteTextProviderBehavior.cs >@@ -64,13 +64,12 @@ namespace Mono.UIAutomation.Winforms.Behaviors.MaskedTextBox > // rejected as it contains too many characters. > public void InsertText (string str, ref int position) > { >- if (Helper.SynchronizedGet<SWF.MaskedTextBox, bool> (maskedTextBox, >- m => m.ReadOnly)) >+ if (maskedTextBox.InvokeSync (m => m.ReadOnly)) > throw new ElementNotEnabledException (); > > int newPosition = position; > >- Helper.SynchronizedSet (maskedTextBox, delegate { >+ maskedTextBox.InvokeSync (delegate { > > System.ComponentModel.MaskedTextProvider prov > = maskedTextBox.MaskedTextProvider; >@@ -130,11 +129,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.MaskedTextBox > > public void DeleteText (int start, int end) > { >- if (Helper.SynchronizedGet<SWF.MaskedTextBox, bool> (maskedTextBox, >- m => m.ReadOnly)) >+ if (maskedTextBox.InvokeSync (m => m.ReadOnly)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (maskedTextBox, delegate { >+ maskedTextBox.InvokeSync (delegate { > // MaskedTextProvider.RemoveAt does not work for this. > System.ComponentModel.MaskedTextProvider prov > = maskedTextBox.MaskedTextProvider; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs >index b5789ac..81423e3 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/EditableRangeProviderBehavior.cs >@@ -65,18 +65,17 @@ namespace Mono.UIAutomation.Winforms.Behaviors.NumericUpDown > #region IEditableRange Members > public void BeginEdit (string text) > { >- if (Helper.SynchronizedGet<SWF.NumericUpDown, bool> (numericUpDown, >- n => numericUpDown.ReadOnly)) >+ if (numericUpDown.InvokeSync (n => numericUpDown.ReadOnly)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (numericUpDown, delegate { >+ numericUpDown.InvokeSync (delegate { > numericUpDown.txtView.Text = text; > }); > } > > public void CommitEdit () > { >- Helper.SynchronizedSet (numericUpDown, delegate { >+ numericUpDown.InvokeSync (delegate { > decimal value = decimal.Parse (numericUpDown.Text); > if (value < numericUpDown.Minimum) > value = numericUpDown.Minimum; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs >index c51bca5..7ae7683 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/NumericUpDown/RangeValueProviderBehavior.cs >@@ -107,41 +107,26 @@ namespace Mono.UIAutomation.Winforms.Behaviors.NumericUpDown > #region IRangeValueProvider Members > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.NumericUpDown, bool> (numericUpDown, >- n => n.ReadOnly); >- } >+ get { return numericUpDown.InvokeSync (c => c.ReadOnly); } > } > > public double Minimum { >- get { >- return Helper.SynchronizedGet<SWF.NumericUpDown, double> (numericUpDown, >- n => (double) n.Minimum); >- } >+ get { return numericUpDown.InvokeSync (c => (double) c.Minimum); } > } > > public double Maximum { >- get { >- return Helper.SynchronizedGet<SWF.NumericUpDown, double> (numericUpDown, >- n => (double) numericUpDown.Maximum); >- } >+ get { return numericUpDown.InvokeSync (c => (double) c.Maximum); } > } > > public double LargeChange { > get { return double.NaN; } > } > public double SmallChange { >- get { >- return Helper.SynchronizedGet<SWF.NumericUpDown, double> (numericUpDown, >- n => (double) numericUpDown.Increment); >- } >+ get { return numericUpDown.InvokeSync (c => (double) c.Increment); } > } > > public double Value { >- get { >- return Helper.SynchronizedGet<SWF.NumericUpDown, double> (numericUpDown, >- n => (double) numericUpDown.Value); >- } >+ get { return numericUpDown.InvokeSync (c => (double) c.Value); } > } > > public void SetValue (double value) >@@ -149,9 +134,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.NumericUpDown > if (value < Minimum || value > Maximum) > throw new ArgumentOutOfRangeException (); > >- Helper.SynchronizedSet (numericUpDown, delegate { >- numericUpDown.Value = (decimal) value; >- }); >+ numericUpDown.InvokeSync (delegate { numericUpDown.Value = (decimal) value; }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs >index 863a81a..fc50eed 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/PictureBox/EmbeddedImageProviderBehavior.cs >@@ -63,13 +63,12 @@ namespace Mono.UIAutomation.Winforms.Behaviors.PictureBox > #region IEmbeddedImageProvider Interface > public Rect Bounds { > get { >- return Helper.SynchronizedGet<SWF.PictureBox, Rect> (control, >- delegate { >- if (control.Image == null) >+ return control.InvokeSync (c => { >+ if (c.Image == null) > return Rect.Empty; > > GraphicsUnit unit = GraphicsUnit.Pixel; >- RectangleF rectF = control.Image.GetBounds (ref unit); >+ RectangleF rectF = c.Image.GetBounds (ref unit); > > if (unit != GraphicsUnit.Pixel) > return Rect.Empty; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ProgressBar/RangeValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ProgressBar/RangeValueProviderBehavior.cs >index 5520b4b..b3f5eae 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ProgressBar/RangeValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ProgressBar/RangeValueProviderBehavior.cs >@@ -101,7 +101,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ProgressBar > #region IRangeValueProvider Members > > public double Value { >- get { return Helper.SynchronizedGet<SWF.ProgressBar, double> (progressBar, p => p.Value); } >+ get { return progressBar.InvokeSync (p => p.Value); } > } > > public bool IsReadOnly { >@@ -129,7 +129,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ProgressBar > if (value < Minimum || value > Maximum) > throw new ArgumentOutOfRangeException (); > >- Helper.SynchronizedSet (progressBar, delegate { >+ progressBar.InvokeSync (delegate { > progressBar.Value = (int) value; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/RadioButton/SelectionItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/RadioButton/SelectionItemProviderBehavior.cs >index 04c285e..8f72498 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/RadioButton/SelectionItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/RadioButton/SelectionItemProviderBehavior.cs >@@ -120,7 +120,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.RadioButton > > public void Select () > { >- Helper.SynchronizedSet (radioButton, delegate { >+ radioButton.InvokeSync (delegate { > radioButton.Checked = true; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/ButtonInvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/ButtonInvokeProviderBehavior.cs >index 6c1446c..be50ee9 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/ButtonInvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/ButtonInvokeProviderBehavior.cs >@@ -84,7 +84,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ScrollBar > > public void Invoke () > { >- if (!Provider.Control.Enabled) >+ if (!Provider.Control.InvokeSync (c => c.Enabled)) > throw new ElementNotEnabledException (); > > string methodName = string.Empty; >@@ -106,9 +106,9 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ScrollBar > Action<SWF.ScrollBar> invokeMethod > = (Action<SWF.ScrollBar>) Delegate.CreateDelegate (typeof (Action<SWF.ScrollBar>), > methodInfo); >- Helper.SynchronizedSet (provider.ScrollBarContainer, >- c => { invokeMethod (provider.ScrollBarContainer); } >- ); >+ provider.ScrollBarContainer.InvokeSync (delegate { >+ invokeMethod (provider.ScrollBarContainer); >+ }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/RangeValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/RangeValueProviderBehavior.cs >index f24f546..9394ae7 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/RangeValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ScrollBar/RangeValueProviderBehavior.cs >@@ -112,36 +112,35 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ScrollBar > if (value < Minimum || value > Maximum) > throw new ArgumentOutOfRangeException (); > >- Helper.SynchronizedSet (scrollbar, delegate { >+ scrollbar.InvokeSync (delegate { > scrollbar.Value = (int) value; > }); > } > > public bool IsReadOnly { > get { >- return Helper.SynchronizedGet<SWF.ScrollBar, bool> ( >- scrollbar, s => !s.Enabled || !s.Visible); >+ return scrollbar.InvokeSync (s => !s.Enabled || !s.Visible); > } > } > > public double LargeChange { >- get { return Helper.SynchronizedGet<SWF.ScrollBar, double> (scrollbar, s => s.LargeChange); } >+ get { return scrollbar.InvokeSync (s => s.LargeChange); } > } > > public double Maximum { >- get { return Helper.SynchronizedGet<SWF.ScrollBar, double> (scrollbar, s => s.Maximum); } >+ get { return scrollbar.InvokeSync (s => s.Maximum); } > } > > public double Minimum { >- get { return Helper.SynchronizedGet<SWF.ScrollBar, double> (scrollbar, s => s.Minimum); } >+ get { return scrollbar.InvokeSync (s => s.Minimum); } > } > > public double SmallChange { >- get { return Helper.SynchronizedGet<SWF.ScrollBar, double> (scrollbar, s => s.SmallChange); } >+ get { return scrollbar.InvokeSync (s => s.SmallChange); } > } > > public double Value { >- get { return Helper.SynchronizedGet<SWF.ScrollBar, double> (scrollbar, s => s.Value); } >+ get { return scrollbar.InvokeSync (s => s.Value); } > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/DockProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/DockProviderBehavior.cs >index 125a95a..c880d15 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/DockProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/DockProviderBehavior.cs >@@ -76,18 +76,14 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > #region IDockProvider Members > > public DockPosition DockPosition { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, DockPosition> ( >- splitContainer, s => Helper.GetDockPosition (s.Dock) >- ); >- } >+ get { return splitContainer.InvokeSync (s => Helper.GetDockPosition (s.Dock)); } > } > > public void SetDockPosition (DockPosition dockPosition) > { > //throw new InvalidOperationException (); > >- Helper.SynchronizedSet (splitContainer, delegate { >+ splitContainer.InvokeSync (delegate { > splitContainer.Dock = Helper.GetDockStyle (dockPosition); > }); > } >@@ -100,6 +96,4 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > > #endregion > } >- >- delegate void PerformSetDockPositionDelegate (DockPosition dockPosition); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/RangeValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/RangeValueProviderBehavior.cs >index efe00ef..e5d099d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/RangeValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/RangeValueProviderBehavior.cs >@@ -92,17 +92,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > if (value < Minimum || value > Maximum) > throw new ArgumentOutOfRangeException (); > >- Helper.SynchronizedSet (splitcontainer, delegate { >+ splitcontainer.InvokeSync (delegate { > splitcontainer.SplitterDistance = (int) value; > }); > } > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, bool> ( >- (SWF.SplitContainer) Provider.Control, s => !s.Enabled || !s.Visible >- ); >- } >+ get { return splitcontainer.InvokeSync (s => !s.Enabled || !s.Visible); } > } > > public double LargeChange { >@@ -110,19 +106,11 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > } > > public double Maximum { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, double> ( >- (SWF.SplitContainer) Provider.Control, s => s.Width - (s.SplitterWidth + s.Panel2MinSize) >- ); >- } >+ get { return splitcontainer.InvokeSync (s => s.Width - (s.SplitterWidth + s.Panel2MinSize)); } > } > > public double Minimum { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, double> ( >- (SWF.SplitContainer) Provider.Control, s => s.Panel1MinSize >- ); >- } >+ get { return splitcontainer.InvokeSync (s => s.Panel1MinSize); } > } > > public double SmallChange { >@@ -130,11 +118,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > } > > public double Value { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, double> ( >- (SWF.SplitContainer) Provider.Control, s => s.SplitterDistance >- ); >- } >+ get { return splitcontainer.InvokeSync (s => s.SplitterDistance); } > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/SplitterPanelTransformProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/SplitterPanelTransformProviderBehavior.cs >index 18afac2..2a822e6 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/SplitterPanelTransformProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/SplitContainer/SplitterPanelTransformProviderBehavior.cs >@@ -87,12 +87,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > } > > public bool CanResize { >- get { >- return Helper.SynchronizedGet<SWF.SplitContainer, bool> ( >- splitContainer, >- s => !(s.Panel1Collapsed || s.Panel2Collapsed) >- ); >- } >+ get { return splitContainer.InvokeSync (s => !(s.Panel1Collapsed || s.Panel2Collapsed)); } > } > > public bool CanRotate { >@@ -109,7 +104,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.SplitContainer > if (!CanResize) > throw new InvalidOperationException (); > >- Helper.SynchronizedSet (splitContainer, delegate { >+ splitContainer.InvokeSync (delegate { > if (splitContainer.Orientation == SWF.Orientation.Horizontal) > splitContainer.Panel1.Width = (int) width; > else >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/GridProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/GridProviderBehavior.cs >index 38552f4..d6e674e 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/GridProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/GridProviderBehavior.cs >@@ -86,11 +86,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.StatusBar > } > > public int ColumnCount { >- get { >- return Helper.SynchronizedGet<SWF.StatusBar, int> ( >- statusBar, s => s.Panels.Count >- ); >- } >+ get { return statusBar.InvokeSync (s => s.Panels.Count); } > } > > public IRawElementProviderSimple GetItem (int row, int column) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs >index 2b7fea9..6d3aee0 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusBar/StatusBarPanelGridItemProviderBehavior.cs >@@ -101,9 +101,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.StatusBar > > public int Column { > get { >- return Helper.SynchronizedGet<SWF.StatusBar, int> ( >- statusBarPanel.Parent, s => s.Panels.IndexOf (statusBarPanel) >- ); >+ return statusBarPanel.Parent.InvokeSync (s => s.Panels.IndexOf (statusBarPanel)); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusStrip/GridProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusStrip/GridProviderBehavior.cs >index 7d8bdc5..cddc7eb 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusStrip/GridProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/StatusStrip/GridProviderBehavior.cs >@@ -86,11 +86,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.StatusStrip > } > > public int ColumnCount { >- get { >- return Helper.SynchronizedGet<SWF.StatusStrip, int> ( >- statusStrip, s => s.Items.Count >- ); >- } >+ get { return statusStrip.InvokeSync (s => s.Items.Count); } > } > > public IRawElementProviderSimple GetItem (int row, int column) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabControl/ScrollProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabControl/ScrollProviderBehavior.cs >index ee26445..9c7df65 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabControl/ScrollProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabControl/ScrollProviderBehavior.cs >@@ -105,18 +105,18 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TabControl > > public double HorizontalScrollPercent { > get { >- return Helper.SynchronizedGet<SWF.TabControl, double> (tabControl, t => { >+ return tabControl.InvokeSync (t => { > if (!t.ShowSlider) > return ScrollPatternIdentifiers.NoScroll; > else >- return 100 / t.TabCount; >+ return (double) (100 / t.TabCount); > }); > } > } > > public double HorizontalViewSize { > get { >- return Helper.SynchronizedGet<SWF.TabControl, double> (tabControl, t => { >+ return tabControl.InvokeSync (t => { > if (!t.ShowSlider) > return 100; > else { >@@ -146,11 +146,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TabControl > } > > public bool HorizontallyScrollable { >- get { >- return Helper.SynchronizedGet<SWF.TabControl, bool> ( >- tabControl, t => t.ShowSlider >- ); >- } >+ get { return tabControl.InvokeSync (t => t.ShowSlider); } > } > > public bool VerticallyScrollable { >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabPage/SelectionItemProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabPage/SelectionItemProviderBehavior.cs >index e946964..d1f8560 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabPage/SelectionItemProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TabPage/SelectionItemProviderBehavior.cs >@@ -112,7 +112,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TabPage > return; > } > >- Helper.SynchronizedSet (pageProvider.TabControlProvider.Control, delegate { >+ pageProvider.TabControlProvider.Control.InvokeSync (delegate { > pageProvider.TabControlProvider.SelectItem (pageProvider); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/CaretProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/CaretProviderBehavior.cs >index 492c819..21f4ede 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/CaretProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/CaretProviderBehavior.cs >@@ -70,8 +70,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > get { > // TODO: This won't scale; we really should > // find a better way of doing it >- return Helper.SynchronizedGet<SWF.Control, int> (Provider.Control, >- delegate { >+ return Provider.Control.InvokeSync (c => { > SWF.Document document = Document; > if (document.caret.line.line_no > document.Lines) > return Text.Length; >@@ -84,25 +83,23 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > > public bool SetCaretOffset (int offset) > { >- return Helper.SynchronizedGet<SWF.Control, bool> (Provider.Control, >- delegate { >- if (offset < 0) >- return false; >- SWF.Document document = Document; >- int curPos = 0; >- SWF.Line line = null; >- for (int i = 1;i <= document.Lines;i++) { >- line = document.GetLine (i); >- int length = line.Text.ToString().Length; >- if (curPos + length >= offset) { >- document.PositionCaret (line, offset - curPos); >- return true; >- } >- curPos += length; >- } >+ return Provider.Control.InvokeSync (c => { >+ if (offset < 0) > return false; >+ SWF.Document document = Document; >+ int curPos = 0; >+ SWF.Line line = null; >+ for (int i = 1;i <= document.Lines;i++) { >+ line = document.GetLine (i); >+ int length = line.Text.ToString().Length; >+ if (curPos + length >= offset) { >+ document.PositionCaret (line, offset - curPos); >+ return true; >+ } >+ curPos += length; > } >- ); >+ return false; >+ }); > } > > public string GetSelection (int selectionNum, out int startOffset, out int endOffset) >@@ -112,8 +109,8 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > return null; > SWF.TextBoxBase textBoxBase = TextBoxBase; > if (TextBoxBase.Document.SelectionVisible) { >- int sel_start = Helper.SynchronizedGet<SWF.TextBoxBase, int> (textBoxBase, t => t.SelectionStart); >- int sel_len = Helper.SynchronizedGet<SWF.TextBoxBase, int> (textBoxBase, t => t.SelectionLength); >+ int sel_start = textBoxBase.InvokeSync (t => t.SelectionStart); >+ int sel_len = textBoxBase.InvokeSync (t => t.SelectionLength); > string text = Text; > > startOffset = sel_start; >@@ -136,7 +133,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > if (Provider.Control is SWF.TextBoxBase) > return (SWF.TextBoxBase)Provider.Control; > else if (Provider.Control is SWF.UpDownBase) >- return ((SWF.UpDownBase)Provider.Control).txtView; >+ return ((SWF.UpDownBase)Provider.Control).InvokeSync (c => c.txtView); > else > throw new Exception ("TextBoxBase: Unknown type: " + Provider.Control); > } >@@ -145,19 +142,14 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > private string Text { > get { > if (TextBoxBase is SWF.MaskedTextBox) { >- return Helper.SynchronizedGet<SWF.MaskedTextBox, string> ( >- (SWF.MaskedTextBox) TextBoxBase, t => t.MaskedTextProvider.ToDisplayString () >- ); >+ return ((SWF.MaskedTextBox) TextBoxBase).InvokeSync (t => t.MaskedTextProvider.ToDisplayString ()); > } else { >- return Helper.SynchronizedGet<SWF.TextBoxBase, string> ( >- TextBoxBase, t => t.Text >- ); >+ return TextBoxBase.InvokeSync (t => t.Text); > } > } > set { >- Helper.SynchronizedSet (TextBoxBase, delegate { >- TextBoxBase.Text = value; >- }); >+ SWF.TextBoxBase textBoxBase = TextBoxBase; >+ textBoxBase.InvokeSync (delegate { textBoxBase.Text = value; }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ClipboardProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ClipboardProviderBehavior.cs >index 90861fb..4a7a6e7 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ClipboardProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ClipboardProviderBehavior.cs >@@ -62,7 +62,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > > public void Copy (int start, int end) > { >- Helper.SynchronizedSet (TextBoxBase, delegate { >+ TextBoxBase.InvokeSync (delegate { > string text = Text; > start = (int) System.Math.Max (start, 0); > end = (int) System.Math.Min (end, text.Length); >@@ -72,7 +72,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > > public void Paste (int position) > { >- Helper.SynchronizedSet (TextBoxBase, delegate { >+ TextBoxBase.InvokeSync (delegate { > string text = Text; > position = (int) System.Math.Max (position, 0); > position = (int) System.Math.Min (position, text.Length); >@@ -105,7 +105,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > if (Provider.Control is SWF.TextBoxBase) > return (SWF.TextBoxBase)Provider.Control; > else if (Provider.Control is SWF.UpDownBase) >- return ((SWF.UpDownBase)Provider.Control).txtView; >+ return ((SWF.UpDownBase)Provider.Control).InvokeSync (c => c.txtView); > else > throw new Exception ("TextBoxBase: Unknown type: " + Provider.Control); > } >@@ -114,11 +114,14 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > private string Text { > get { > if (TextBoxBase is SWF.MaskedTextBox) >- return ((SWF.MaskedTextBox) TextBoxBase).MaskedTextProvider.ToDisplayString (); >+ return ((SWF.MaskedTextBox) TextBoxBase).InvokeSync (c => c.MaskedTextProvider.ToDisplayString ()); > else >- return TextBoxBase.Text; >+ return TextBoxBase.InvokeSync (c => c.Text); >+ } >+ set { >+ SWF.TextBoxBase textBoxBase = TextBoxBase; >+ textBoxBase.InvokeSync (delegate { textBoxBase.Text = value; }); > } >- set { TextBoxBase.Text = value; } > } > > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/TextProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/TextProviderBehavior.cs >index 8de21c4..fcd16ad 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/TextProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/TextProviderBehavior.cs >@@ -72,7 +72,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > if (propertyId == AutomationElementIdentifiers.IsPasswordProperty.Id) { > if (Provider.Control is SWF.TextBox) { > SWF.TextBox textbox = TextBox; >- return (textbox.UseSystemPasswordChar || (int) textbox.PasswordChar != 0); >+ return textbox.InvokeSync (c => c.UseSystemPasswordChar || (int) c.PasswordChar != 0); > } else if (Provider.Control is SWF.RichTextBox) { > return false; > } >@@ -102,21 +102,24 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > > //TODO: Return null when system cursor is not present, how to? > >- if (!TextBoxBase.Document.SelectionVisible) >- return new ITextRangeProvider [0]; >- >- int sel_len = Helper.SynchronizedGet<SWF.TextBoxBase, int> (TextBoxBase, t => t.SelectionLength); >- int sel_start = Helper.SynchronizedGet<SWF.TextBoxBase, int> (TextBoxBase, t => t.SelectionStart); >- >- return new ITextRangeProvider [] { >- new TextRangeProvider (this, TextBoxBase, sel_start, sel_start + sel_len) >- }; >+ return TextBoxBase.InvokeSync (c => { >+ if (!c.Document.SelectionVisible) >+ return new ITextRangeProvider [0]; >+ >+ int sel_len = c.SelectionLength; >+ int sel_start = c.SelectionStart; >+ >+ return new ITextRangeProvider [] { >+ new TextRangeProvider (this, TextBoxBase, sel_start, sel_start + sel_len) >+ }; >+ }); > } > > public ITextRangeProvider[] GetVisibleRanges () > { > int start_line = -1, end_line = -1; >- Document.GetVisibleLineIndexes (TextBoxBase.Bounds, out start_line, out end_line); >+ System.Drawing.Rectangle bounds = TextBoxBase.InvokeSync (c => c.Bounds); >+ Document.GetVisibleLineIndexes (bounds, out start_line, out end_line); > > ITextRangeProvider range = DocumentRange.Clone (); > range.MoveEndpointByUnit (TextPatternRangeEndpoint.Start, TextUnit.Line, start_line); >@@ -158,7 +161,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > if (Provider.Control is SWF.TextBoxBase) > return (SWF.TextBoxBase)Provider.Control; > else if (Provider.Control is SWF.UpDownBase) >- return ((SWF.UpDownBase)Provider.Control).txtView; >+ return ((SWF.UpDownBase)Provider.Control).InvokeSync (c => c.txtView); > else > throw new Exception ("TextBoxBase: Unknown type: " + Provider.Control); > } >@@ -171,7 +174,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > } > > private SWF.Document Document { >- get { return TextBoxBase.Document; } >+ get { return TextBoxBase.InvokeSync (c => c.Document); } > } > } > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ValueProviderBehavior.cs >index 3253ef4..cb51235 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TextBox/ValueProviderBehavior.cs >@@ -84,10 +84,8 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > > public bool IsReadOnly { > get { >- return Helper.SynchronizedGet<SWF.TextBoxBase, bool> ( >- (SWF.TextBoxBase) Provider.Control, >- t => t.ReadOnly || !t.Enabled >- ); >+ return ((SWF.TextBoxBase) Provider.Control).InvokeSync (c => c.ReadOnly >+ || !c.Enabled); > } > } > >@@ -95,16 +93,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > get { > if (Provider.Control is SWF.MaskedTextBox) { > System.ComponentModel.MaskedTextProvider mtp >- = ((SWF.MaskedTextBox) Provider.Control).MaskedTextProvider; >+ = ((SWF.MaskedTextBox) Provider.Control).InvokeSync (c => c.MaskedTextProvider); > if (mtp != null) { >- return Helper.SynchronizedGet<SWF.Control, string> (Provider.Control, >- c => { return mtp.ToDisplayString (); } >- ); >+ return mtp.ToDisplayString (); > } > } > >- return Helper.SynchronizedGet<SWF.Control, string> ( >- Provider.Control, c => c.Text); >+ return Provider.Control.InvokeSync (c => c.Text); > } > } > >@@ -113,8 +108,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TextBox > if (IsReadOnly) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (Provider.Control, >- delegate { >+ Provider.Control.InvokeSync (delegate { > int maxLength = ((TextBoxProvider) Provider).MaxLength; > if (maxLength > 0 > && value.Length > maxLength) { >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonExpandCollapseProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonExpandCollapseProviderBehavior.cs >index 362fffe..721d2a0 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonExpandCollapseProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonExpandCollapseProviderBehavior.cs >@@ -83,8 +83,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolBar > if (menu == null) > return ExpandCollapseState.Collapsed; > >- return Helper.SynchronizedGet<SWF.ToolBar, ExpandCollapseState> ( >- toolBar, t => toolBarButton.Pushed ? ExpandCollapseState.Expanded >+ return toolBar.InvokeSync (t => toolBarButton.Pushed ? ExpandCollapseState.Expanded > : ExpandCollapseState.Collapsed > ); > } >@@ -112,7 +111,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolBar > > private void PerformExpandCollapse () > { >- Helper.SynchronizedSet (toolBar, delegate { >+ toolBar.InvokeSync (delegate { > SWF.ContextMenu menu = toolBarButton.DropDownMenu as SWF.ContextMenu; > if (menu == null) > return; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonInvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonInvokeProviderBehavior.cs >index 8496441..1f0a84a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonInvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonInvokeProviderBehavior.cs >@@ -71,15 +71,13 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolBar > > public void Invoke () > { >- bool notEnabled = Helper.SynchronizedGet<SWF.ToolBar, bool> ( >- toolBar, t => !t.Enabled || !toolBarButton.Enabled >- ); >+ bool notEnabled = toolBar.InvokeSync (t => !t.Enabled || !toolBarButton.Enabled); > > if (notEnabled) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (toolBar, delegate { >- toolBarButton.Parent.UIAPerformClick (toolBarButton); >+ toolBar.InvokeSync (delegate { >+ toolBar.UIAPerformClick (toolBarButton); > }); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonToggleProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonToggleProviderBehavior.cs >index 95e4d97..a36f14a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonToggleProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolBar/ToolBarButtonToggleProviderBehavior.cs >@@ -79,9 +79,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolBar > public ToggleState ToggleState > { > get { >- return Helper.SynchronizedGet<SWF.ToolBar, ToggleState> ( >- toolBar, t => toolBarButton.Pushed ? ToggleState.On : ToggleState.Off >- ); >+ if (toolBar.InvokeSync (t => toolBarButton.Pushed)) >+ return ToggleState.On; >+ else >+ return ToggleState.Off; > } > } > >@@ -90,7 +91,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolBar > if (!toolBarButton.Enabled) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (toolBar, delegate { >+ toolBar.InvokeSync (delegate { > toolBar.UIAPerformClick (toolBarButton); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs >index a41ead0..9bfc718 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/InvokeProviderBehavior.cs >@@ -72,7 +72,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripButton > throw new ElementNotEnabledException (); > > SWF.ToolStrip toolstrip = ((SWF.ToolStripButton) Provider.Component).Owner; >- Helper.SynchronizedSet (toolstrip, delegate { >+ toolstrip.InvokeSync (delegate { > button.PerformClick (); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs >index aff415d..9da21b8 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs >@@ -75,9 +75,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripButton > public ToggleState ToggleState { > get { > SWF.CheckState state = >- Helper.SynchronizedGet<SWF.ToolStrip, SWF.CheckState> ( >- Owner, delegate { return button.CheckState; } >- ); >+ Owner.InvokeSync (delegate { return button.CheckState; }); > > switch (state) { > case SWF.CheckState.Checked: >@@ -97,9 +95,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripButton > throw new ElementNotEnabledException (); > > SWF.CheckState state = >- Helper.SynchronizedGet<SWF.ToolStrip, SWF.CheckState> ( >- Owner, delegate { return button.CheckState; } >- ); >+ Owner.InvokeSync (delegate { return button.CheckState; }); > > switch (state) { > case SWF.CheckState.Checked: >@@ -119,7 +115,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripButton > #region Private Methods > private void PerformToggle (SWF.ToolStripButton button, SWF.CheckState state) > { >- Helper.SynchronizedSet (Owner, delegate { >+ Owner.InvokeSync (delegate { > button.CheckState = state; > }); > } >@@ -135,6 +131,4 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripButton > private SWF.ToolStripButton button; > #endregion > } >- >- delegate void PerformToggleDelegate (SWF.ToolStripButton button, SWF.CheckState state); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs >index b852401..24686d5 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripItem/InvokeProviderBehavior.cs >@@ -93,7 +93,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripItem > { > SWF.ToolStripItem item = (SWF.ToolStripItem) Provider.Component; > if (item.Owner != null) >- Helper.SynchronizedSet (item.Owner, delegate { >+ item.Owner.InvokeSync (delegate { > PerformClick (item); > }); > else // Hopefully we shouldn't have any issue >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripSplitButton/ExpandCollapseProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripSplitButton/ExpandCollapseProviderBehavior.cs >index ddd17f0..34a5cb8 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripSplitButton/ExpandCollapseProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/ToolStripSplitButton/ExpandCollapseProviderBehavior.cs >@@ -77,8 +77,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripSplitButton > if (dropdown == null) > return ExpandCollapseState.Collapsed; > >- return Helper.SynchronizedGet<SWF.ToolStrip, ExpandCollapseState> ( >- Owner, o => dropdown.Visible ? ExpandCollapseState.Expanded >+ return Owner.InvokeSync (o => dropdown.Visible ? ExpandCollapseState.Expanded > : ExpandCollapseState.Collapsed > ); > } >@@ -86,14 +85,14 @@ namespace Mono.UIAutomation.Winforms.Behaviors.ToolStripSplitButton > > public void Collapse () > { >- Helper.SynchronizedSet (Owner, delegate { >+ Owner.InvokeSync (delegate { > ((SWF.ToolStripSplitButton) Provider.Component).HideDropDown (); > }); > } > > public void Expand () > { >- Helper.SynchronizedSet (Owner, delegate { >+ Owner.InvokeSync (delegate { > ((SWF.ToolStripSplitButton) Provider.Component).ShowDropDown (); > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/ButtonInvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/ButtonInvokeProviderBehavior.cs >index 2bffb52..9f96076 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/ButtonInvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/ButtonInvokeProviderBehavior.cs >@@ -84,10 +84,10 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TrackBar > > public void Invoke () > { >- if (!Provider.Control.Enabled) >+ if (Provider.Control.InvokeSync (c => !c.Enabled)) > throw new ElementNotEnabledException (); > >- Helper.SynchronizedSet (Provider.Control, delegate { >+ Provider.Control.InvokeSync (delegate { > if (provider.Orientation == TrackBarProvider.TrackBarButtonOrientation.LargeBack) > ((SWF.TrackBar)Provider.Control).LargeDecrement (); > else if (provider.Orientation == TrackBarProvider.TrackBarButtonOrientation.LargeForward) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/RangeValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/RangeValueProviderBehavior.cs >index f094a4d..0d1b3c2 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/RangeValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TrackBar/RangeValueProviderBehavior.cs >@@ -112,57 +112,33 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TrackBar > if (value < Minimum || value > Maximum) > throw new ArgumentOutOfRangeException (); > >- Helper.SynchronizedSet (trackbar, delegate { >+ trackbar.InvokeSync (delegate { > trackbar.Value = (int) value; > }); > } > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, bool> ( >- trackbar, t => !t.Enabled || !t.Visible >- ); >- } >+ get { return trackbar.InvokeSync (t => !t.Enabled || !t.Visible); } > } > > public double LargeChange { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, double> ( >- trackbar, t => t.LargeChange >- ); >- } >+ get { return trackbar.InvokeSync (t => t.LargeChange); } > } > > public double Maximum { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, double> ( >- trackbar, t => t.Maximum >- ); >- } >+ get { return trackbar.InvokeSync (t => t.Maximum); } > } > > public double Minimum { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, double> ( >- trackbar, t => t.Minimum >- ); >- } >+ get { return trackbar.InvokeSync (t => t.Minimum); } > } > > public double SmallChange { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, double> ( >- trackbar, t => t.SmallChange >- ); >- } >+ get { return trackbar.InvokeSync (t => t.SmallChange); } > } > > public double Value { >- get { >- return Helper.SynchronizedGet<SWF.TrackBar, double> ( >- trackbar, t => t.Value >- ); >- } >+ get { return trackbar.InvokeSync (t => t.Value); } > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TreeView/SelectionProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TreeView/SelectionProviderBehavior.cs >index c508c68..c6a5368 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TreeView/SelectionProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/TreeView/SelectionProviderBehavior.cs >@@ -92,7 +92,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TreeView > > public IRawElementProviderSimple [] GetSelection () > { >- SWF.TreeNode selectedNode = treeView.SelectedNode; >+ SWF.TreeNode selectedNode = treeView.InvokeSync (c => c.SelectedNode); > TreeNodeProvider selectedNodeProvider = null; > > if (selectedNode != null) >@@ -110,9 +110,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.TreeView > > public bool IsSelectionRequired { > get { >- return Helper.SynchronizedGet<SWF.TreeView, bool> ( >- treeView, t => t.SelectedNode != null >- ); >+ return treeView.InvokeSync (t => t.SelectedNode != null); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ButtonInvokeProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ButtonInvokeProviderBehavior.cs >index 98127bb..745507f 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ButtonInvokeProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ButtonInvokeProviderBehavior.cs >@@ -69,7 +69,7 @@ namespace Mono.UIAutomation.Winforms.Behaviors.UpDownBase > > public void Invoke () > { >- Helper.SynchronizedSet (provider.UpDownBase, delegate { >+ provider.UpDownBase.InvokeSync (delegate { > if (provider.Orientation == UpDownBaseProvider.UpDownBaseButtonOrientation.Forward) > provider.UpDownBase.UpButton (); > else if (provider.Orientation == UpDownBaseProvider.UpDownBaseButtonOrientation.Backward) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ValueProviderBehavior.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ValueProviderBehavior.cs >index 8494a65..80ad7ca 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ValueProviderBehavior.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Behaviors/UpDownBase/ValueProviderBehavior.cs >@@ -82,29 +82,19 @@ namespace Mono.UIAutomation.Winforms.Behaviors.UpDownBase > #region IValueProvider Members > > public bool IsReadOnly { >- get { >- return Helper.SynchronizedGet<SWF.UpDownBase, bool> ( >- (SWF.UpDownBase) Provider.Control, u => u.ReadOnly >- ); >- } >+ get { return upDownBase.InvokeSync (c => c.ReadOnly); } > } > > public string Value { >- get { >- return Helper.SynchronizedGet<SWF.UpDownBase, string> ( >- (SWF.UpDownBase) Provider.Control, u => u.Text >- ); >- } >+ get { return upDownBase.InvokeSync (c => c.Text); } > } > > public void SetValue (string value) > { >- if (!upDownBase.Enabled || upDownBase.ReadOnly) >+ if (upDownBase.InvokeSync (c => !c.Enabled || c.ReadOnly)) > throw new ElementNotEnabledException (); >- >- Helper.SynchronizedSet (upDownBase, delegate { >- upDownBase.Text = value; >- }); >+ >+ upDownBase.InvokeSync (delegate { upDownBase.Text = value; }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsOffscreenPropertyEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsOffscreenPropertyEvent.cs >index 1f360ba..081306b 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsOffscreenPropertyEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsOffscreenPropertyEvent.cs >@@ -48,26 +48,26 @@ namespace Mono.UIAutomation.Winforms.Events > > public override void Connect () > { >-// Helper.SynchronizedSet (Provider.Control, delegate { >+ Provider.Control.InvokeSync (delegate { > Provider.Control.Resize += new EventHandler (OnIsOffScreen); > Provider.Control.LocationChanged += new EventHandler (OnIsOffScreen); > if (Provider.Control.Parent != null) > Provider.Control.Parent.LocationChanged += new EventHandler (OnIsOffScreen); > if (Provider.Control.FindForm () != null) > Provider.Control.FindForm ().Resize += new EventHandler (OnIsOffScreen); >-// }); >+ }); > } > > public override void Disconnect () > { >-// Helper.SynchronizedSet (Provider.Control, delegate { >+ Provider.Control.InvokeSync (delegate { > Provider.Control.Resize -= new EventHandler (OnIsOffScreen); > Provider.Control.LocationChanged -= new EventHandler (OnIsOffScreen); > if (Provider.Control.Parent != null) > Provider.Control.Parent.LocationChanged -= new EventHandler (OnIsOffScreen); > if (Provider.Control.FindForm () != null) > Provider.Control.FindForm ().Resize -= new EventHandler (OnIsOffScreen); >-// }); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsPatternAvailablePropertyEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsPatternAvailablePropertyEvent.cs >index 0872427..6339289 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsPatternAvailablePropertyEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/AutomationIsPatternAvailablePropertyEvent.cs >@@ -116,16 +116,12 @@ namespace Mono.UIAutomation.Winforms.Events > return; > > bool newValue = val ?? false; >-// Helper.DelegateQueue.Get ().Enqueue (delegate { >-// System.Threading.ThreadPool.QueueUserWorkItem (v => { >- > AutomationPropertyChangedEventArgs args > = new AutomationPropertyChangedEventArgs (property, > !newValue, > newValue); > AutomationInteropProvider.RaiseAutomationPropertyChangedEvent (Provider, > args); >-// }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs >index 220e1f2..61157a9 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationEvent.cs >@@ -55,14 +55,14 @@ namespace Mono.UIAutomation.Winforms.Events > protected void RaiseAutomationEvent () > { > if (AutomationInteropProvider.ClientsAreListening == true) { >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > // System.Threading.ThreadPool.QueueUserWorkItem (v => { > AutomationEventArgs args = > new AutomationEventArgs (Event); > AutomationInteropProvider.RaiseAutomationEvent (Event, > Provider, > args); >- }); >+// }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs >index 7dea6ca..74fa79a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/BaseAutomationPropertyEvent.cs >@@ -69,17 +69,13 @@ namespace Mono.UIAutomation.Winforms.Events > object newValue = GetNewPropertyValue (); > > if (object.Equals (OldValue, newValue) == false) { >- object oldValue = newValue; >- OldValue = oldValue; >- Helper.DelegateQueue.Get ().Enqueue (delegate { >-// System.Threading.ThreadPool.QueueUserWorkItem (v => { >- AutomationPropertyChangedEventArgs args = >- new AutomationPropertyChangedEventArgs (Property, >- oldValue, >- newValue); >- AutomationInteropProvider.RaiseAutomationPropertyChangedEvent (Provider, >- args); >- }); >+ AutomationPropertyChangedEventArgs args = >+ new AutomationPropertyChangedEventArgs (Property, >+ OldValue, >+ newValue); >+ AutomationInteropProvider.RaiseAutomationPropertyChangedEvent (Provider, >+ args); >+ OldValue = newValue; > } > } > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ComboBox/ListItemSelectionItemPatternElementSelectedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ComboBox/ListItemSelectionItemPatternElementSelectedEvent.cs >index 6abe10b..cb97fa4 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ComboBox/ListItemSelectionItemPatternElementSelectedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ComboBox/ListItemSelectionItemPatternElementSelectedEvent.cs >@@ -66,7 +66,7 @@ namespace Mono.UIAutomation.Winforms.Events.ComboBox > { > ListItemProvider provider = (ListItemProvider) Provider; > >- if (provider.Index == ((SWF.ComboBox) provider.Control).SelectedIndex) >+ if (provider.Index == ((SWF.ComboBox) provider.Control).InvokeSync (c => c.SelectedIndex)) > RaiseAutomationEvent (); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListBox/ListItemSelectionItemPatternElementSelectedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListBox/ListItemSelectionItemPatternElementSelectedEvent.cs >index 420aa1e..a238b31 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListBox/ListItemSelectionItemPatternElementSelectedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListBox/ListItemSelectionItemPatternElementSelectedEvent.cs >@@ -68,9 +68,11 @@ namespace Mono.UIAutomation.Winforms.Events.ListBox > { > ListItemProvider provider = (ListItemProvider) Provider; > >- if (((SWF.ListBox) provider.Control).SelectedIndex == provider.Index >- && provider.ListProvider.SelectedItemsCount == 1) >- RaiseAutomationEvent (); >+ ((SWF.ListBox) provider.Control).InvokeSync (c => { >+ if (c.SelectedIndex == provider.Index >+ && provider.ListProvider.SelectedItemsCount == 1) >+ RaiseAutomationEvent (); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationBoundingRectanglePropertyEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationBoundingRectanglePropertyEvent.cs >index 67bf622..038923d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationBoundingRectanglePropertyEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationBoundingRectanglePropertyEvent.cs >@@ -60,9 +60,11 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > > private void OnColumnWidthChanged (object sender, ColumnWidthChangedEventArgs args) > { >- if (args.ColumnIndex >- == itemProvider.HeaderProvider.ListView.Columns.IndexOf (itemProvider.ColumnHeader)) >- RaiseAutomationPropertyChangedEvent (); >+ itemProvider.HeaderProvider.ListView.InvokeSync (delegate { >+ if (args.ColumnIndex >+ == itemProvider.HeaderProvider.ListView.Columns.IndexOf (itemProvider.ColumnHeader)) >+ RaiseAutomationPropertyChangedEvent (); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationIsOffScreenPropertyEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationIsOffScreenPropertyEvent.cs >index 06e4c40..c4dab95 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationIsOffScreenPropertyEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/HeaderItemAutomationIsOffScreenPropertyEvent.cs >@@ -60,9 +60,11 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > > private void OnColumnWidthChanged (object sender, ColumnWidthChangedEventArgs args) > { >- if (args.ColumnIndex >- == itemProvider.HeaderProvider.ListView.Columns.IndexOf (itemProvider.ColumnHeader)) >- RaiseAutomationPropertyChangedEvent (); >+ itemProvider.HeaderProvider.ListView.InvokeSync (delegate { >+ if (args.ColumnIndex >+ == itemProvider.HeaderProvider.ListView.Columns.IndexOf (itemProvider.ColumnHeader)) >+ RaiseAutomationPropertyChangedEvent (); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemEditValuePatternValueEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemEditValuePatternValueEvent.cs >index da235a4..13f2235 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemEditValuePatternValueEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemEditValuePatternValueEvent.cs >@@ -61,19 +61,23 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > > private void OnUIATextChanged (object sender, SWF.LabelEditEventArgs args) > { >- if (args.Item == editProvider.ItemProvider.ListView.Columns.IndexOf (editProvider.ColumnHeader)) { >- newText = (string) editProvider.GetPropertyValue (ValuePatternIdentifiers.ValueProperty.Id); >- RaiseAutomationPropertyChangedEvent (); >- } >+ editProvider.ItemProvider.ListView.InvokeSync (delegate { >+ if (args.Item == editProvider.ItemProvider.ListView.Columns.IndexOf (editProvider.ColumnHeader)) { >+ newText = (string) editProvider.GetPropertyValue (ValuePatternIdentifiers.ValueProperty.Id); >+ RaiseAutomationPropertyChangedEvent (); >+ } >+ }); > } > > private void OnAfterLabelEdit (object sender, SWF.LabelEditEventArgs args) > { >- if (editProvider.ItemProvider.ListView.Items.IndexOf (editProvider.ItemProvider.ListViewItem) >- == args.Item) { >- newText = args.Label; >- RaiseAutomationPropertyChangedEvent (); >- } >+ editProvider.ItemProvider.ListView.InvokeSync (delegate { >+ if (editProvider.ItemProvider.ListView.Items.IndexOf (editProvider.ItemProvider.ListViewItem) >+ == args.Item) { >+ newText = args.Label; >+ RaiseAutomationPropertyChangedEvent (); >+ } >+ }); > } > > //We are doing this because AfterLabelEdit event is generated before commiting the text >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementAddedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementAddedEvent.cs >index bcb20b4..acbbf42 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementAddedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementAddedEvent.cs >@@ -66,13 +66,15 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > { > ListItemProvider provider = (ListItemProvider) Provider; > SWF.ListView listView = (SWF.ListView) sender; >- >- if (selected == false >- && listView.SelectedIndices.Count > 1 >- && listView.SelectedIndices.Contains (provider.Index) == true) >- RaiseAutomationEvent (); >- >- selected = listView.SelectedIndices.Contains (provider.Index); >+ >+ listView.InvokeSync (delegate { >+ if (selected == false >+ && listView.SelectedIndices.Count > 1 >+ && listView.SelectedIndices.Contains (provider.Index) == true) >+ RaiseAutomationEvent (); >+ >+ selected = listView.SelectedIndices.Contains (provider.Index); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementRemovedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementRemovedEvent.cs >index b8c96f1..b5c09a5 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementRemovedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementRemovedEvent.cs >@@ -68,13 +68,15 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > { > ListItemProvider provider = (ListItemProvider) Provider; > SWF.ListView listView = (SWF.ListView) sender; >- >- if (selected == true >- && listView.SelectedIndices.Count > 1 >- && listView.SelectedIndices.Contains (provider.Index) == false) >- RaiseAutomationEvent (); >- >- selected = listView.SelectedIndices.Contains (provider.Index); >+ >+ listView.InvokeSync (delegate { >+ if (selected == true >+ && listView.SelectedIndices.Count > 1 >+ && listView.SelectedIndices.Contains (provider.Index) == false) >+ RaiseAutomationEvent (); >+ >+ selected = listView.SelectedIndices.Contains (provider.Index); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementSelectedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementSelectedEvent.cs >index e36f7bf..69ac766 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementSelectedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternElementSelectedEvent.cs >@@ -65,10 +65,12 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > { > ListItemProvider provider = (ListItemProvider) Provider; > SWF.ListView listView = (SWF.ListView) sender; >- >- if (listView.SelectedIndices.Count == 1 >- && listView.SelectedIndices.Contains (provider.Index) == true) >- RaiseAutomationEvent (); >+ >+ listView.InvokeSync (delegate { >+ if (listView.SelectedIndices.Count == 1 >+ && listView.SelectedIndices.Contains (provider.Index) == true) >+ RaiseAutomationEvent (); >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternIsSelectedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternIsSelectedEvent.cs >index 9d9cf75..99c0164 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternIsSelectedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/ListView/ListItemSelectionItemPatternIsSelectedEvent.cs >@@ -67,13 +67,15 @@ namespace Mono.UIAutomation.Winforms.Events.ListView > { > SWF.ListView listView = (SWF.ListView) sender; > ListItemProvider provider = (ListItemProvider) Provider; >- >- bool selectedChanged = listView.SelectedIndices.Contains (provider.Index); >- >- if (selectedChanged != selected) { >- RaiseAutomationPropertyChangedEvent (); >- selected = selectedChanged; >- } >+ >+ listView.InvokeSync (delegate { >+ bool selectedChanged = listView.SelectedIndices.Contains (provider.Index); >+ >+ if (selectedChanged != selected) { >+ RaiseAutomationPropertyChangedEvent (); >+ selected = selectedChanged; >+ } >+ }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/RadioButton/SelectionItemPatternElementSelectedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/RadioButton/SelectionItemPatternElementSelectedEvent.cs >index 094854f..5378fad 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/RadioButton/SelectionItemPatternElementSelectedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/RadioButton/SelectionItemPatternElementSelectedEvent.cs >@@ -59,7 +59,7 @@ namespace Mono.UIAutomation.Winforms.Events.RadioButton > > private void OnElementSelectedEvent (object sender, System.EventArgs e) > { >- if (((SWF.RadioButton) Provider.Control).Checked) >+ if (((SWF.RadioButton) Provider.Control).InvokeSync (c => c.Checked)) > RaiseAutomationEvent (); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternCaretMovedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternCaretMovedEvent.cs >index e9a211f..4a91a64 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternCaretMovedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternCaretMovedEvent.cs >@@ -63,7 +63,7 @@ namespace Mono.UIAutomation.Winforms.Events.TextBox > if (Provider.Control is SWF.TextBoxBase) > return (SWF.TextBoxBase)Provider.Control; > else if (Provider.Control is SWF.UpDownBase) >- return ((SWF.UpDownBase)Provider.Control).txtView; >+ return ((SWF.UpDownBase)Provider.Control).InvokeSync (c => c.txtView); > else > throw new Exception ("TextBoxBase: Unknown type: " + Provider.Control); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternTextSelectionChangedEvent.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternTextSelectionChangedEvent.cs >index e2ca264..939470a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternTextSelectionChangedEvent.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Events/TextBox/TextPatternTextSelectionChangedEvent.cs >@@ -73,7 +73,7 @@ namespace Mono.UIAutomation.Winforms.Events.TextBox > private void OnSelectionChangedEvent (object sender, > EventArgs args) > { >- SWF.Document document = TextBoxBase.Document; >+ SWF.Document document = TextBoxBase.InvokeSync (c => c.Document); > if (!selectionVisible && !document.selection_visible) > return; > if (document.selection_visible != selectionVisible || document.selection_start != selectionStart || document.selection_end != selectionEnd) { >@@ -89,7 +89,7 @@ namespace Mono.UIAutomation.Winforms.Events.TextBox > if (Provider.Control is SWF.TextBoxBase) > return (SWF.TextBoxBase)Provider.Control; > else if (Provider.Control is SWF.UpDownBase) >- return ((SWF.UpDownBase)Provider.Control).txtView; >+ return ((SWF.UpDownBase)Provider.Control).InvokeSync (c => c.txtView); > else > throw new Exception ("TextBoxBase: Unknown type: " + Provider.Control); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs >index 29f3fbb..d470276 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.Navigation/ParentNavigation.cs >@@ -163,35 +163,35 @@ namespace Mono.UIAutomation.Winforms.Navigation > > > if (args.RaiseEvent == true) { >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildAdded, > args.ChildProvider); > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildrenInvalidated, > (FragmentControlProvider) sender); >- }); >+// }); > } > } else if (args.ChangeType == StructureChangeType.ChildRemoved) { > Remove (args.ChildProvider.Navigation); > > if (args.RaiseEvent == true) { >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildRemoved, > args.ChildProvider); > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildrenInvalidated, > (FragmentControlProvider) sender); >- }); >+// }); > } > } else if (args.ChangeType == StructureChangeType.ChildrenReordered) { > chain.Clear (); > > //TODO: Is this the event to generate? > if (args.RaiseEvent == true) { >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildrenBulkRemoved, > (FragmentControlProvider) sender); > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildrenInvalidated, > (FragmentControlProvider) sender); >- }); >+// }); > } > } > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.mdp b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.mdp >index 3afeaf4..e982d38 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.mdp >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms.mdp >@@ -1,4 +1,4 @@ >-<Project name="Mono.UIAutomation.Winforms" fileversion="2.0" language="C#" UseParentDirectoryAsNamespace="True" DefaultNamespace="Mono.UIAutomation.Winforms" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject"> >+<Project name="Mono.UIAutomation.Winforms" fileversion="2.0" language="C#" DefaultNamespace="Mono.UIAutomation.Winforms" UseParentDirectoryAsNamespace="True" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject"> > <Configurations active="Debug"> > <Configuration name="Debug" ctype="DotNetProjectConfiguration"> > <Output directory="bin/Debug" signAssembly="True" assemblyKeyFile="../mono-uia.snk" assembly="UIAutomationWinforms" /> >@@ -23,7 +23,6 @@ > <File name="Mono.UIAutomation.Winforms/RadioButtonProvider.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms/LabelProvider.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms/TextBoxProvider.cs" subtype="Code" buildaction="Compile" /> >- <File name="Mono.UIAutomation.Winforms/Helper.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms/LinkLabelProvider.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms.Events/AutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms.Events/AutomationBoundingRectanglePropertyEvent.cs" subtype="Code" buildaction="Compile" /> >@@ -567,6 +566,14 @@ > <File name="Mono.UIAutomation.Winforms.Events/DataGridView/DataItemChildHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms.Behaviors/DataGrid/DataItemEditSelectionItemProviderBehavior.cs" subtype="Code" buildaction="Compile" /> > <File name="Mono.UIAutomation.Winforms.Events/DataGrid/DataItemEditSelectionItemPatternIsSelectedEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Behaviors/ListView/ListItemInvokeProviderBehavior.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Behaviors/ToolStripButton/ToggleProviderBehavior.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/CheckboxAutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Events/DateTimePicker/PartAutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Events/MonthCalendar/AutomationNamePropertyEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Events/PopupButton/AutomationHasKeyboardFocusPropertyEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms.Events/ToolStripButton/TogglePatternToggleStateEvent.cs" subtype="Code" buildaction="Compile" /> >+ <File name="Mono.UIAutomation.Winforms/Helper.cs" subtype="Code" buildaction="Compile" /> > </Contents> > <References> > <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> >@@ -578,10 +585,10 @@ > <ProjectReference type="Gac" localcopy="True" refto="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> > <ProjectReference type="Gac" localcopy="True" refto="UIAutomationTypes, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> > <ProjectReference type="Gac" localcopy="True" refto="UIAutomationProvider, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> >+ <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> > <ProjectReference type="Gac" localcopy="True" refto="glib-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> > <ProjectReference type="Gac" localcopy="True" refto="atk-sharp, Version=2.14.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> > <ProjectReference type="Gac" localcopy="True" refto="Mono.WebBrowser, Version=0.5.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> >- <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> > </References> > <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am" IsAutotoolsProject="True" RelativeConfigureInPath=".."> > <BuildFilesVar Sync="True" Name="FILES" /> >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/BalloonWindowProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/BalloonWindowProvider.cs >index 049f4a7..28b912e 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/BalloonWindowProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/BalloonWindowProvider.cs >@@ -75,8 +75,7 @@ namespace Mono.UIAutomation.Winforms > protected override object GetProviderPropertyValue (int propertyId) > { > if (propertyId == AutomationElementIdentifiers.HelpTextProperty.Id) >- return Helper.SynchronizedGet<NotifyIcon.BalloonWindow, string> (balloon, >- s => balloon.AccessibleDescription ?? balloon.Title); >+ return balloon.InvokeSync (c => c.AccessibleDescription ?? c.Title); > else if (propertyId == AutomationElementIdentifiers.IsNotifyIconProperty.Id) > return true; > else >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs >index de26588..202f0fe 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/CheckedListBoxProvider.cs >@@ -52,7 +52,7 @@ namespace Mono.UIAutomation.Winforms > { > if (ContainsItem (item) == true) { > SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox) Control; >- Helper.SynchronizedSet (checkedListBox, delegate { >+ checkedListBox.InvokeSync (delegate { > bool chcked = checkedListBox.GetItemChecked (item.Index); > checkedListBox.SetItemChecked (item.Index, !chcked); > }); >@@ -65,8 +65,7 @@ namespace Mono.UIAutomation.Winforms > SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox) Control; > > SWF.CheckState state >- = Helper.SynchronizedGet<SWF.CheckedListBox, SWF.CheckState> (checkedListBox, >- s => checkedListBox.GetItemCheckState (item.Index)); >+ = checkedListBox.InvokeSync (c => c.GetItemCheckState (item.Index)); > switch (state) { > case SWF.CheckState.Checked: > return ToggleState.On; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs >index 6f20744..54c0534 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ComboBoxProvider.cs >@@ -79,8 +79,7 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AEIds.LocalizedControlTypeProperty.Id) > return Catalog.GetString ("combo box"); > else if (propertyId == AEIds.HasKeyboardFocusProperty.Id >- && Helper.SynchronizedGet<SWF.ComboBox, bool> (comboboxControl, >- b => comboboxControl.DropDownStyle == SWF.ComboBoxStyle.DropDown)) >+ && comboboxControl.InvokeSync (b => b.DropDownStyle == SWF.ComboBoxStyle.DropDown)) > return false; > else > return base.GetProviderPropertyValue (propertyId); >@@ -108,9 +107,7 @@ namespace Mono.UIAutomation.Winforms > > public override IRawElementProviderFragment GetFocus () > { >- return Helper.SynchronizedGet<SWF.ComboBox, IRawElementProviderFragment> (comboboxControl, >- v => listboxProvider.GetItemProviderFrom (listboxProvider, >- comboboxControl.SelectedItem)); >+ return comboboxControl.InvokeSync (c => listboxProvider.GetItemProviderFrom (listboxProvider, c.SelectedItem)); > } > > public override IRawElementProviderFragment ElementProviderFromPoint (double x, double y) >@@ -162,8 +159,7 @@ namespace Mono.UIAutomation.Winforms > private void UpdateBehaviors (bool updateAssociatedChildren) > { > SWF.ComboBoxStyle style >- = Helper.SynchronizedGet<SWF.ComboBox, SWF.ComboBoxStyle> (comboboxControl, >- s => comboboxControl.DropDownStyle); >+ = comboboxControl.InvokeSync (c => c.DropDownStyle); > > if (style == SWF.ComboBoxStyle.Simple) { > SetBehavior (ExpandCollapsePatternIdentifiers.Pattern, >@@ -305,8 +301,7 @@ namespace Mono.UIAutomation.Winforms > else > return Helper.GetControlScreenBounds (listboxControl.Bounds, listboxControl); > } else if (propertyId == AutomationElementIdentifiers.IsOffscreenProperty.Id) { >- if (Helper.SynchronizedGet<SWF.ComboBox, SWF.ComboBoxStyle> (comboboxControl, >- s => comboboxControl.DropDownStyle) >+ if (comboboxControl.InvokeSync (s => s.DropDownStyle) > == SWF.ComboBoxStyle.Simple) > return false; > >@@ -319,65 +314,62 @@ namespace Mono.UIAutomation.Winforms > > public override int SelectedItemsCount { > get { >- return Helper.SynchronizedGet<SWF.ComboBox, int> (comboboxControl, >- b => comboboxControl.SelectedIndex == -1 ? 0 : 1); >+ return comboboxControl.InvokeSync (c => c.SelectedIndex == -1 ? 0 : 1); > } > } > > public override int ItemsCount { > get { >- return Helper.SynchronizedGet<SWF.ComboBox, int> (comboboxControl, >- i => comboboxControl.Items.Count); >+ return comboboxControl.InvokeSync (c => c.Items.Count); > } > } > > public override int IndexOfObjectItem (object objectItem) > { >- return Helper.SynchronizedGet<SWF.ComboBox, int> (comboboxControl, >- v => comboboxControl.Items.IndexOf (objectItem)); >+ return comboboxControl.InvokeSync (c => c.Items.IndexOf (objectItem)); > } > > public override IRawElementProviderSimple[] GetSelectedItems () > { >- return Helper.SynchronizedGet<SWF.ComboBox, IRawElementProviderSimple[]> (comboboxControl, >- delegate { >- if (comboboxControl == null || comboboxControl.SelectedIndex == -1) >+ if (comboboxControl == null) >+ return new IRawElementProviderSimple [0]; >+ return comboboxControl.InvokeSync (c => { >+ if (c.SelectedIndex == -1) > return new IRawElementProviderSimple [0]; > else > return new IRawElementProviderSimple [] { GetItemProviderFrom (this, >- comboboxControl.SelectedItem) }; >+ c.SelectedItem) }; > }); > } > > public override void SelectItem (ListItemProvider item) > { > if (ContainsItem (item) == true) { >- Helper.SynchronizedSet (comboboxControl, delegate { >+ comboboxControl.InvokeSync (delegate { > comboboxControl.SelectedIndex = item.Index; >+ // Raise SelectionChangeCommitted event >+ // on the ComboBox. Since we are simulating >+ // a user interacting with the control, >+ // this event is expected. >+ // >+ // NOTE: This is a protected method that >+ // is a part of the documented >+ // API for SWF.ComboBox. >+ MethodInfo onSelectionChangeCommitted = >+ comboboxControl.GetType ().GetMethod ("OnSelectionChangeCommitted", >+ BindingFlags.NonPublic | BindingFlags.Instance); >+ if (onSelectionChangeCommitted != null) { >+ onSelectionChangeCommitted.Invoke (comboboxControl, >+ new object [] {EventArgs.Empty}); >+ } > }); >- >- // Raise SelectionChangeCommitted event >- // on the ComboBox. Since we are simulating >- // a user interacting with the control, >- // this event is expected. >- // >- // NOTE: This is a protected method that >- // is a part of the documented >- // API for SWF.ComboBox. >- MethodInfo onSelectionChangeCommitted = >- comboboxControl.GetType ().GetMethod ("OnSelectionChangeCommitted", >- BindingFlags.NonPublic | BindingFlags.Instance); >- if (onSelectionChangeCommitted != null) { >- onSelectionChangeCommitted.Invoke (comboboxControl, >- new object [] {EventArgs.Empty}); >- } > } > } > > public override void UnselectItem (ListItemProvider item) > { > if (ContainsItem (item) == true) >- Helper.SynchronizedSet (comboboxControl, delegate { >+ comboboxControl.InvokeSync (delegate { > comboboxControl.SelectedIndex = -1; > }); > } >@@ -387,10 +379,8 @@ namespace Mono.UIAutomation.Winforms > if (!ContainsItem (item)) > return false; > else >- return Helper.SynchronizedGet<SWF.ComboBox, bool> (comboboxControl, >- delegate { >- return item.Index == comboboxControl.SelectedIndex; }); >-// v => item.Index == v.SelectedIndex); >+ return comboboxControl.InvokeSync (c => { >+ return item.Index == c.SelectedIndex; }); > } > > public override void InitializeChildControlStructure () >@@ -400,8 +390,7 @@ namespace Mono.UIAutomation.Winforms > comboboxControl.Items.UIACollectionChanged += OnCollectionChanged; > > foreach (object objectItem >- in Helper.SynchronizedGet<SWF.ComboBox, SWF.ComboBox.ObjectCollection> (comboboxControl, >- i => comboboxControl.Items)) { >+ in comboboxControl.InvokeSync (c => c.Items)) { > ListItemProvider item = GetItemProviderFrom (this, objectItem); > AddChildProvider (item); > } >@@ -424,8 +413,7 @@ namespace Mono.UIAutomation.Winforms > int propertyId) > { > if (propertyId == AutomationElementIdentifiers.NameProperty.Id) >- return Helper.SynchronizedGet<SWF.ComboBox, string> (comboboxControl, >- v => comboboxControl.GetItemText (item.ObjectItem)); >+ return comboboxControl.InvokeSync (c => c.GetItemText (item.ObjectItem)); > int topItem = -1; > if (ListBoxControl != null) > topItem = ListBoxControl.UIATopItem; >@@ -433,8 +421,7 @@ namespace Mono.UIAutomation.Winforms > if (ContainsItem (item) == false) > return null; > else if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id) >- return Helper.SynchronizedGet<SWF.ComboBox, bool> (comboboxControl, >- b => comboboxControl.Focused && item.Index == comboboxControl.SelectedIndex); >+ return comboboxControl.InvokeSync (b => b.Focused && item.Index == b.SelectedIndex); > else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id) { > //FIXME: We need to improve this > int index = item.Index; >@@ -442,16 +429,12 @@ namespace Mono.UIAutomation.Winforms > System.Drawing.Rectangle bounds = System.Drawing.Rectangle.Empty; > > if (ListBoxControl == null) >- bounds = Helper.SynchronizedGet<SWF.ComboBox, System.Drawing.Rectangle> (comboboxControl, >- b => comboboxControl.Bounds); >+ bounds = comboboxControl.InvokeSync (c => c.Bounds); > else >- bounds = Helper.SynchronizedGet<SWF.ComboBox.ComboListBox, System.Drawing.Rectangle> (ListBoxControl, >- b => ListBoxControl.Bounds); >+ bounds = ListBoxControl.InvokeSync (c => c.Bounds); > >- int itemHeight = Helper.SynchronizedGet<SWF.ComboBox, int> (comboboxControl, >- i => comboboxControl.GetItemHeight (0));// TODO: always true? >- rectangle.Height = Helper.SynchronizedGet<SWF.ComboBox, int> (comboboxControl, >- i => comboboxControl.GetItemHeight (index)); >+ int itemHeight = comboboxControl.InvokeSync (c => c.GetItemHeight (0));// TODO: always true? >+ rectangle.Height = comboboxControl.InvokeSync (c => c.GetItemHeight (index)); > rectangle.Width = bounds.Width; > rectangle.X = bounds.X; > rectangle.Y = bounds.Y + (index * itemHeight) - (topItem * itemHeight);// decreaseY; >@@ -461,16 +444,16 @@ namespace Mono.UIAutomation.Winforms > else > return Helper.GetControlScreenBounds (rectangle, ListBoxControl); > } else if (propertyId == AutomationElementIdentifiers.IsOffscreenProperty.Id) { >- return Helper.SynchronizedGet<SWF.ComboBox, bool> (comboboxControl, delegate { >- if (comboboxControl.SelectedIndex == item.Index) >+ return comboboxControl.InvokeSync (c => { >+ if (c.SelectedIndex == item.Index) > return false; > > if (topItem == -1 || !ListBoxControl.Visible) >- return !(comboboxControl.SelectedIndex == item.Index); >+ return !(c.SelectedIndex == item.Index); > > int lastItem = ListBoxControl.UIALastItem; > if ((item.Index >= topItem && item.Index < lastItem) >- || (item.Index == lastItem && comboboxControl.Items.Count == lastItem + 1)) >+ || (item.Index == lastItem && c.Items.Count == lastItem + 1)) > return false; > else > return true; >@@ -630,7 +613,7 @@ namespace Mono.UIAutomation.Winforms > // This control cannot be selected, but > // it can still be keyboard focused, so > // we override it manually. >- return Control.CanFocus; >+ return Control.InvokeSync (c => c.CanFocus); > } > > return base.GetProviderPropertyValue (propertyId); >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormListener.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormListener.cs >index 2330f1d..f5615e8 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormListener.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormListener.cs >@@ -63,7 +63,6 @@ namespace Mono.UIAutomation.Winforms > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildRemoved, > provider); > } >- Helper.DelegateQueue.Get ().Quit (); > }; > > // FIXME: FormAdded is fired too frequently (such as >@@ -88,8 +87,6 @@ namespace Mono.UIAutomation.Winforms > if (formProviders.ContainsKey (f)) > return; > >-// Helper.SynchronizedSet (f, delegate { >- > FormProvider provider = (FormProvider) > ProviderFactory.GetProvider (f, true); > >@@ -107,20 +104,15 @@ namespace Mono.UIAutomation.Winforms > provider.Navigation = NavigationFactory.CreateNavigation (provider); > provider.Navigation.Initialize (); > >- Helper.DelegateQueue.Get ().Enqueue (delegate { >- > // TODO: Fill in rest of eventargs > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildAdded, > provider); > provider.InitializeChildControlStructure (); >- }); > } else { >- Console.WriteLine ("is child dialog..: {0}", Helper.DelegateQueue.Get ().Count); > FormProvider ownerProvider > = (FormProvider) ProviderFactory.FindProvider (f.Owner); > ownerProvider.AddChildProvider (provider); > } >-// }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormProvider.cs >index f797111..648b67a 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FormProvider.cs >@@ -59,7 +59,7 @@ namespace Mono.UIAutomation.Winforms > > // We keep a copy because we can't reference "form" after > // Disposed (used in Close()) called by WindowPatternWindowClosedEvent. >- owner = Helper.SynchronizedGet<Form, Form> (form, o => form.Owner); >+ owner = form.InvokeSync (c => c.Owner); > alreadyClosed = false; > } > >@@ -153,12 +153,11 @@ namespace Mono.UIAutomation.Winforms > > public override IRawElementProviderFragment ElementProviderFromPoint (double x, double y) > { >- if (Helper.SynchronizedGet<Form, bool> (form, >- b => x > form.Width || y > form.Height)) >+ if (form.InvokeSync (c => x > c.Width || y > c.Height)) > return null; > >- Control child = Helper.SynchronizedGet<Form, Control> (form, >- c => form.GetChildAtPoint (new Point ((int) x, (int) y))); >+ Control child >+ = form.InvokeSync (c => c.GetChildAtPoint (new Point ((int) x, (int) y))); > > if (child != null) { > Log.Debug (child.ToString ()); >@@ -179,9 +178,8 @@ namespace Mono.UIAutomation.Winforms > > public override IRawElementProviderFragment GetFocus () > { >- foreach (Control control >- in Helper.SynchronizedGet<Form, Control.ControlCollection> (form, f => f.Controls)) { >- if (control.Focused) { >+ foreach (Control control in form.InvokeSync (f => f.Controls)) { >+ if (control.InvokeSync (c => c.Focused)) { > // TODO: Necessary to delve into child control > // for focused element? > >@@ -209,10 +207,8 @@ namespace Mono.UIAutomation.Winforms > alreadyClosed = true; > > if (owner == null) { >- Helper.DelegateQueue.Get ().Enqueue (delegate { > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildRemoved, > this); >- }); > } else { > FormProvider ownerProvider > = ProviderFactory.FindProvider (owner) as FormProvider; >@@ -224,7 +220,7 @@ namespace Mono.UIAutomation.Winforms > > private void SetupMainMenuProvider () > { >- MainMenu mainMenu = Helper.SynchronizedGet<Form, MainMenu> (form, m => form.Menu); >+ MainMenu mainMenu = form.InvokeSync (f => f.Menu); > > if (mainMenu != null) { > mainMenuProvider = (MainMenuProvider) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FragmentControlProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FragmentControlProvider.cs >index 8ae9829..e39e848 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FragmentControlProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/FragmentControlProvider.cs >@@ -66,15 +66,15 @@ namespace Mono.UIAutomation.Winforms > children = new List<FragmentControlProvider> (); > componentChildren = new List<Component> (); > >-// if (Control != null) { >-// Control.ContextMenuChanged += HandleContextMenuChanged; >-// Control.ContextMenuStripChanged += HandleContextMenuStripChanged; >-// >-// HandleContextMenuChanged (null, EventArgs.Empty); >-// HandleContextMenuStripChanged (null, EventArgs.Empty); >-// >-// visible = Helper.SynchronizedGet<SWF.Control, bool> (Control, v => Control.Visible); >-// } >+ if (Control != null) { >+ Control.ContextMenuChanged += HandleContextMenuChanged; >+ Control.ContextMenuStripChanged += HandleContextMenuStripChanged; >+ >+ HandleContextMenuChanged (null, EventArgs.Empty); >+ HandleContextMenuStripChanged (null, EventArgs.Empty); >+ >+ visible = Control.InvokeSync (c => c.Visible); >+ } > } > > void HandleContextMenuStripChanged (object sender, EventArgs e) >@@ -83,7 +83,7 @@ namespace Mono.UIAutomation.Winforms > contextMenuStrip.Opened -= HandleContextMenuStripOpened; > contextMenuStrip.Closed -= HandleContextMenuStripClosed; > } >- contextMenuStrip = Helper.SynchronizedGet<SWF.Control, SWF.ContextMenuStrip> (Control, m => Control.ContextMenuStrip); >+ contextMenuStrip = Control.InvokeSync (c => c.ContextMenuStrip); > > if (contextMenuStrip != null) { > contextMenuStrip.Opened += HandleContextMenuStripOpened; >@@ -116,7 +116,7 @@ namespace Mono.UIAutomation.Winforms > contextMenu.Popup -= HandleContextMenuPopup; > contextMenu.Collapse -= HandleContextMenuCollapse; > } >- contextMenu = Helper.SynchronizedGet<SWF.Control, SWF.ContextMenu> (Control, c => c.ContextMenu); >+ contextMenu = Control.InvokeSync (c => c.ContextMenu); > > if (contextMenu != null) { > contextMenu.Popup += HandleContextMenuPopup; >@@ -271,7 +271,7 @@ namespace Mono.UIAutomation.Winforms > HandleContextMenuChanged (null, EventArgs.Empty); > HandleContextMenuStripChanged (null, EventArgs.Empty); > >- visible = Helper.SynchronizedGet<SWF.Control, bool> (Control, v => Control.Visible); >+ visible = Control.InvokeSync (c => c.Visible); > } > } > >@@ -291,7 +291,7 @@ namespace Mono.UIAutomation.Winforms > Control.ControlAdded += OnControlAdded; > Control.ControlRemoved += OnControlRemoved; > >- foreach (SWF.Control childControl in Control.Controls) >+ foreach (SWF.Control childControl in Control.InvokeSync (c => c.Controls)) > HandleComponentAdded (childControl); > > Control.VisibleChanged += OnControlVisibleChanged; >@@ -349,7 +349,7 @@ namespace Mono.UIAutomation.Winforms > > private void OnControlVisibleChanged (object sender, EventArgs args) > { >- bool isVisible = Helper.SynchronizedGet<SWF.Control, bool> (Control, v => v.Visible); >+ bool isVisible = Control.InvokeSync (c => c.Visible); > > if (visible == isVisible) > return; >@@ -479,7 +479,7 @@ namespace Mono.UIAutomation.Winforms > { > SWF.Control control = null; > if ((control = component as SWF.Control) != null) >- return control.Visible; >+ return control.InvokeSync (c => c.Visible); > else // Component based providers will need to override this method > return false; > } >@@ -539,7 +539,7 @@ namespace Mono.UIAutomation.Winforms > public virtual void SetFocus () > { > if (Control != null) >- Helper.SynchronizedSet (Control, delegate { Control.Focus (); }); >+ Control.InvokeSync (delegate { Control.Focus (); }); > } > > #endregion >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/Helper.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/Helper.cs >index 7052d4a..662ff9b 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/Helper.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/Helper.cs >@@ -17,7 +17,7 @@ > // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > // >-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) >+// Copyright (c) 2008,2009 Novell, Inc. (http://www.novell.com) > // > // Authors: > // Mario Carrion <mcarrion@novell.com> >@@ -74,22 +74,22 @@ namespace Mono.UIAutomation.Winforms > if (control == null) > return Rect.Empty; > else { >-// Console.WriteLine ("Helper.GetControlScreenBounds"); >-// return Helper.SynchronizedGet<SWF.Control, Rect> (control, delegate { >- if (!control.Visible) >- return Rect.Empty; >- else if (controlIsParent) >- return Helper.RectangleToRect (control.RectangleToScreen (bounds)); >- else if (control.Parent == null || control.TopLevelControl == null) >- return Helper.RectangleToRect (bounds); >- else { >- if (control.FindForm () == control.Parent) >- return Helper.RectangleToRect (control.TopLevelControl.RectangleToScreen (bounds)); >- else >- return Helper.RectangleToRect (control.Parent.RectangleToScreen (bounds)); >- } >-// }); >- } >+// SWF.Control c = control; >+ return control.InvokeSync (c => { >+ if (!c.Visible) >+ return Rect.Empty; >+ else if (controlIsParent) >+ return Helper.RectangleToRect (c.RectangleToScreen (bounds)); >+ else if (c.Parent == null || c.TopLevelControl == null) >+ return Helper.RectangleToRect (bounds); >+ else { >+ if (c.FindForm () == c.Parent) >+ return Helper.RectangleToRect (c.TopLevelControl.RectangleToScreen (bounds)); >+ else >+ return Helper.RectangleToRect (c.Parent.RectangleToScreen (bounds)); >+ } >+ }); >+ } > } > > internal static Rect GetToolStripItemScreenBounds (SWF.ToolStripItem item) >@@ -102,8 +102,7 @@ namespace Mono.UIAutomation.Winforms > if (item.Owner == null) > return item.Bounds; > else >- //return Helper.SynchronizedGet<SWF.ToolStrip, System.Drawing.Rectangle> (item.Owner, v => item.Owner.RectangleToScreen (item.Bounds)); >- return item.Owner.RectangleToScreen (item.Bounds); >+ return item.Owner.InvokeSync (c => c.RectangleToScreen (item.Bounds)); > } > > internal static object GetClickablePoint (SimpleControlProvider provider) >@@ -160,8 +159,7 @@ namespace Mono.UIAutomation.Winforms > Rectangle headerBounds, > IScrollBehaviorObserver observer) > { >- Rectangle listViewRectangle = Helper.SynchronizedGet<SWF.Control, Rectangle> (containerControl, >- b => containerControl.Bounds); >+ Rectangle listViewRectangle = containerControl.InvokeSync (c => c.Bounds); > if (visibleHeader) { > listViewRectangle.Y += headerBounds.Height; > listViewRectangle.Height -= headerBounds.Height; >@@ -171,11 +169,9 @@ namespace Mono.UIAutomation.Winforms > if (observer.VerticalScrollBar.Visible) > listViewRectangle.Width -= observer.VerticalScrollBar.Width; > >- SWF.Control parent >- = Helper.SynchronizedGet<SWF.Control, SWF.Control> (containerControl, p => containerControl.Parent); >+ SWF.Control parent = containerControl.InvokeSync (c => c.Parent); > Rect screen >- = Helper.SynchronizedGet<SWF.Control, Rect> (parent, >- r => Helper.RectangleToRect (parent.RectangleToScreen (listViewRectangle))); >+ = parent.InvokeSync (c => Helper.RectangleToRect (c.RectangleToScreen (listViewRectangle))); > return !itemBounds.IntersectsWith (screen); > } > >@@ -199,14 +195,14 @@ namespace Mono.UIAutomation.Winforms > int imageY; > int imageWidth; > int imageHeight; >- int width = Helper.SynchronizedGet<SWF.ButtonBase, int> (buttonBase, w => buttonBase.Width); >- int height = Helper.SynchronizedGet<SWF.ButtonBase, int> (buttonBase, h => buttonBase.Height); >+ int width = buttonBase.InvokeSync (c => c.Width); >+ int height = buttonBase.InvokeSync (c => c.Height); > >- image = Helper.SynchronizedGet<SWF.ButtonBase, Image> (buttonBase, delegate { >- if (buttonBase.ImageIndex != -1) >- return buttonBase.ImageList.Images [buttonBase.ImageIndex]; >+ image = buttonBase.InvokeSync (c => { >+ if (c.ImageIndex != -1) >+ return c.ImageList.Images [c.ImageIndex]; > else >- return buttonBase.Image; >+ return c.Image; > }); > > if (image == null) >@@ -215,7 +211,7 @@ namespace Mono.UIAutomation.Winforms > imageWidth = image.Width; > imageHeight = image.Height; > >- switch (Helper.SynchronizedGet<SWF.ButtonBase, ContentAlignment> (buttonBase, i => buttonBase.ImageAlign)) { >+ switch (buttonBase.InvokeSync (c => c.ImageAlign)) { > case ContentAlignment.TopLeft: { > imageX = 5; > imageY = 5; >@@ -402,13 +398,10 @@ namespace Mono.UIAutomation.Winforms > else > runtimeId = provider.GetRuntimeId (); > >-// System.Threading.ThreadPool.QueueUserWorkItem (v => { >-// DelegateQueue.Get ().Enqueue (delegate { >- StructureChangedEventArgs invalidatedArgs >- = new StructureChangedEventArgs (type, runtimeId); >- AutomationInteropProvider.RaiseStructureChangedEvent (provider, >- invalidatedArgs); >-// }); >+ StructureChangedEventArgs invalidatedArgs >+ = new StructureChangedEventArgs (type, runtimeId); >+ AutomationInteropProvider.RaiseStructureChangedEvent (provider, >+ invalidatedArgs); > } > } > >@@ -471,191 +464,29 @@ namespace Mono.UIAutomation.Winforms > return s; > } > >- private static Thread invokeThread; >- private static object invokeThreadLock = new object (); >-// private static object lockObj = new object (); >- >- private static Thread InvokeThread { >- // FIXME: Remove getter >- get { >- lock (invokeThreadLock) { >- return invokeThread; >- } >- } >- >- set { >- lock (invokeThreadLock) { >- invokeThread = Thread.CurrentThread; >- } >- } >- } >- > internal static Return SynchronizedGet<Subject, Return> (Subject subject, Func<Subject, Return> verb) >- where Subject : SWF.Control >- { >- lock (lockObject) { >- // If is being used already in a different thread >- if (Interlocked.CompareExchange (ref Counter, 1, 1) == 1 >- && (InvokeThread != null && InvokeThread != Thread.CurrentThread)) { >- Console.WriteLine ("ya esta siendo usado..."); >- Monitor.Wait (lockObject); >- InvokeThread = null; >- } >- } >- >+ where Subject : SWF.Control >+ { > if (subject.InvokeRequired && subject.IsHandleCreated) { >- return (Return) subject.Invoke (new Func<Subject, Func<Subject, Return>, Return> (SynchronizedGet<Subject, Return>), >- new object [] { subject, verb }); >- } else { >- InvokeThread = Thread.CurrentThread; >- int oldValue = Interlocked.Exchange (ref Counter, 1); >- >- >- if (oldValue != 1) { >- Console.WriteLine ("GET unlocing thread"); >- Interlocked.Exchange (ref Counter, 0); >- >- lock (lockObject) { >- Monitor.Pulse (lockObject); >- } >- >- lock (Helper.DelegateQueue.Lock) { >- Monitor.Pulse (Helper.DelegateQueue.Lock); >- } >- } >- >- Return v = verb (subject); >- >- return v; >+// return (Return) subject.Invoke (new Func<Subject, Func<Subject, Return>, Return> (SynchronizedGet<Subject, Return>), >+// new object [] { subject, verb }); >+ return (Return) subject.Invoke (verb, subject); >+ } else { >+ return verb (subject); > } > } > > internal static int Counter = 0; >- static object lockObject = new object (); >-// static object lockObjectMonitor = new object () > > internal static void SynchronizedSet (SWF.Control subject, Action<SWF.Control> verb) > { >- lock (lockObject) { >- // If is being used, wait >- if (Interlocked.CompareExchange (ref Counter, 1, 1) == 1 >- && (InvokeThread != null && InvokeThread != Thread.CurrentThread)) { >- Console.WriteLine ("SET ya esta siendo usado..."); >- Monitor.Wait (lockObject); >- } >- } >- > if (subject.InvokeRequired && subject.IsHandleCreated) { > subject.BeginInvoke (new Action<SWF.Control, Action<SWF.Control>> (SynchronizedSet), >- new object [] { subject, verb }); >+ new object [] { subject, verb }); > } else { >- InvokeThread = Thread.CurrentThread; >- int oldValue = Interlocked.Exchange (ref Counter, 1); >- >- >- if (oldValue != 1) { // We are being called by Set/Get >- Console.WriteLine ("SET unlocing thread"); >- Interlocked.Exchange (ref Counter, 0); >- >- lock (lockObject) { >- Monitor.Pulse (lockObject); >- } >- >- lock (Helper.DelegateQueue.Lock) { >- Monitor.Pulse (Helper.DelegateQueue.Lock); >- } >- >- } >- > verb (subject); >- > } > } >- >- internal class DelegateQueue >- { >- public static DelegateQueue Get () >- { >- if (consumer == null) >- consumer = new DelegateQueue (); >- >- return consumer; >- } >- >- public void Enqueue (QueueDelegate value) >- { >- lock (lockObj) { >- queue.Enqueue (value); >- } >- } >- >- public int Count { >- get { >- lock (lockObj) { >- return queue.Count; >- } >- } >- } >- >- public QueueDelegate Dequeue () >- { >- lock (lockObj) { >- if (queue.Count == 0) >- return null; >- else >- return queue.Dequeue (); >- } >- } >- >- private DelegateQueue () >- { >- queue = new System.Collections.Generic.Queue<QueueDelegate> (); >- threadConsumer = new Thread (new ThreadStart (Consume)); >- threadConsumer.Name = "AIPConsumer"; >- threadConsumer.Start (); >- } >- >- public void Quit () >- { >- lock (lockObj) { >- Console.WriteLine ("Not proceseed events: {0}", queue.Count); >- close = true; >- lock (DelegateQueue.Lock) { >- Monitor.Pulse (DelegateQueue.Lock); >- } >- } >- } >- >- private void Consume () >- { >- while (!close) { >- QueueDelegate action = Dequeue (); >- if (action == null || Interlocked.CompareExchange (ref Helper.Counter, 0, 0) != 0) { >- lock (DelegateQueue.Lock) { >- Console.WriteLine ("waiting...: {0}", action == null); >- Monitor.Wait (DelegateQueue.Lock); >- if (close) >- break; >- continue; >- } >- } >- Console.WriteLine ("Raising action!"); >- action (); >- } >- } >- >- private bool close = false; >- >- public delegate void QueueDelegate (); >- >- public static readonly object Lock = new object (); >- >- private object lockObj = new object (); >- private static DelegateQueue consumer; >- >- private Thread threadConsumer; >- private System.Collections.Generic.Queue<QueueDelegate> queue; >- } > > #endregion > >@@ -703,4 +534,45 @@ namespace Mono.UIAutomation.Winforms > > #endregion > } >+ >+ internal static class InvokeRequiredExtensionControl >+ { >+ public static TResult InvokeSync<TControl, TResult> (this TControl control, >+ Func<TControl, TResult> func) >+ where TControl : SWF.Control >+ { >+ // This happens when a Winforms event raises an AutomationEvent >+ // that raises an Atk event that needs to request Winforms data :-) >+ if (AlreadyInvoked) >+ return (TResult) func (control); >+ >+ if (control.InvokeRequired && control.IsHandleCreated) { >+ if (Interlocked.CompareExchange (ref alreadyInvoked, 1, 0) == 1) { >+ TResult result = (TResult) control.Invoke (func, control); >+ Interlocked.CompareExchange (ref alreadyInvoked, 0, 1); >+ return result; >+ } else >+ return (TResult) func (control); >+ } else >+ return (TResult) func (control); >+ } >+ >+ public static void InvokeSync<TControl> (this TControl control, >+ Action<TControl> action) >+ where TControl : SWF.Control >+ { >+ // We don't care about AlreadyInvoked since we are not >+ // returning a value. >+ if (control.InvokeRequired && control.IsHandleCreated) >+ control.BeginInvoke (action, control); >+ else >+ action (control); >+ } >+ >+ private static bool AlreadyInvoked { >+ get { return Interlocked.CompareExchange (ref alreadyInvoked, 0, 0) == 1; } >+ } >+ >+ private static int alreadyInvoked = 0; >+ } > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListBoxProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListBoxProvider.cs >index 8f1f259..e9edd11 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListBoxProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListBoxProvider.cs >@@ -57,15 +57,13 @@ namespace Mono.UIAutomation.Winforms > > protected override ScrollBar HorizontalScrollBar { > get { >- return Helper.SynchronizedGet<ListBox, ScrollBar> (listboxControl, >- s => listboxControl.UIAHScrollBar); >+ return listboxControl.InvokeSync (c => c.UIAHScrollBar); > } > } > > protected override ScrollBar VerticalScrollBar { > get { >- return Helper.SynchronizedGet<ListBox, ScrollBar> (listboxControl, >- s => listboxControl.UIAVScrollBar); >+ return listboxControl.InvokeSync (c => c.UIAVScrollBar); > } > } > >@@ -94,11 +92,11 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id) > return Catalog.GetString ("list"); > else if (propertyId == AutomationElementIdentifiers.NameProperty.Id) { >- return Helper.SynchronizedGet<ListBox, string> (listboxControl, delegate { >- if (string.IsNullOrEmpty (listboxControl.AccessibleName)) >- return Helper.StripAmpersands (listboxControl.Text); >+ return listboxControl.InvokeSync (c => { >+ if (string.IsNullOrEmpty (c.AccessibleName)) >+ return Helper.StripAmpersands (c.Text); > else >- return listboxControl.AccessibleName; >+ return c.AccessibleName; > }); > } else > return base.GetProviderPropertyValue (propertyId); >@@ -121,13 +119,12 @@ namespace Mono.UIAutomation.Winforms > > public override IRawElementProviderFragment GetFocus () > { >- return Helper.SynchronizedGet<ListBox, IRawElementProviderFragment> (listboxControl, >- c => GetItemProviderFrom (this, listboxControl.Items [listboxControl.FocusedItem])); >+ return listboxControl.InvokeSync (c => GetItemProviderFrom (this, c.Items [c.FocusedItem])); > } > > public override void FocusItem (object objectItem) > { >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.FocusedItem = listboxControl.Items.IndexOf (objectItem); > }); > } >@@ -136,7 +133,7 @@ namespace Mono.UIAutomation.Winforms > { > base.InitializeChildControlStructure (); > >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.Items.UIACollectionChanged += OnCollectionChanged; > > foreach (object objectItem in listboxControl.Items) { >@@ -150,7 +147,7 @@ namespace Mono.UIAutomation.Winforms > { > base.FinalizeChildControlStructure (); > >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.Items.UIACollectionChanged -= OnCollectionChanged; > }); > } >@@ -163,29 +160,27 @@ namespace Mono.UIAutomation.Winforms > int propertyId) > { > if (propertyId == AutomationElementIdentifiers.NameProperty.Id) >- return Helper.SynchronizedGet<ListBox, string> (listboxControl, >- s => listboxControl.GetItemText (item.ObjectItem)); >+ return listboxControl.InvokeSync (s => s.GetItemText (item.ObjectItem)); > > if (ContainsItem (item) == false) > return null; > > if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id) >- return Helper.SynchronizedGet<ListBox, bool> (listboxControl, >- b => listboxControl.Focused >- && item.Index == listboxControl.FocusedItem); >+ return listboxControl.InvokeSync (s => s.Focused >+ && item.Index == s.FocusedItem); > else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id) { >- return Helper.SynchronizedGet<ListBox, Rect> (listboxControl, delegate { >+ return listboxControl.InvokeSync (c => { > System.Drawing.Rectangle itemRec = System.Drawing.Rectangle.Empty; >- System.Drawing.Rectangle rectangle = listboxControl.Bounds; >+ System.Drawing.Rectangle rectangle = c.Bounds; > >- itemRec = listboxControl.GetItemRectangle (item.Index); >+ itemRec = c.GetItemRectangle (item.Index); > itemRec.X += rectangle.X; > itemRec.Y += rectangle.Y; > >- if (listboxControl.FindForm () == listboxControl.Parent) >- itemRec = listboxControl.TopLevelControl.RectangleToScreen (itemRec); >+ if (c.FindForm () == c.Parent) >+ itemRec = c.TopLevelControl.RectangleToScreen (itemRec); > else >- itemRec = listboxControl.Parent.RectangleToScreen (itemRec); >+ itemRec = c.Parent.RectangleToScreen (itemRec); > > return Helper.RectangleToRect (itemRec); > }); >@@ -204,16 +199,16 @@ namespace Mono.UIAutomation.Winforms > #region ListProvider: Specializations > > public override int SelectedItemsCount { >- get { return Helper.SynchronizedGet<ListBox, int> (listboxControl, c => listboxControl.SelectedItems.Count); } >+ get { return listboxControl.InvokeSync (c => c.SelectedItems.Count); } > } > > public override int ItemsCount { >- get { return Helper.SynchronizedGet<ListBox, int> (listboxControl, c => listboxControl.Items.Count); } >+ get { return listboxControl.InvokeSync (c => c.Items.Count); } > } > > public override int IndexOfObjectItem (object objectItem) > { >- return Helper.SynchronizedGet<ListBox, int> (listboxControl, c => listboxControl.Items.IndexOf (objectItem)); >+ return listboxControl.InvokeSync (c => c.Items.IndexOf (objectItem)); > } > > public override IRawElementProviderSimple[] GetSelectedItems () >@@ -221,14 +216,13 @@ namespace Mono.UIAutomation.Winforms > ListItemProvider []items; > > if (listboxControl == null >- || Helper.SynchronizedGet<ListBox, bool> (listboxControl, >- c => listboxControl.SelectedIndices.Count == 0)) >+ || listboxControl.InvokeSync (c => c.SelectedIndices.Count == 0)) > return new ListItemProvider [0]; > >- return Helper.SynchronizedGet<ListBox, ListItemProvider[]> (listboxControl, delegate { >- items = new ListItemProvider [listboxControl.SelectedIndices.Count]; >+ return listboxControl.InvokeSync (c => { >+ items = new ListItemProvider [c.SelectedIndices.Count]; > for (int index = 0; index < items.Length; index++) >- items [index] = GetItemProviderFrom (this, listboxControl.Items [listboxControl.SelectedIndices [index]]); >+ items [index] = GetItemProviderFrom (this, c.Items [c.SelectedIndices [index]]); > > return items; > }); >@@ -236,22 +230,21 @@ namespace Mono.UIAutomation.Winforms > > public override void SelectItem (ListItemProvider item) > { >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.SetSelected (item.Index, true); > }); > } > > public override void UnselectItem (ListItemProvider item) > { >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.SetSelected (item.Index, false); > }); > } > > public override bool IsItemSelected (ListItemProvider item) > { >- return Helper.SynchronizedGet<ListBox, bool> (listboxControl, >- b => listboxControl.SelectedIndices.Contains (item.Index)); >+ return listboxControl.InvokeSync (b => b.SelectedIndices.Contains (item.Index)); > } > > public override IConnectable GetListItemEventRealization (ProviderEventType eventType, >@@ -270,7 +263,7 @@ namespace Mono.UIAutomation.Winforms > public override void ScrollItemIntoView (ListItemProvider item) > { > if (ContainsItem (item) == true) >- Helper.SynchronizedSet (listboxControl, delegate { >+ listboxControl.InvokeSync (delegate { > listboxControl.TopIndex = item.Index; > }); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListViewProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListViewProvider.cs >index 79ce9d0..d45e4b4 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListViewProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ListViewProvider.cs >@@ -17,7 +17,7 @@ > // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > // >-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) >+// Copyright (c) 2008,2009 Novell, Inc. (http://www.novell.com) > // > // Authors: > // Mario Carrion <mcarrion@novell.com> >@@ -48,9 +48,9 @@ namespace Mono.UIAutomation.Winforms > public ListViewProvider (SWF.ListView listView) : base (listView) > { > this.listView = listView; >- >- lastView = Helper.SynchronizedGet<SWF.ListView, SWF.View> (listView, v => listView.View); >- showGroups = Helper.SynchronizedGet<SWF.ListView, bool> (listView, g => listView.ShowGroups); >+ >+ lastView = listView.InvokeSync (c => c.View); >+ showGroups = listView.InvokeSync (c => c.ShowGroups); > groups = new Dictionary<SWF.ListViewGroup, ListViewGroupProvider> (); > } > >@@ -70,14 +70,12 @@ namespace Mono.UIAutomation.Winforms > protected override object GetProviderPropertyValue (int propertyId) > { > if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id) { >- if (Helper.SynchronizedGet<SWF.ListView, SWF.View> (listView, >- v => listView.View) == SWF.View.Details) >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) > return ControlType.DataGrid.Id; > else > return ControlType.List.Id; > } else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id) { >- if (Helper.SynchronizedGet<SWF.ListView, SWF.View> (listView, >- v => listView.View) == SWF.View.Details) >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) > return Catalog.GetString ("data grid"); > else > return Catalog.GetString ("list"); >@@ -101,20 +99,15 @@ namespace Mono.UIAutomation.Winforms > else if (behavior == SelectionPatternIdentifiers.Pattern) > return new SelectionProviderBehavior (this); > else if (behavior == GridPatternIdentifiers.Pattern) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- s => listView.ShowGroups == false) >- || Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- v => SWF.Application.VisualStylesEnabled == false) >- || Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- vi => listView.View == SWF.View.List) >- || Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- d => listView.View == SWF.View.Details)) >+ if (listView.InvokeSync (c => !c.ShowGroups >+ || !SWF.Application.VisualStylesEnabled >+ || c.View == SWF.View.List >+ || c.View == SWF.View.Details)) > return new GridProviderBehavior (this); > else > return null; > } else if (behavior == TablePatternIdentifiers.Pattern) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- v => listView.View == SWF.View.Details)) >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) > return new TableProviderBehavior (this); > else > return null; >@@ -131,27 +124,23 @@ namespace Mono.UIAutomation.Winforms > return new ListItemSelectionItemProviderBehavior (listItem); > else if (behavior == GridItemPatternIdentifiers.Pattern) { > // LAMESPEC: GridItem implemented *only* when: listView.View != SWF.View.Details >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- v => listView.View != SWF.View.Details) >+ if (listView.InvokeSync (c => c.View != SWF.View.Details) > || IsBehaviorEnabled (GridPatternIdentifiers.Pattern)) > return new ListItemGridItemProviderBehavior (listItem); > else > return null; > } else if (behavior == ValuePatternIdentifiers.Pattern) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- e => listView.LabelEdit)) >+ if (listView.InvokeSync (c => c.LabelEdit)) > return new ListItemValueProviderBehavior (listItem); > else > return null; > } else if (behavior == TogglePatternIdentifiers.Pattern) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- e => listView.CheckBoxes)) >+ if (listView.InvokeSync (c => c.CheckBoxes)) > return new ListItemToggleProviderBehavior (listItem); > else > return null; > } else if (behavior == TableItemPatternIdentifiers.Pattern) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- d => listView.View == SWF.View.Details)) >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) > return new ListItemTableItemProviderBehavior (listItem); > else > return null; >@@ -173,37 +162,31 @@ namespace Mono.UIAutomation.Winforms > if (propertyId == AutomationElementIdentifiers.NameProperty.Id) > return ((SWF.ListViewItem) item.ObjectItem).Text; > else if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id) >- return Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- f => listView.Focused) >- && ((SWF.ListViewItem)item.ObjectItem).Focused; >+ return listView.InvokeSync (c => c.Focused >+ && ((SWF.ListViewItem) item.ObjectItem).Focused); > else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id) { > int index = item.Index; > > if (index == -1 >- || index >= Helper.SynchronizedGet<SWF.ListView, int> (listView, >- i => listView.UIAItemsLocationLength)) >+ || listView.InvokeSync (l => index >= l.UIAItemsLocationLength)) > return Helper.RectangleToRect (SD.Rectangle.Empty); > > SD.Rectangle itemRec >- = Helper.SynchronizedGet<SWF.ListView, SD.Rectangle> (listView, >- i => listView.GetItemRect (index)); >+ = listView.InvokeSync (c => c.GetItemRect (index)); > SD.Rectangle rectangle >- = Helper.SynchronizedGet<SWF.ListView, SD.Rectangle> (listView, >- i => listView.Bounds); >+ = listView.InvokeSync (c => c.Bounds); > > itemRec.X += rectangle.X; > itemRec.Y += rectangle.Y; > >- itemRec = Helper.SynchronizedGet<SWF.ListView, SD.Rectangle> (listView, >- i => listView.Parent.RectangleToScreen (itemRec)); >+ itemRec = listView.InvokeSync (c => c.Parent.RectangleToScreen (itemRec)); > > return Helper.RectangleToRect (itemRec); > } else if (propertyId == AutomationElementIdentifiers.IsOffscreenProperty.Id) > return Helper.IsListItemOffScreen ((Rect) item.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id), > listView, > HeaderProvider != null, >- Helper.SynchronizedGet<SWF.ListView, SD.Rectangle> (listView, >- i => listView.UIAHeaderControl), >+ listView.InvokeSync (c => c.UIAHeaderControl), > ScrollBehaviorObserver); > else if (propertyId == AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id) > return true; >@@ -226,9 +209,7 @@ namespace Mono.UIAutomation.Winforms > { > base.InitializeChildControlStructure (); > >- Helper.SynchronizedSet (listView, delegate { >- listView.Items.UIACollectionChanged += OnCollectionChanged; >- }); >+ listView.Items.UIACollectionChanged += OnCollectionChanged; > > // Use to regenerate children when view changes > listView.UIAViewChanged += OnUIAViewChanged; >@@ -239,29 +220,25 @@ namespace Mono.UIAutomation.Winforms > { > base.FinalizeChildControlStructure (); > >- Helper.SynchronizedSet (listView, delegate { >- listView.Items.UIACollectionChanged -= OnCollectionChanged; >- }); >+ listView.Items.UIACollectionChanged -= OnCollectionChanged; > > listView.UIAViewChanged -= OnUIAViewChanged; > } > > public override int ItemsCount { >- get { >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, >- c => listView.Items.Count); >- } >+ get { return listView.InvokeSync (c => c.Items.Count); } > } > > public override int IndexOfObjectItem (object objectItem) > { >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, >- c => listView.Items.IndexOf (objectItem as SWF.ListViewItem)); >+ return listView.InvokeSync (c => c.Items.IndexOf (objectItem as SWF.ListViewItem)); > } > > public override void FocusItem (object objectItem) > { >- ((SWF.ListViewItem)objectItem).Focused = true; >+ listView.InvokeSync (delegate { >+ ((SWF.ListViewItem) objectItem).Focused = true; >+ }); > } > > #endregion >@@ -269,29 +246,27 @@ namespace Mono.UIAutomation.Winforms > #region ListItem: Selection Methods and Properties > > public override int SelectedItemsCount { >- get { >- return Helper.SynchronizedGet<SWF.ListView, int> (listView, >- c => listView.SelectedItems.Count); >- } >+ get { return listView.InvokeSync (c => c.SelectedIndices.Count); } > } > > public override bool IsItemSelected (ListItemProvider item) > { >- return Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- c => listView.SelectedIndices.Contains (item.Index)); >+ return listView.InvokeSync (c => c.SelectedIndices.Contains (item.Index)); > } > > public override IRawElementProviderSimple[] GetSelectedItems () > { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- c => listView.SelectedIndices.Count == 0)) >+ if (listView == null) >+ return new ListItemProvider [0]; >+ >+ if (listView.InvokeSync (c => c.SelectedIndices.Count == 0)) > return new ListItemProvider [0]; > else { >- return Helper.SynchronizedGet<SWF.ListView, ListItemProvider[]> (listView, delegate { >- ListItemProvider []providers = new ListItemProvider [listView.SelectedItems.Count]; >+ return listView.InvokeSync (c => { >+ ListItemProvider []providers = new ListItemProvider [c.SelectedItems.Count]; > >- for (int index = 0; index < listView.SelectedItems.Count; index++) >- providers [index] = GetItemProviderFrom (this, listView.SelectedItems [index], false); >+ for (int index = 0; index < c.SelectedItems.Count; index++) >+ providers [index] = GetItemProviderFrom (this, c.SelectedItems [index], false); > > return providers; > }); >@@ -301,7 +276,7 @@ namespace Mono.UIAutomation.Winforms > public override void SelectItem (ListItemProvider item) > { > if (ContainsItem (item) == true) >- Helper.SynchronizedSet (listView, delegate { >+ listView.InvokeSync (delegate { > listView.Items [item.Index].Selected = true; > }); > } >@@ -309,7 +284,7 @@ namespace Mono.UIAutomation.Winforms > public override void UnselectItem (ListItemProvider item) > { > if (ContainsItem (item) == true) >- Helper.SynchronizedSet (listView, delegate { >+ listView.InvokeSync (delegate { > listView.Items [item.Index].Selected = false; > }); > } >@@ -320,13 +295,12 @@ namespace Mono.UIAutomation.Winforms > > public override ToggleState GetItemToggleState (ListItemProvider item) > { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, c => !listView.CheckBoxes) >+ if (listView.InvokeSync (c => !c.CheckBoxes) > || item.Index == -1) > return ToggleState.Indeterminate; > > if (ContainsItem (item) == true) >- return Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- c => listView.Items [item.Index].Checked) >+ return listView.InvokeSync (c => c.Items [item.Index].Checked) > ? ToggleState.On : ToggleState.Off; > else > return ToggleState.Indeterminate; >@@ -334,12 +308,12 @@ namespace Mono.UIAutomation.Winforms > > public override void ToggleItem (ListItemProvider item) > { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, c => !listView.CheckBoxes)) >+ if (listView.InvokeSync (c => !c.CheckBoxes)) > return; > > if (ContainsItem (item) == true) >- Helper.SynchronizedSet (listView, delegate { >- listView.Items [item.Index].Checked = !listView.Items [item.Index].Checked; >+ listView.InvokeSync (delegate { >+ listView.Items [item.Index].Checked = !listView.Items [item.Index].Checked; > }); > } > >@@ -365,7 +339,7 @@ namespace Mono.UIAutomation.Winforms > if (ContainsItem (item) == false) > return; > >- Helper.SynchronizedSet (listView, delegate { >+ listView.InvokeSync(delegate { > // According to http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.topitem.aspx > if (listView.View == SWF.View.LargeIcon > || listView.View == SWF.View.SmallIcon >@@ -407,11 +381,11 @@ namespace Mono.UIAutomation.Winforms > #region Scroll Methods and Properties > > protected override SWF.ScrollBar HorizontalScrollBar { >- get { return Helper.SynchronizedGet<SWF.ListView, SWF.ScrollBar> (listView, c => listView.UIAHScrollBar); } >+ get { return listView.InvokeSync (c => c.UIAHScrollBar); } > } > > protected override SWF.ScrollBar VerticalScrollBar { >- get { return Helper.SynchronizedGet<SWF.ListView, SWF.ScrollBar> (listView, c => listView.UIAVScrollBar); } >+ get { return listView.InvokeSync (c => c.UIAVScrollBar); } > } > > #endregion >@@ -430,7 +404,7 @@ namespace Mono.UIAutomation.Winforms > public SWF.ListViewGroup GetDefaultGroup () > { > if (listViewNullGroup == null) >- listViewNullGroup = Helper.SynchronizedGet<SWF.ListView, SWF.ListViewGroup> (listView, v => listView.UIADefaultListViewGroup); >+ listViewNullGroup = listView.InvokeSync (c => c.UIADefaultListViewGroup); > > return listViewNullGroup; > } >@@ -462,7 +436,7 @@ namespace Mono.UIAutomation.Winforms > > // Using groups > if (showGroups == true >- && Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => listView.View != SWF.View.List) >+ && listView.InvokeSync (c => c.View != SWF.View.List) > && SWF.Application.VisualStylesEnabled == true) { > > SWF.ListViewItem listViewItem = (SWF.ListViewItem) objectItem; >@@ -506,7 +480,7 @@ namespace Mono.UIAutomation.Winforms > { > // Using groups > if (showGroups == true >- && Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => listView.View != SWF.View.List) >+ && listView.InvokeSync (c => c.View != SWF.View.List) > && SWF.Application.VisualStylesEnabled == true) { > > SWF.ListViewItem listViewItem = (SWF.ListViewItem) objectItem; >@@ -535,7 +509,7 @@ namespace Mono.UIAutomation.Winforms > > private void UpdateChildrenStructure (bool forceUpdate) > { >- bool updateView = Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => lastView != listView.View); >+ bool updateView = listView.InvokeSync (c => lastView != c.View); > > if (updateView == true || forceUpdate == true) { > foreach (ListViewGroupProvider groupProvider in groups.Values) { >@@ -556,7 +530,7 @@ namespace Mono.UIAutomation.Winforms > ClearItemsList (); > } > >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => listView.View == SWF.View.Details)) { >+ if (listView.InvokeSync (c => c.View == SWF.View.Details)) { > if (header == null) { > header = new ListViewHeaderProvider (listView); > header.Initialize (); >@@ -565,7 +539,7 @@ namespace Mono.UIAutomation.Winforms > } > > foreach (object objectItem >- in Helper.SynchronizedGet<SWF.ListView, SWF.ListView.ListViewItemCollection> (listView, b => listView.Items)) >+ in listView.InvokeSync (c => c.Items)) > InitializeProviderFrom (objectItem); > } > >@@ -584,18 +558,17 @@ namespace Mono.UIAutomation.Winforms > > UpdateChildrenStructure (false); > >- lastView = Helper.SynchronizedGet<SWF.ListView, SWF.View> (listView, b => listView.View); >+ lastView = listView.InvokeSync (c => c.View); > } > > private void OnUIAShowGroupsChanged (object sender, EventArgs args) > { > bool oldValue = showGroups; >- showGroups = Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => listView.ShowGroups); >+ showGroups = listView.InvokeSync (c => c.ShowGroups); > > //We will have to regenerate children >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- b => listView.ShowGroups != oldValue >- && listView.View != SWF.View.List)) { >+ if (listView.InvokeSync (c => c.ShowGroups != oldValue >+ && c.View != SWF.View.List)) { > UpdateChildrenStructure (true); > if (SWF.Application.VisualStylesEnabled == true) > SetBehavior (GridPatternIdentifiers.Pattern, >@@ -717,23 +690,20 @@ namespace Mono.UIAutomation.Winforms > > private Rect HeaderRectangle { > get { >- return Helper.SynchronizedGet<SWF.ListView, Rect> (listView, >- delegate { >- >+ return listView.InvokeSync (c => { > // Lets Union the Header Bounds >- SD.Rectangle headerRec = listView.UIAGetHeaderBounds (group); >- SD.Rectangle rectangle = listView.Bounds; >+ SD.Rectangle headerRec = c.UIAGetHeaderBounds (group); >+ SD.Rectangle rectangle = c.Bounds; > > headerRec.X += rectangle.X; > headerRec.Y += rectangle.Y; > >- if (listView.FindForm () == listView.Parent) >- headerRec = listView.TopLevelControl.RectangleToScreen (headerRec); >+ if (c.FindForm () == c.Parent) >+ headerRec = c.TopLevelControl.RectangleToScreen (headerRec); > else >- headerRec = listView.Parent.RectangleToScreen (headerRec); >+ headerRec = c.Parent.RectangleToScreen (headerRec); > > return Helper.RectangleToRect (headerRec); >- > }); > } > } >@@ -839,7 +809,7 @@ namespace Mono.UIAutomation.Winforms > { > base.InitializeChildControlStructure (); > >- Helper.SynchronizedSet (listView, delegate { >+ listView.InvokeSync (delegate { > //Event used to update columns in ListItem when View.Details > listView.Columns.UIACollectionChanged += OnUIAColumnsCollectionChanged; > >@@ -857,7 +827,7 @@ namespace Mono.UIAutomation.Winforms > { > base.FinalizeChildControlStructure (); > >- Helper.SynchronizedSet (listView, delegate { >+ listView.InvokeSync (delegate { > //Event used to update columns in ListItem when View.Details > listView.Columns.UIACollectionChanged -= OnUIAColumnsCollectionChanged; > }); >@@ -961,17 +931,17 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AutomationElementIdentifiers.IsEnabledProperty.Id) > return true; > else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id) { >- return Helper.SynchronizedGet<SWF.ListView, Rect> (headerProvider.ListView, delegate { >- int indexOf = headerProvider.ListView.Columns.IndexOf (columnHeader); >+ return headerProvider.ListView.InvokeSync (c => { >+ int indexOf = c.Columns.IndexOf (columnHeader); > Rect headerBounds > = (Rect) headerProvider.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id); > if (headerBounds.IsEmpty) > return headerBounds; > > for (int index = 0; index < indexOf; index++) >- headerBounds.X += headerProvider.ListView.Columns [index].Width; >+ headerBounds.X += c.Columns [index].Width; > >- headerBounds.Width = headerProvider.ListView.Columns [indexOf].Width; >+ headerBounds.Width = c.Columns [indexOf].Width; > > return headerBounds; > }); >@@ -1025,11 +995,11 @@ namespace Mono.UIAutomation.Winforms > public ListViewListItemEditProvider GetEditProviderAtColumn (int column) > { > if (column < 0 >- || column >= Helper.SynchronizedGet<SWF.ListView, int> (listView, c => listView.Columns.Count)) >+ || listView.InvokeSync (c => column >= c.Columns.Count)) > return null; > > ListViewListItemEditProvider editProvider = null; >- providers.TryGetValue (Helper.SynchronizedGet<SWF.ListView, SWF.ColumnHeader> (listView, c => listView.Columns [column]), >+ providers.TryGetValue (listView.InvokeSync (c => c.Columns [column]), > out editProvider); > > return editProvider; >@@ -1041,7 +1011,7 @@ namespace Mono.UIAutomation.Winforms > > protected override object GetProviderPropertyValue (int propertyId) > { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (ListView, b => ListView.View == SWF.View.Details)) { >+ if (ListView.InvokeSync (c => c.View == SWF.View.Details)) { > //According to: http://msdn.microsoft.com/en-us/library/ms742561.aspx > if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id) > return ControlType.DataItem.Id; >@@ -1079,7 +1049,7 @@ namespace Mono.UIAutomation.Winforms > if (lastView == SWF.View.Details) > AddEditChildren (); > >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, b => listView.CheckBoxes == true)) { >+ if (listView.InvokeSync (c => c.CheckBoxes)) { > checkboxProvider = new ListViewListItemCheckBoxProvider (this); > checkboxProvider.Initialize (); > AddChildProvider (checkboxProvider); >@@ -1103,8 +1073,7 @@ namespace Mono.UIAutomation.Winforms > private void AddEditChildren () > { > foreach (SWF.ColumnHeader column >- in Helper.SynchronizedGet<SWF.ListView, SWF.ListView.ColumnHeaderCollection> (listView, >- c => listView.Columns)) { >+ in listView.InvokeSync (c => c.Columns)) { > ListViewListItemEditProvider editProvider > = new ListViewListItemEditProvider (column, this); > editProvider.Initialize (); >@@ -1140,18 +1109,16 @@ namespace Mono.UIAutomation.Winforms > if (lastView == SWF.View.Details) { > providers.Clear (); > OnNavigationChildrenCleared (); >- } else if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- c => listView.View == SWF.View.Details)) >+ } else if (listView.InvokeSync (c => c.View == SWF.View.Details)) > AddEditChildren (); > >- lastView = Helper.SynchronizedGet<SWF.ListView, SWF.View> (listView, c => listView.View); >+ lastView = listView.InvokeSync (c => c.View); > } > > private void OnUIAColumnsCollectionChanged (object sender, > CollectionChangeEventArgs args) > { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (listView, >- c => listView.View != SWF.View.Details)) >+ if (listView.InvokeSync (c => c.View != SWF.View.Details)) > return; > > SWF.ColumnHeader column = (SWF.ColumnHeader) args.Element; >@@ -1258,8 +1225,7 @@ namespace Mono.UIAutomation.Winforms > IValueProvider valueProvider = (IValueProvider) GetBehavior (ValuePatternIdentifiers.Pattern); > return valueProvider.Value; > } else if (propertyId == AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id) >- return IsFirstColumn || Helper.SynchronizedGet<SWF.ListView, bool> (itemProvider.ListView, >- b => itemProvider.ListView.FullRowSelect); >+ return IsFirstColumn || itemProvider.ListView.InvokeSync (c => c.FullRowSelect); > else if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id) { > if (IsFirstColumn) > return itemProvider.GetPropertyValue (propertyId); >@@ -1270,24 +1236,23 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AutomationElementIdentifiers.LabeledByProperty.Id) > return null; > else if (propertyId == AutomationElementIdentifiers.HelpTextProperty.Id) { >- if (Helper.SynchronizedGet<SWF.ListView, bool> (ItemProvider.ListView, >- b => ItemProvider.ListView.Columns.Count == 0 >- || ItemProvider.ListView.Columns [0] == header)) >+ if (itemProvider.ListView.InvokeSync (c => c.Columns.Count == 0 >+ || c.Columns [0] == header)) > return string.Empty; > else > return itemProvider.ListViewItem.ToolTipText; > } else if (propertyId == AutomationElementIdentifiers.BoundingRectangleProperty.Id) { >- return Helper.SynchronizedGet<SWF.ListView, Rect> (itemProvider.ListView, delegate { >- int indexOf = itemProvider.ListView.Columns.IndexOf (header); >+ return itemProvider.ListView.InvokeSync (c => { >+ int indexOf = c.Columns.IndexOf (header); > Rect itemBounds > = (Rect) itemProvider.GetPropertyValue (AutomationElementIdentifiers.BoundingRectangleProperty.Id); > if (itemBounds.IsEmpty) > return itemBounds; > > for (int index = 0; index < indexOf; index++) >- itemBounds.X += itemProvider.ListView.Columns [index].Width; >+ itemBounds.X += c.Columns [index].Width; > >- itemBounds.Width = itemProvider.ListView.Columns [indexOf].Width; >+ itemBounds.Width = c.Columns [indexOf].Width; > > return itemBounds; > }); >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/MenuStripProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/MenuStripProvider.cs >index 5cccf08..56d0965 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/MenuStripProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/MenuStripProvider.cs >@@ -54,8 +54,7 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AEIds.LocalizedControlTypeProperty.Id) > return Catalog.GetString ("menu bar"); > else if (propertyId == AEIds.OrientationProperty.Id) { >- switch (Helper.SynchronizedGet<MenuStrip, Orientation> (menu, >- o => menu.Orientation)) { >+ switch (menu.InvokeSync (o => menu.Orientation)) { > case Orientation.Vertical: > return OrientationType.Vertical; > case Orientation.Horizontal: >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/PanelProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/PanelProvider.cs >index 1b952a1..b3b77e2 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/PanelProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/PanelProvider.cs >@@ -38,7 +38,7 @@ namespace Mono.UIAutomation.Winforms > } > > public override Component Container { >- get { return Control.Parent; } >+ get { return Control.InvokeSync (c => c.Parent); } > } > > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs >index 6fffaf0..643b1ed 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollBehaviorObserver.cs >@@ -58,14 +58,14 @@ namespace Mono.UIAutomation.Winforms > public bool HasHorizontalScrollbar { > get { > return HorizontalScrollBar != null >- && HorizontalScrollBar.Visible && HorizontalScrollBar.Enabled; >+ && HorizontalScrollBar.InvokeSync (c => c.Visible && c.Enabled); > } > } > > public bool HasVerticalScrollbar { > get { > return VerticalScrollBar != null >- && VerticalScrollBar.Visible && VerticalScrollBar.Enabled; >+ && VerticalScrollBar.InvokeSync (c => c.Visible && c.Enabled); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollableControlProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollableControlProvider.cs >index 88aa659..885e38d 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollableControlProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ScrollableControlProvider.cs >@@ -59,18 +59,20 @@ namespace Mono.UIAutomation.Winforms > > #region FragmentRootControlProvider Implementation > public override Component Container { >- get { return Control.Parent; } >+ get { return Control.InvokeSync (c => c.Parent); } > } > > public override void InitializeChildControlStructure () > { > base.InitializeChildControlStructure (); > >- observer = new ScrollBehaviorObserver ( >- this, scrollableControl.hscrollbar, >- scrollableControl.vscrollbar); >- observer.ScrollPatternSupportChanged += OnScrollPatternSupportChanged; >- observer.Initialize (); >+ scrollableControl.InvokeSync (delegate { >+ observer = new ScrollBehaviorObserver ( >+ this, scrollableControl.hscrollbar, >+ scrollableControl.vscrollbar); >+ observer.ScrollPatternSupportChanged += OnScrollPatternSupportChanged; >+ observer.Initialize (); >+ }); > UpdateScrollBehavior (); > } > >@@ -78,7 +80,7 @@ namespace Mono.UIAutomation.Winforms > { > // Override Pane's IsKeyboardFocusableProperty > if (propertyId == AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id) >- return Control.CanFocus && Control.CanSelect; >+ return Control.InvokeSync (c => c.CanFocus && c.CanSelect); > > return base.GetProviderPropertyValue (propertyId); > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SimpleControlProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SimpleControlProvider.cs >index f3e52bd..31596f5 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SimpleControlProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SimpleControlProvider.cs >@@ -76,7 +76,7 @@ namespace Mono.UIAutomation.Winforms > #region Public Properties > > public virtual Component Container { >- get { return control != null ? control.Parent : null; } >+ get { return control != null ? control.InvokeSync (c => c.Parent) : null; } > } > > public Component Component { >@@ -209,12 +209,15 @@ namespace Mono.UIAutomation.Winforms > protected virtual System.Drawing.Rectangle ScreenBounds > { > get { >- if (Control == null || !Control.Visible) >+ if (Control == null) > return System.Drawing.Rectangle.Empty; > >- return Helper.RectToRectangle ( >- Helper.GetControlScreenBounds (Control.Bounds, Control) >- ); >+ return Control.InvokeSync (c => { >+ if (!c.Visible) >+ return System.Drawing.Rectangle.Empty; >+ >+ return Helper.RectToRectangle (Helper.GetControlScreenBounds (c.Bounds, c)); >+ }); > } > } > >@@ -281,7 +284,7 @@ namespace Mono.UIAutomation.Winforms > if (Control == null) > return null; > else if (propertyId == AutomationElementIdentifiers.IsEnabledProperty.Id) >- return Control.Enabled; >+ return Control.InvokeSync (c => c.Enabled); > else if (propertyId == AutomationElementIdentifiers.NameProperty.Id) { > if (!string.IsNullOrEmpty (Control.AccessibleName)) > return Control.AccessibleName; >@@ -296,7 +299,7 @@ namespace Mono.UIAutomation.Winforms > if (controlType == ControlType.Edit.Id || controlType == ControlType.Document.Id) > return string.Empty; > else >- return Helper.StripAmpersands (Control.Text); >+ return Helper.StripAmpersands (Control.InvokeSync (c => c.Text)); > } else > return label.GetPropertyValue (AutomationElementIdentifiers.NameProperty.Id); > } else if (propertyId == AutomationElementIdentifiers.LabeledByProperty.Id) { >@@ -326,9 +329,9 @@ namespace Mono.UIAutomation.Winforms > return closestLabel; > > } else if (propertyId == AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id) >- return Control.CanFocus && Control.CanSelect; >+ return Control.InvokeSync (c => c.CanFocus && c.CanSelect); > else if (propertyId == AutomationElementIdentifiers.HasKeyboardFocusProperty.Id) >- return Control.Focused; >+ return Control.InvokeSync (c => c.Focused); > else if (propertyId == AutomationElementIdentifiers.ClickablePointProperty.Id) > return Helper.GetClickablePoint (this); > else if (propertyId == AutomationElementIdentifiers.HelpTextProperty.Id) { >@@ -337,11 +340,12 @@ namespace Mono.UIAutomation.Winforms > else > return ToolTip.GetToolTip (Control); > } else if (propertyId == AutomationElementIdentifiers.AccessKeyProperty.Id) { >- if (!Control.Text.Contains ("&")) >+ string text = Control.InvokeSync (c => c.Text); >+ if (!text.Contains ("&")) > return null; > else { >- int index = Control.Text.LastIndexOf ('&') + 1; >- return "Alt+" + Control.Text.Substring (index, 1); >+ int index = text.LastIndexOf ('&') + 1; >+ return "Alt+" + text.Substring (index, 1); > } > } else > return null; >@@ -390,10 +394,10 @@ namespace Mono.UIAutomation.Winforms > public virtual IRawElementProviderSimple HostRawElementProvider { > get { > // TODO: Address for Components (*Strip*) >- if (Control == null || Control.TopLevelControl == null) >+ if (Control == null || Control.InvokeSync (c => c.TopLevelControl == null)) > return null; > else >- return AutomationInteropProvider.HostProviderFromHandle (Control.TopLevelControl.Handle); >+ return AutomationInteropProvider.HostProviderFromHandle (Control.InvokeSync (c => c.TopLevelControl.Handle)); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SplitContainerProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SplitContainerProvider.cs >index 6967bb9..5f17ad5 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SplitContainerProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/SplitContainerProvider.cs >@@ -95,9 +95,12 @@ namespace Mono.UIAutomation.Winforms > return ControlType.Pane.Id; > else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id) > return Catalog.GetString ("pane"); >- else if (propertyId == AutomationElementIdentifiers.OrientationProperty.Id) >- return ((SplitContainer)Control).Orientation == Orientation.Vertical? OrientationType.Vertical: OrientationType.Horizontal; >- else >+ else if (propertyId == AutomationElementIdentifiers.OrientationProperty.Id) { >+ if (((SplitContainer)Control).InvokeSync (c => c.Orientation) == Orientation.Vertical) >+ return OrientationType.Vertical; >+ else >+ return OrientationType.Horizontal; >+ } else > return base.GetProviderPropertyValue (propertyId); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/StatusBarProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/StatusBarProvider.cs >index e6c1f91..2bfe548 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/StatusBarProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/StatusBarProvider.cs >@@ -112,19 +112,21 @@ namespace Mono.UIAutomation.Winforms > > public StatusBarPanelProvider GetPanelProvider (int index) > { >- StatusBarPanelProvider panel = null; >- >- if (index < 0 || index >= statusBar.Panels.Count) >- return null; >- else if (index >= panels.Count) { >- for (int loop = panels.Count - 1; loop < index; ++loop) { >- panel = new StatusBarPanelProvider (statusBar.Panels [index]); >- panels.Add (panel); >- panel.Initialize (); >+ return statusBar.InvokeSync (p => { >+ StatusBarPanelProvider panel = null; >+ >+ if (index < 0 || index >= p.Panels.Count) >+ return null; >+ else if (index >= panels.Count) { >+ for (int loop = panels.Count - 1; loop < index; ++loop) { >+ panel = new StatusBarPanelProvider (p.Panels [index]); >+ panels.Add (panel); >+ panel.Initialize (); >+ } > } >- } >+ return panels [index]; >+ }); > >- return panels [index]; > } > > public StatusBarPanelProvider RemovePanelAt (int index) >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabControlProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabControlProvider.cs >index d9451e6..b04d52e 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabControlProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabControlProvider.cs >@@ -17,7 +17,7 @@ > // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > // >-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) >+// Copyright (c) 2008,2009 Novell, Inc. (http://www.novell.com) > // > // Authors: > // Brad Taylor <brad@getcoded.net> >@@ -66,9 +66,7 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AEIds.LocalizedControlTypeProperty.Id) > return Catalog.GetString ("tab"); > else if (propertyId == AEIds.OrientationProperty.Id) { >- TabAlignment align = Helper.SynchronizedGet<TabControl, TabAlignment> ( >- control, c => c.Alignment >- ); >+ TabAlignment align = control.InvokeSync (c => c.Alignment); > return (align == TabAlignment.Top || align == TabAlignment.Bottom) > ? Orientation.Horizontal : Orientation.Vertical; > } >@@ -87,18 +85,12 @@ namespace Mono.UIAutomation.Winforms > #endregion > > internal bool HasSelection { >- get { >- return Helper.SynchronizedGet<TabControl, bool> ( >- control, c => c.SelectedIndex > -1 >- ); >- } >+ get { return control.InvokeSync (c => c.SelectedIndex > -1); } > } > > internal TabPageProvider GetSelectedTab () > { >- TabPage page = Helper.SynchronizedGet<TabControl, TabPage> ( >- control, c => c.SelectedTab >- ); >+ TabPage page = control.InvokeSync (c => c.SelectedTab); > > if (page == null) > return null; >@@ -108,16 +100,14 @@ namespace Mono.UIAutomation.Winforms > > internal void SelectItem (TabPageProvider tabPage) > { >- Helper.SynchronizedSet (control, delegate { >+ control.InvokeSync (delegate { > control.SelectedTab = (TabPage) tabPage.Control; > }); > } > > internal bool IsItemSelected (TabPageProvider tabPage) > { >- return Helper.SynchronizedGet<TabControl, bool> ( >- control, c => c.SelectedTab == (TabPage) tabPage.Control >- ); >+ return control.InvokeSync (c => c.SelectedTab == (TabPage) tabPage.Control); > } > > #region Private Fields >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabPageProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabPageProvider.cs >index 0513408..b1822b3 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabPageProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TabPageProvider.cs >@@ -17,7 +17,7 @@ > // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > // >-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) >+// Copyright (c) 2008,2009 Novell, Inc. (http://www.novell.com) > // > // Authors: > // Brad Taylor <brad@getcoded.net> >@@ -56,8 +56,7 @@ namespace Mono.UIAutomation.Winforms > // want this control's visiblity managed by the > // TabControl, as tab pages are on-screen even > // if they report Visible = false. >- return Helper.SynchronizedGet<Control, System.Windows.Rect> (Control, >- v => Helper.RectangleToRect ( >+ return Control.InvokeSync (v => Helper.RectangleToRect ( > v.Parent.RectangleToScreen (tabPage.TabBounds))); > } > >@@ -71,7 +70,7 @@ namespace Mono.UIAutomation.Winforms > // seems to keep a TabPages' children visible even if > // the TabPage isn't. This is to model Vista's > // behavior. >- return Helper.SynchronizedGet<Control, bool> (Control, c => c.Visible); >+ return Control.InvokeSync (c => c.Visible); > } > > internal TabControlProvider TabControlProvider { >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TextBoxProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TextBoxProvider.cs >index 71abb8d..003c85c 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TextBoxProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TextBoxProvider.cs >@@ -85,9 +85,9 @@ namespace Mono.UIAutomation.Winforms > protected override object GetProviderPropertyValue (int propertyId) > { > if (propertyId == AutomationElementIdentifiers.ControlTypeProperty.Id) >- return textboxbase.Multiline == true ? ControlType.Document.Id : ControlType.Edit.Id; >+ return textboxbase.InvokeSync (c => c.Multiline) ? ControlType.Document.Id : ControlType.Edit.Id; > else if (propertyId == AutomationElementIdentifiers.LocalizedControlTypeProperty.Id) >- return textboxbase.Multiline == true ? Catalog.GetString ("document") >+ return textboxbase.InvokeSync (c => c.Multiline) ? Catalog.GetString ("document") > : Catalog.GetString ("edit"); > else > return base.GetProviderPropertyValue (propertyId); >@@ -159,19 +159,21 @@ namespace Mono.UIAutomation.Winforms > > internal int MaxLength { > get { >- if (textboxbase is TextBox) { >- return ((TextBox) textboxbase).MaxLength; >- } else if (textboxbase is RichTextBox) { >- return ((RichTextBox) textboxbase).MaxLength; >- } else if (textboxbase is MaskedTextBox) { >- // Length of the mask, removing mask modifiers >- MaskedTextBox mtb = (MaskedTextBox) textboxbase; >- if (mtb.MaskedTextProvider != null) >- return mtb.MaskedTextProvider.Length; >- else >- return mtb.Mask.Length; >- } >- return 0; >+ return textboxbase.InvokeSync (c => { >+ if (textboxbase is TextBox) { >+ return ((TextBox) c).MaxLength; >+ } else if (textboxbase is RichTextBox) { >+ return ((RichTextBox) c).MaxLength; >+ } else if (textboxbase is MaskedTextBox) { >+ // Length of the mask, removing mask modifiers >+ MaskedTextBox mtb = (MaskedTextBox) c; >+ if (mtb.MaskedTextProvider != null) >+ return mtb.MaskedTextProvider.Length; >+ else >+ return mtb.Mask.Length; >+ } >+ return 0; >+ }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolBarProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolBarProvider.cs >index 35f9c9e..96a9359 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolBarProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolBarProvider.cs >@@ -107,21 +107,25 @@ namespace Mono.UIAutomation.Winforms > public ToolBarButtonProvider RemoveButtonAt (int index) > { > ToolBarButtonProvider button = null; >- >- if (index < toolBar.Buttons.Count) { >- button = (ToolBarButtonProvider) >- ProviderFactory.GetProvider (toolBar.Buttons [index]); >- ProviderFactory.ReleaseProvider (toolBar.Buttons [index]); >- } >- >- return button; >+ >+ return toolBar.InvokeSync (t => { >+ if (index < t.Buttons.Count) { >+ button = (ToolBarButtonProvider) >+ ProviderFactory.GetProvider (t.Buttons [index]); >+ ProviderFactory.ReleaseProvider (t.Buttons [index]); >+ } >+ >+ return button; >+ }); > } > > public void ClearButtonsCollection () > { >- while (toolBar.Buttons.Count > 0) { >- RemoveButtonAt (toolBar.Buttons.Count - 1); >- } >+ toolBar.InvokeSync (delegate { >+ while (toolBar.Buttons.Count > 0) { >+ RemoveButtonAt (toolBar.Buttons.Count - 1); >+ } >+ }); > } > > #endregion >@@ -134,7 +138,7 @@ namespace Mono.UIAutomation.Winforms > { > if (e.Action == CollectionChangeAction.Add) { > ToolBarButtonProvider button = (ToolBarButtonProvider) >- ProviderFactory.GetProvider (toolBar.Buttons [(int) e.Element]); >+ ProviderFactory.GetProvider (toolBar.InvokeSync (c => c.Buttons [(int) e.Element])); > AddChildProvider (button); > } else if (e.Action == CollectionChangeAction.Remove) { > ToolBarButtonProvider button = RemoveButtonAt ((int) e.Element); >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripButtonProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripButtonProvider.cs >index 0ab9349..32df626 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripButtonProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripButtonProvider.cs >@@ -55,9 +55,7 @@ namespace Mono.UIAutomation.Winforms > > protected override object GetProviderPropertyValue (int propertyId) > { >- bool checkOnClick = Helper.SynchronizedGet<ToolStrip, bool> ( >- Owner, t => button.CheckOnClick >- ); >+ bool checkOnClick = Owner.InvokeSync (t => button.CheckOnClick); > > if (propertyId == AEIds.ControlTypeProperty.Id) > return checkOnClick ? ControlType.CheckBox.Id : ControlType.Button.Id; >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripItemProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripItemProvider.cs >index dc7dd1c..0f36221 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripItemProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripItemProvider.cs >@@ -107,7 +107,10 @@ namespace Mono.UIAutomation.Winforms > > public override void SetFocus () > { >- item.Select (); >+ if (item.Owner != null) >+ item.Owner.InvokeSync (delegate { item.Select (); }); >+ else >+ item.Select (); > } > > } >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripProvider.cs >index 04a3060..d266f12 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolStripProvider.cs >@@ -59,7 +59,7 @@ namespace Mono.UIAutomation.Winforms > else if (propertyId == AEIds.LabeledByProperty.Id) > return null; > else if (propertyId == AEIds.NameProperty.Id) >- return Helper.StripAmpersands (strip.Text); >+ return Helper.StripAmpersands (strip.InvokeSync (s => s.Text)); > else if (propertyId == AEIds.IsContentElementProperty.Id) > return true; > else >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolTipBaseProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolTipBaseProvider.cs >index b0b8ac8..db27c5b 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolTipBaseProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/ToolTipBaseProvider.cs >@@ -104,7 +104,7 @@ namespace Mono.UIAutomation.Winforms > if (AutomationInteropProvider.ClientsAreListening == true) { > message = GetTextFromControl (control); > >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > > //TODO: We need deeper tests in Vista because MS is generating both events > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildAdded, >@@ -116,7 +116,7 @@ namespace Mono.UIAutomation.Winforms > this, > eventArgs); > >- }); >+// }); > } > } > >@@ -125,7 +125,7 @@ namespace Mono.UIAutomation.Winforms > if (AutomationInteropProvider.ClientsAreListening == true) { > message = GetTextFromControl (control); > >- Helper.DelegateQueue.Get ().Enqueue (delegate { >+// Helper.DelegateQueue.Get ().Enqueue (delegate { > > //TODO: We need deeper tests in Vista because MS is generating both events > Helper.RaiseStructureChangedEvent (StructureChangeType.ChildRemoved, >@@ -136,7 +136,7 @@ namespace Mono.UIAutomation.Winforms > AutomationInteropProvider.RaiseAutomationEvent (AutomationElementIdentifiers.ToolTipClosedEvent, > this, > eventArgs); >- }); >+// }); > } > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TrackBarProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TrackBarProvider.cs >index 26716f9..697adf9 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TrackBarProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TrackBarProvider.cs >@@ -84,10 +84,12 @@ namespace Mono.UIAutomation.Winforms > return Catalog.GetString ("slider"); > else if (propertyId == AutomationElementIdentifiers.IsContentElementProperty.Id) > return true; >- else if (propertyId == AutomationElementIdentifiers.OrientationProperty.Id) >- return trackBar.Orientation == Orientation.Horizontal >- ? OrientationType.Horizontal : OrientationType.Vertical; >- else >+ else if (propertyId == AutomationElementIdentifiers.OrientationProperty.Id) { >+ if (trackBar.InvokeSync (c => c.Orientation == Orientation.Horizontal)) >+ return OrientationType.Horizontal; >+ else >+ return OrientationType.Vertical; >+ } else > return base.GetProviderPropertyValue (propertyId); > } > >diff --git a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TreeViewProvider.cs b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TreeViewProvider.cs >index bec3118..28d9b11 100644 >--- a/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TreeViewProvider.cs >+++ b/UIAutomationWinforms/UIAutomationWinforms/Mono.UIAutomation.Winforms/TreeViewProvider.cs >@@ -17,7 +17,7 @@ > // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION > // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. > // >-// Copyright (c) 2008 Novell, Inc. (http://www.novell.com) >+// Copyright (c) 2008,2009 Novell, Inc. (http://www.novell.com) > // > // Authors: > // Sandy Armstrong <sanfordarmstrong@gmail.com> >diff --git a/UIAutomationWinforms/UIAutomationWinformsTests/Makefile.am b/UIAutomationWinforms/UIAutomationWinformsTests/Makefile.am >index cf86627..b4ecafe 100644 >--- a/UIAutomationWinforms/UIAutomationWinformsTests/Makefile.am >+++ b/UIAutomationWinforms/UIAutomationWinformsTests/Makefile.am >@@ -66,6 +66,7 @@ FILES = \ > DateTimePickerProviderTest.cs \ > DomainUpDownProviderTest.cs \ > ErrorProviderTest.cs \ >+ FormProviderTest.cs \ > GroupBoxProviderTest.cs \ > HelpProviderTest.cs \ > LabelProviderTest.cs \ >diff --git a/UIAutomationWinforms/UIAutomationWinformsTests/UIAutomationWinformsTests.mdp b/UIAutomationWinforms/UIAutomationWinformsTests/UIAutomationWinformsTests.mdp >index b111808..5ccd794 100644 >--- a/UIAutomationWinforms/UIAutomationWinformsTests/UIAutomationWinformsTests.mdp >+++ b/UIAutomationWinforms/UIAutomationWinformsTests/UIAutomationWinformsTests.mdp >@@ -66,7 +66,7 @@ > <File name="DateTimePickerProviderTest.cs" subtype="Code" buildaction="Compile" /> > <File name="ToolStripButtonProviderTest.cs" subtype="Code" buildaction="Compile" /> > <File name="PopupButtonPanelTest.cs" subtype="Code" buildaction="Compile" /> >- <File name="FormProviderTest.cs" subtype="Code" buildaction="Nothing" /> >+ <File name="FormProviderTest.cs" subtype="Code" buildaction="Compile" /> > <File name="MainMenuProviderTest.cs" subtype="Code" buildaction="Compile" /> > <File name="MenuItemProviderTest.cs" subtype="Code" buildaction="Compile" /> > <File name="DataGridProviderTest.cs" subtype="Code" buildaction="Compile" />
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 494034
:
285248
|
297972
|
304144
|
304178
|
304488
|
304496
|
308579