internal bool GetButtonVisibleInternal(ButtonToGet button) { GUI.m_APE.AddFirstMessageFindByHandle(DataStores.Store0, Identity.ParentHandle, Identity.Handle); GUI.m_APE.AddQueryMessageReflect(DataStores.Store0, DataStores.Store1, "LayoutSystem", MemberTypes.Property); switch (button) { case ButtonToGet.Close: GUI.m_APE.AddQueryMessageReflect(DataStores.Store1, DataStores.Store2, "CloseButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store2, DataStores.Store4, "visible", MemberTypes.Field); break; case ButtonToGet.Window: GUI.m_APE.AddQueryMessageReflect(DataStores.Store1, DataStores.Store2, "WindowButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store2, DataStores.Store4, "visible", MemberTypes.Field); break; case ButtonToGet.Pin: GUI.m_APE.AddQueryMessageReflect(DataStores.Store1, DataStores.Store2, "PinButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store2, DataStores.Store4, "visible", MemberTypes.Field); break; default: throw GUI.ApeException("Unsupported button: " + button.ToString()); } GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store4); GUI.m_APE.SendMessages(EventSet.APE); GUI.m_APE.WaitForMessages(EventSet.APE); //Get the value(s) returned MUST be done straight after the WaitForMessages call bool visible = GUI.m_APE.GetValueFromMessage(); return(visible); }
internal Rectangle GetButtonBounds(int dockControlIndex, ButtonToGet button) { Rectangle buttonBounds = new Rectangle(); GUI.m_APE.AddFirstMessageFindByHandle(DataStores.Store0, Identity.ParentHandle, Identity.Handle); GUI.m_APE.AddQueryMessageReflect(DataStores.Store0, DataStores.Store1, "Manager", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store1, DataStores.Store2, "GetDockControls", MemberTypes.Method); GUI.m_APE.AddQueryMessageReflect(DataStores.Store2, DataStores.Store3, "GetValue", MemberTypes.Method, new Parameter(GUI.m_APE, dockControlIndex)); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "LayoutSystem", MemberTypes.Property); switch (button) { case ButtonToGet.ScrollLeft: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store4, "LeftScrollButtonBounds", MemberTypes.Property); break; case ButtonToGet.ScrollRight: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store4, "RightScrollButtonBounds", MemberTypes.Property); break; case ButtonToGet.Menu: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "MenuButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "bounds", MemberTypes.Field); break; case ButtonToGet.Close: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "CloseButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "bounds", MemberTypes.Field); break; case ButtonToGet.Window: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "WindowButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "bounds", MemberTypes.Field); break; case ButtonToGet.Pin: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "PinButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "bounds", MemberTypes.Field); break; default: throw GUI.ApeException("Unsupported button: " + button.ToString()); } GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store5, "X", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store6, "Y", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store7, "Width", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store8, "Height", MemberTypes.Property); GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store5); GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store6); GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store7); GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store8); GUI.m_APE.SendMessages(EventSet.APE); GUI.m_APE.WaitForMessages(EventSet.APE); //Get the value(s) returned MUST be done straight after the WaitForMessages call buttonBounds.X = GUI.m_APE.GetValueFromMessage(); buttonBounds.Y = GUI.m_APE.GetValueFromMessage(); buttonBounds.Width = GUI.m_APE.GetValueFromMessage(); buttonBounds.Height = GUI.m_APE.GetValueFromMessage(); return(buttonBounds); }
internal bool GetButtonVisible(int dockControlIndex, ButtonToGet button) { GUI.m_APE.AddFirstMessageFindByHandle(DataStores.Store0, Identity.ParentHandle, Identity.Handle); GUI.m_APE.AddQueryMessageReflect(DataStores.Store0, DataStores.Store1, "Manager", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store1, DataStores.Store2, "GetDockControls", MemberTypes.Method); GUI.m_APE.AddQueryMessageReflect(DataStores.Store2, DataStores.Store3, "GetValue", MemberTypes.Method, new Parameter(GUI.m_APE, dockControlIndex)); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "LayoutSystem", MemberTypes.Property); switch (button) { case ButtonToGet.ScrollLeft: case ButtonToGet.ScrollRight: if (this is GUIDocumentContainer) { return(true); } else { return(false); } case ButtonToGet.Menu: if (!(this is GUIDocumentContainer)) { return(false); } GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "MenuButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "visible", MemberTypes.Field); break; case ButtonToGet.Close: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "CloseButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "visible", MemberTypes.Field); break; case ButtonToGet.Window: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "WindowButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "visible", MemberTypes.Field); break; case ButtonToGet.Pin: GUI.m_APE.AddQueryMessageReflect(DataStores.Store4, DataStores.Store3, "PinButton", MemberTypes.Property); GUI.m_APE.AddQueryMessageReflect(DataStores.Store3, DataStores.Store4, "visible", MemberTypes.Field); break; default: throw GUI.ApeException("Unsupported button: " + button.ToString()); } GUI.m_APE.AddRetrieveMessageGetValue(DataStores.Store4); GUI.m_APE.SendMessages(EventSet.APE); GUI.m_APE.WaitForMessages(EventSet.APE); //Get the value(s) returned MUST be done straight after the WaitForMessages call bool visible = GUI.m_APE.GetValueFromMessage(); return(visible); }
internal void ClickButtonInternal(int dockControlIndex, ButtonToGet button) { Rectangle buttonBounds = GetButtonBounds(dockControlIndex, button); if (buttonBounds.Width == 0 || buttonBounds.Height == 0) { throw GUI.ApeException("Failed to find the " + Description + " " + button.ToString().ToLower() + " button"); } int x = buttonBounds.Left + (buttonBounds.Width / 2); int y = buttonBounds.Top + (buttonBounds.Height / 2); // Move the mouse then sleep for a bit before clicking base.MoveTo(x, y); Thread.Sleep(50); base.SingleClickInternal(x, y, MouseButton.Left, MouseKeyModifier.None); }