public TabPages getTabPages(IUIItem container)
        {
            Tab      containingTab = (Tab)container;
            TabPages tabPages      = containingTab.Pages;

            return(tabPages);
        }
Esempio n. 2
0
        public void IsElementPresent()
        {
            bool isVisible = false;

            IUIItem[] uIItems = Window.GetMultiple(SearchCriteria);
            if (uIItems.Length > 0)
            {
                foreach (var item in uIItems)
                {
                    if (item.Visible)
                    {
                        UiItem    = item;
                        isVisible = true;
                        LoggerUtil.Log.Info($"Element {UiItem.Name} is visible");
                        break;
                    }
                    LoggerUtil.Log.Error($"Element {UiItem.Name} is not visible");
                }
            }
            else
            {
                LoggerUtil.Log.Error("No elements matching search criteria found.");
            }

            Assert.True(isVisible, "No elements matching search criteria found.");
        }
    public ItemIconPickUpImplementor CreateIIPUImplementor(int transferableQuantity, int itemQuantity, int pickUpStepQuantity, out IItemIcon ii, out IItemIconTransactionManager iiTAM, out IPickUpSystemUIElementFactory uieFactory)
    {
        IItemIcon thisII = Substitute.For <IItemIcon>();

        thisII.GetUIImage().Returns(Substitute.For <IUIImage>());
        IItemTemplate itemTemp = Substitute.For <IItemTemplate>();

        itemTemp.GetPickUpStepQuantity().Returns(pickUpStepQuantity);
        // thisII.GetItemTemplate().Returns(itemTemp);
        IUIItem item = Substitute.For <IUIItem>();

        item.GetItemTemplate().Returns(itemTemp);
        thisII.GetUIItem().Returns(item);
        thisII.GetTransferableQuantity().Returns(transferableQuantity);
        thisII.GetItemQuantity().Returns(itemQuantity);
        thisII.GetIconGroup().Returns(Substitute.For <IIconGroup>());
        IItemIconTransactionManager   thisIITAM      = Substitute.For <IItemIconTransactionManager>();
        IPickUpSystemUIElementFactory thisUIEFactory = Substitute.For <IPickUpSystemUIElementFactory>();
        ItemIconPickUpImplementor     implementor    = new ItemIconPickUpImplementor(thisIITAM, thisUIEFactory);

        implementor.SetItemIcon(thisII);
        ii         = thisII;
        iiTAM      = thisIITAM;
        uieFactory = thisUIEFactory;
        return(implementor);
    }
Esempio n. 4
0
    public TestItemIcon CreateTestItemIcon(out IItemIconConstArg arg)
    {
        IItemIconConstArg thisArg = Substitute.For <IItemIconConstArg>();
        IUIManager        uim     = Substitute.For <IUIManager>();

        thisArg.uim.Returns(uim);
        IItemIconUIAdaptor iiUIA = Substitute.For <IItemIconUIAdaptor>();

        thisArg.uia.Returns(iiUIA);
        IItemIconImage itemIconImage = Substitute.For <IItemIconImage>();

        thisArg.image.Returns(itemIconImage);
        IItemIconTransactionManager iiTAM = Substitute.For <IItemIconTransactionManager>();

        thisArg.iiTAM.Returns(iiTAM);
        IUIItem item = Substitute.For <IUIItem>();

        thisArg.item.Returns(item);
        IItemIconTransactionStateEngine iiTAStateEngine = Substitute.For <IItemIconTransactionStateEngine>();

        thisArg.iiTAStateEngine.Returns(iiTAStateEngine);
        IItemIconEmptinessStateEngine emptinessStateEngine = Substitute.For <IItemIconEmptinessStateEngine>();

        thisArg.emptinessStateEngine.Returns(emptinessStateEngine);
        ITransferabilityHandlerImplementor transferabilityHandlerImplementor = Substitute.For <ITransferabilityHandlerImplementor>();

        thisArg.transferabilityHandlerImplementor.Returns(transferabilityHandlerImplementor);

        TestItemIcon testItemIcon = new TestItemIcon(thisArg);

        arg = thisArg;
        return(testItemIcon);
    }
 private void Dock(IUIItem item)
 {
     //NOTE: Workaround. Can not find dockmanager's context menu
     item.RightClick();
     Mouse.Location = new Point(Mouse.Location.X + 10, Mouse.Location.Y + 10); //First item in the menu
     Mouse.Click();
 }
        private string AddEntity(IUIItem designerSurface)
        {
            designerSurface.RightClickAt(designerSurface.Location);
            var popUpMenu = _visualStudioMainWindow.Popup;
            var menuItem  = popUpMenu.Item("Add New");

            menuItem.Click();
            var newEntity =
                menuItem.SubMenu(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("AddEntityTypeCommand_DesignerText")));

            newEntity.Click();
            var addEntity = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString("NewEntityDialog_Title")),
                InitializeOption.NoCache);

            var entityName =
                addEntity.Get <TextBox>(
                    SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewEntityDialog_EntityNameLabel")));
            var entityNameText = string.Format("Entity_{0}", _nameSuffix++);

            entityName.Text = entityNameText;
            var okButton =
                addEntity.Get <Button>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("OKButton_AccessibleName")));

            okButton.Click();
            Dte.ExecuteCommand("OtherContextMenus.MicrosoftDataEntityDesignContext.AddNew.ScalarProperty");
            return(entityNameText);
        }
        private void AddInheritance(IUIItem designerSurface, string baseEntity, string derivedEntity)
        {
            designerSurface.RightClickAt(designerSurface.Location);
            var popUpMenu = _visualStudioMainWindow.Popup;
            var menuItem  = popUpMenu.Item("Add New");

            menuItem.Click();
            var newInheritance = menuItem.SubMenu(SearchCriteria.ByText("Inheritance..."));

            newInheritance.Click();
            var addInheritance = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_Title")),
                InitializeOption.NoCache);
            var entity1 =
                addInheritance.Get <ComboBox>(
                    SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_SelectBaseEntity")));

            entity1.Item(baseEntity).Select();
            var entity2 =
                addInheritance.Get <ComboBox>(
                    SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_SelectDerivedEntity")));

            entity2.Item(derivedEntity).Select();
            var okButton =
                addInheritance.Get <Button>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("OKButton_AccessibleName")));

            okButton.Click();
        }
Esempio n. 8
0
        public static T GetSibling <T>(this IUIItem childElement, SearchCriteria searchCriteria) where T : IUIItem
        {
            var element         = childElement.GetParent <IUIItem>();
            var parentContainer = new UIItemContainer(element.AutomationElement, element.ActionListener);

            return((T)parentContainer.Get(searchCriteria));
        }
Esempio n. 9
0
        /// <summary>
        /// Implements <see cref="IMouse.DragAndDrop(MouseButton, IUIItem, IUIItem)"/>
        /// </summary>
        public virtual void DragAndDrop(MouseButton mouseButton, IUIItem draggedItem, IUIItem dropItem)
        {
            var startPosition = draggedItem.Bounds.Center();
            var endPosition   = dropItem.Bounds.Center();

            DragAndDrop(mouseButton, draggedItem, startPosition, dropItem, endPosition);
        }
Esempio n. 10
0
 public GridWrapper(Core.UIItems.WindowItems.Window window, IUIItem grid)
 {
     this.grid   = grid;
     this.window = window;
     Assert.IsNotNull(grid);
     Assert.IsNotNull(window);
 }
Esempio n. 11
0
        /// <summary>
        /// reset action after executing
        /// </summary>
        public override void Reset()
        {
            base.Reset();

            Window  = null;
            Control = null;
        }
Esempio n. 12
0
    List <IItemIcon> CreateStubIIsWithNoMatchAndEmptyAt(int size, IEquippableUIItem item, int[] emptyAt)
    {
        List <IItemIcon> result = new List <IItemIcon>();

        for (int i = 0; i < size; i++)
        {
            IEquippableItemIcon tarII = Substitute.For <IEquippableItemIcon>();
            bool contained            = false;
            foreach (int j in emptyAt)
            {
                if (j == i)
                {
                    contained = true;
                }
            }
            if (contained)
            {
                tarII.GetUIItem().Returns((IUIItem)null);
                tarII.IsEmpty().Returns(true);
            }
            else
            {
                IUIItem tarItem = Substitute.For <IUIItem>();
                tarII.GetUIItem().Returns(tarItem);
                tarII.IsEmpty().Returns(false);
            }
            result.Add(tarII);
        }
        return(result);
    }
        private bool FindMatchControls(TreeNode matchedWindowNode)
        {
            matchedControls.Clear();

            if (CurrentInterface == null)
            {
                return(false);
            }

            bool bFound = false;

            if (matchedWindowNode != null)
            {
                Window window = matchedWindowNode.Tag as Window;
                foreach (string name in CurrentInterface.Controls.Keys)
                {
                    IUIItem item = ActionManager.FindControl(window, CurrentInterface.Controls[name]);
                    if (item != null)
                    {
                        matchedControls[name] = item;
                        bFound = true;
                    }
                    else
                    {
                        matchedControls[name] = null;
                    }
                }
            }

            return(bFound);
        }
Esempio n. 14
0
 void Dock(IUIItem item)
 {
     //TODO: Workaround. Can not find dockmanager's context menu. Try to remove as it should have been fixed now.
     item.RightClick();
     Mouse.Location = new Point(Mouse.Location.X + 10, Mouse.Location.Y + 10); //First item in the menu
     Mouse.Click();
 }
        public void ClickOnNewProjectCrashTest()
        {
            Application app = Application.Launch(designer_executable);

            Assert.IsNotNull(app);
            Core.UIItems.WindowItems.Window window = app.GetWindow("Designer");

            //Create new schema
            IUIItem new_project_button = window.Get(SearchCriteria.ByText("New Project"));

            Assert.IsNotNull(new_project_button);
            System.Drawing.Point pt = new System.Drawing.Point(System.Convert.ToInt32(new_project_button.Location.X) + 5, System.Convert.ToInt32(new_project_button.Location.Y) + 5);

            //Do click several times
            window.Mouse.Click(pt);
            System.Threading.Thread.Sleep(1000);

            window.Mouse.Click(pt);
            System.Threading.Thread.Sleep(1000);

            window.Mouse.Click(pt);

            window.Close();

            Assert.IsTrue(window.IsClosed);
            Assert.IsTrue(app.HasExited);
        }
        public IControl Assign(IUIItem item, ControlType controlType, ActionType actionType, string Criteria)
        {
            IControl x = Produce(controlType, actionType, Criteria);

            x.Assign(item);
            return(x);
        }
Esempio n. 17
0
    public static void Close()
    {
        IUIItem i = Stack.Pop();

        i.Close();
        UIManager.MouseModeToggle();
    }
Esempio n. 18
0
        /// <summary>
        /// get an UIA action for the line
        /// </summary>
        /// <param name="actLine">the action line</param>
        /// <returns>the UIA action</returns>
        public override abt.Action getAction(abt.ActionLine actLine)
        {
            Window  targetWindow  = null;
            IUIItem targetControl = null;

            if (!Actions.ContainsKey(actLine.ActionName))
            {
                throw new Exception(abt.Constants.Messages.Error_Executing_NoAction);
            }
            if (actLine.WindowName != null && !Parent.Interfaces.ContainsKey(actLine.WindowName))
            {
                throw new Exception(abt.Constants.Messages.Error_Matching_Window_NoDefinition);
            }

            // search for the target control
            if (actLine.WindowName != null)
            {
                targetWindow = FindWindow(Parent.Interfaces[actLine.WindowName].Properties);
            }
            if (actLine.ControlName != null)
            {
                targetControl = FindControl(targetWindow, Parent.Interfaces[actLine.WindowName].Controls[actLine.ControlName]);
            }

            // prepare the action
            UIAAction action = Actions[actLine.ActionName] as UIAAction;

            action.Window  = targetWindow;
            action.Control = targetControl;
            action.Params  = actLine.Arguments;

            return(action);
        }
Esempio n. 19
0
        /// <summary>
        /// given a criteria, find a control within a window
        /// </summary>
        /// <param name="window">the containing window</param>
        /// <param name="criteria">the criteria to find the control</param>
        /// <returns>the found control. null - if not found</returns>
        public IUIItem FindControl(Window window, Dictionary <string, string> criteria)
        {
            // the "all" condition
            SearchCriteria crit = SearchCriteria.All;

            // for each criteria, AND with a new condition
            foreach (string key in criteria.Keys)
            {
                switch (key.ToLower())
                {
                case Constants.PropertyNames.ControlType:
                    crit = crit.AndControlType(GetTypeByName(criteria[key]));
                    break;

                case Constants.PropertyNames.AutomationId:
                    crit = crit.AndAutomationId(criteria[key]);
                    break;

                case Constants.PropertyNames.Text:
                    crit = crit.AndByText(criteria[key]);
                    break;

                default:
                    return(null);
                }
                ;
            }

            // search for control with 'crit'
            IUIItem item = window.Get(crit, WaitTime);

            // return the found control
            return(item);
        }
        public IEnumerable <UiExecutionEntry> GetExecutions()
        {
            UIItemCollection controls = ContentPanel.Items;
            int promptIndex           = FindPromptIndex(controls, controls.Count - 1);
            int nextPromptIndex       = controls.Count;

            while (promptIndex >= 0)
            {
                CustomUIItem      codeInput         = controls[promptIndex + 1] as CustomUIItem;
                AutomationElement automationElement = codeInput?.AutomationElement;
                var valuePattern = automationElement?.GetSupportedPatterns()?.FirstOrDefault(p => p.ProgrammaticName.Contains("Value"));
                var value        = automationElement?.GetCurrentPattern(valuePattern) as ValuePattern;

                string code   = value?.Current.Value;
                string prompt = (controls[promptIndex] as WPFLabel)?.Text;

                IUIItem[] result = new IUIItem[nextPromptIndex - promptIndex - 2];
                for (int i = promptIndex + 2, k = 0; i < nextPromptIndex; i++, k++)
                {
                    result[k] = controls[i];
                }

                yield return(new UiExecutionEntry()
                {
                    Code = code,
                    Prompt = prompt,
                    Result = result,
                });

                nextPromptIndex = promptIndex;
                promptIndex     = FindPromptIndex(controls, promptIndex - 1);
            }
        }
Esempio n. 21
0
 private void Dock(IUIItem item)
 {
     //NOTE: Workaround. Can not find dockmanager's context menu
     item.RightClick();
     Mouse.Location = new Point(Mouse.Location.X + 10, Mouse.Location.Y + 10); //First item in the menu
     Mouse.Click();
 }
Esempio n. 22
0
    List <IItemIcon> CreateStubEqpIIsWithSameItemAt(int size, IUIItem sourceItem, int[] sameAt)
    {
        List <IItemIcon> result = new List <IItemIcon>();

        for (int i = 0; i < size; i++)
        {
            IEquippableItemIcon tarII   = Substitute.For <IEquippableItemIcon>();
            IUIItem             tarItem = Substitute.For <IUIItem>();
            tarII.GetUIItem().Returns(tarItem);

            bool contained = false;
            foreach (int j in sameAt)
            {
                if (j == i)
                {
                    contained = true;
                }
            }
            if (contained)
            {
                tarItem.IsSameAs(sourceItem).Returns(true);
            }
            else
            {
                tarItem.IsSameAs(sourceItem).Returns(false);
            }

            result.Add(tarII);
        }
        return(result);
    }
Esempio n. 23
0
        public Hyperlink OpenWorkspace(Window gMTWindow, string WorkspaceName)
        {
            win = gMTWindow;
            IUIItem leftPane = win.Get(SearchCriteria.ByAutomationId("workspaceSplitter"));

            return(leftPane.Get <Hyperlink>(SearchCriteria.ByNativeProperty(AutomationElement.NameProperty, WorkspaceName)));
        }
Esempio n. 24
0
        public static T GetParent <T>(this IUIItem thisItem) where T : IUIItem
        {
            var parent = Desktop.Automation.TreeWalkerFactory.GetControlViewWalker().GetParent(thisItem.AutomationElement);
            var uiItem = ItemFactory.Create(parent, thisItem.ActionListener);

            return((T)UIItemProxyFactory.Create(uiItem, uiItem.ActionListener));
        }
Esempio n. 25
0
        public void AddItem(IUIItem item, bool doesIncrement)
        {
            int idAtAdd = GetProspectiveSlotID(item);

            if (thisItemIcons.Count == idAtAdd)
            {
                AddIIAndMutate(item, idAtAdd);
            }
            else
            {
                IItemIcon iiAtID = thisItemIcons[idAtAdd];
                if (iiAtID.IsEmpty())
                {
                    iiAtID.Disemptify(item);
                    iiAtID.SetQuantityInstantly(0);
                    iiAtID.UpdateQuantity(item.GetQuantity(), doesIncrement);
                }
                else
                {
                    if (iiAtID.HasSameItem(item))
                    {
                        iiAtID.IncreaseBy(item.GetQuantity(), doesIncrement);
                    }
                    else
                    {
                        this.AddIIAndMutate(item, idAtAdd);
                    }
                }
            }
        }
Esempio n. 26
0
        public void SetUp(Application app, int windowNumber, ITestCommands commands, string tabName)
        {
            base.SetUp(app, windowNumber);

            IUIItem tab = windowTools.GetIUIItemList <Tab>(window)[0];

            controls.Add(nameof(controlNames.click_clients_button), controlFactory.Assign(windowTools.GetButton(window, nameof(itemNames.Clients)), ControlType.button, ActionType.click));
            controls.Add(nameof(controlNames.click_tabControl_tabPage), controlFactory.Assign(tab, ControlType.tab, ActionType.click, tabName));


            /* TODO: add other buttons
             *
             * Drop Down Button
             * Drop Down Button
             * Toggle Care/Coordination Team
             * Exit
             * Message
             * <done> Clients
             * Providers
             * Organizations
             * Shift Schedules
             * Internal Schedule
             * Import PXML
             * Font
             * Minimize
             * Maximize
             * Close
             */
        }
Esempio n. 27
0
        public void ReceiveSpotTransfer(IItemIcon transferringII)
        {
            IUIItem addedItem  = transferringII.GetUIItem();
            int     destSlotID = GetProspectiveSlotID(addedItem);

            AddIIAndMutate(addedItem, destSlotID);
        }
Esempio n. 28
0
        /// <summary>
        /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
        /// whether they are same application or different. To drop items on desktop use Desktop
        /// class's Drop method. White starts and ends the drag from center of the UIItems.
        /// Some drag and drop operation need to wait for application to process something while item is being dragged.
        /// This can be set but configuring DragStepCount property. This is by default set to 1.
        /// </summary>
        /// <param name="draggedItem"></param>
        /// <param name="dropItem"></param>
        public virtual void DragAndDrop(IUIItem draggedItem, IUIItem dropItem)
        {
            Point startPosition = draggedItem.Bounds.Center();
            Point endPosition   = dropItem.Bounds.Center();

            DragAndDrop(draggedItem, startPosition, dropItem, endPosition);
        }
Esempio n. 29
0
 void Dock(IUIItem item)
 {
     //TODO: Workaround. Can not find dockmanager's context menu. Try to remove as it should have been fixed now.
     item.RightClick();
     Mouse.Location = new Point(Mouse.Location.X + 10, Mouse.Location.Y + 10); //First item in the menu
     Mouse.Click();
 }
        public void GetMultiplePanes()
        {
            IUIItem pane = window.Get(SearchCriteria.ByControlType(ControlType.Pane).AndAutomationId("panelWithText"));

            Assert.AreNotEqual(null, pane);
            IUIItem[] multiple = window.GetMultiple(SearchCriteria.ByControlType(ControlType.Pane).AndAutomationId("panelWithText"));
            Assert.AreNotEqual(0, multiple.Length);
        }
Esempio n. 31
0
        public ToolBoxWrapper(Core.UIItems.WindowItems.Window mainWindow)
        {
            Assert.IsNotNull(mainWindow);
            uiItem = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("_toolBox"));
            Assert.IsNotNull(uiItem);

            this.mainWindow = mainWindow;
        }
Esempio n. 32
0
        public Button OpenTab(Window gMTWindow, string tabName)
        {
            win = gMTWindow;

            IUIItem leftPane = win.Get(SearchCriteria.ByAutomationId("stackStrip"));

            return(leftPane.Get <Button>(SearchCriteria.ByText(tabName)));
        }
Esempio n. 33
0
 /// <summary>
 /// When the dropdown is animating, this can stop White from clicking too soon and not selecting properly
 /// </summary>
 /// <param name="item"></param>
 private static void WaitForBoundsToStabilise(IUIItem item)
 {
     Retry.For(() =>
     {
         var oldBounds = item.Bounds;
         Thread.Sleep(10);
         return oldBounds.Equals(item.Bounds);
     }, TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(10));
 }
Esempio n. 34
0
 public virtual void Intercept(IInvocation invocation)
 {
     if (uiItem == null)
     {
         uiItem = window.Get(searchCriteria);
         if (uiItem == null) throw new UIItemSearchException("Could not find UIItem with, " + searchCriteria);
     }
     try
     {
         invocation.ReturnValue = invocation.Method.Invoke(uiItem, invocation.Arguments);
     }
     catch (Exception e)
     {
         sessionReport.Act();
         throw new WhiteException(string.Format("Error Invoking {0}.{1}", uiItem.GetType().Name, invocation.Method.Name), e.InnerException);
     }
 }
Esempio n. 35
0
 public virtual void Intercept(IInvocation invocation)
 {
     if (uiItem == null)
     {
         uiItem = window.Get(searchCriteria);
         if (uiItem == null) throw new UIItemSearchException("Could not find UIItem with, " + searchCriteria);
     }
     try
     {
         var invoker = DelegateInvoker.CreateInvoker(uiItem, invocation.Method);
         invocation.ReturnValue = invoker.Call(invocation.Arguments);
     }
     catch (Exception)
     {
         sessionReport.Act();
         throw;
     }
 }
 private void CreateTree(IUIItem parent, Element parentElement)
 {
     var types = (from c in parent.GetMultiple(SearchCriteria.All) select c.GetType()).Distinct();
     var items = from c in parent.GetMultiple(SearchCriteria.All) select c;
     foreach (var type in types)
     {
         var elementType = new Element { Text = type.ToString().Split('.').Last() };
         var index = 0;
         IEnumerable<IUIItem> final;
         if (type == typeof(CustomUIItem))
         {
             final = items.Where(n => n.GetType() == type);
         }
         else
         {
             final = parent.GetMultiple(SearchCriteria.ByControlType(type, parent.Framework));
         }
         foreach (var control in final)
         {
             var childElement = new Element
             {
                 Text =
                     "[Index: " + index + "] - [ID: " + control.Id + "] - [Coordinates: " +
                     control.Bounds + "]",
                 Target = control
             };
             elementType.Elements.Add(childElement);
             if (type == typeof(Panel) || type == typeof(CustomUIItem))
             {
                 CreateTree(control, childElement);
             }
             index++;
         }
         parentElement.Elements.Add(elementType);
     }
 }
Esempio n. 37
0
 public virtual void DragAndDrop(IUIItem draggedItem, IUIItem dropItem)
 {
     mouse.DragAndDrop(draggedItem, dropItem);
     ActionPerformed();
 }
Esempio n. 38
0
        private string AddEntity(IUIItem designerSurface)
        {
            designerSurface.RightClickAt(designerSurface.Location);
            var popUpMenu = _visualStudioMainWindow.Popup;
            var menuItem = popUpMenu.Item("Add New");
            menuItem.Click();
            var newEntity =
                menuItem.SubMenu(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("AddEntityTypeCommand_DesignerText")));
            newEntity.Click();
            var addEntity = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString("NewEntityDialog_Title")),
                InitializeOption.NoCache);

            var entityName =
                addEntity.Get<TextBox>(
                    SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewEntityDialog_EntityNameLabel")));
            var entityNameText = string.Format("Entity_{0}", _nameSuffix++);
            entityName.Text = entityNameText;
            var okButton =
                addEntity.Get<Button>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("OKButton_AccessibleName")));
            okButton.Click();
            Dte.ExecuteCommand("OtherContextMenus.MicrosoftDataEntityDesignContext.AddNew.ScalarProperty");
            return entityNameText;
        }
 public static IUIItem Create(IUIItem item, ActionListener actionListener)
 {
     return (IUIItem) DynamicProxyGenerator.Instance.CreateProxy(new CoreInterceptor(item, actionListener), item.GetType());
 }
 public SafeAutomationEventHandler(IUIItem uiItem, UIItemEventListener eventListener, Create createUserEvent)
 {
     this.uiItem = uiItem;
     this.eventListener = eventListener;
     this.createUserEvent = createUserEvent;
 }
Esempio n. 41
0
        private void AddAssociation(IUIItem designerSurface, string entity1, string entity2, AssociationType associationType)
        {
            designerSurface.RightClickAt(designerSurface.Location);
            var popUpMenu = _visualStudioMainWindow.Popup;
            var menuItem = popUpMenu.Item("Add New");
            menuItem.Click();
            var newAssociation = menuItem.SubMenu(SearchCriteria.ByText("Association..."));
            newAssociation.Click();
            var addAssociation = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString("NewAssociationDialog_Title")),
                InitializeOption.NoCache);

            var entity1Combo = addAssociation.Get<ComboBox>(SearchCriteria.ByAutomationId("entity1ComboBox"));
            entity1Combo.Select(entity1);

            var entity2Combo = addAssociation.Get<ComboBox>(SearchCriteria.ByAutomationId("entity2ComboBox"));
            entity2Combo.Select(entity2);

            var multiplicity1ComboBox = addAssociation.Get<ComboBox>(SearchCriteria.ByAutomationId("multiplicity1ComboBox"));
            var multiplicity2ComboBox = addAssociation.Get<ComboBox>(SearchCriteria.ByAutomationId("multiplicity2ComboBox"));
            switch (associationType)
            {
                case AssociationType.OneToOne:
                    multiplicity1ComboBox.Select(0);
                    multiplicity2ComboBox.Select(0);
                    break;
                case AssociationType.OneToMany:
                    multiplicity1ComboBox.Select(0);
                    multiplicity2ComboBox.Select(2);
                    break;
                case AssociationType.ManyToMany:
                    multiplicity1ComboBox.Select(2);
                    multiplicity2ComboBox.Select(2);
                    break;
            }

            var okButton =
                addAssociation.Get<Button>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("OKButton_AccessibleName")));
            okButton.Click();
        }
Esempio n. 42
0
 public ListControlEvent(IUIItem uiItem, string selectedItem)
     : base(uiItem)
 {
     this.selectedItem = selectedItem;
 }
 public virtual string FieldName(IUIItem uiItem)
 {
     return uiItem.Framework.IsManaged ? uiItem.Id : uiItem.Name;
 }
Esempio n. 44
0
        private void ShowGroupControl(TreeNode node, string groupName, IUIItem[] items)
        {
            if (items.Length == 0)
                return;

            treeView.BeginUpdate();
            TreeNode group = new TreeNodeGroup(groupName);
            node.Nodes.Add(group);
            group.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Italic);
            group.ForeColor = Color.Gray;
            foreach (IUIItem item in items)
            {
                string name = item.Name.Trim();
                if (name.Length == 0) name = "{No name}";
                ControlTreeNode itemnode = new ControlTreeNode(name);
                itemnode.Tag = item;

                foreach (string ctrlName in matchedControls.Keys)
                {
                    if (CompareItem(matchedControls[ctrlName], item) == 0)
                    {
                        itemnode.NodeFont = new Font(SystemFonts.DefaultFont, FontStyle.Bold);
                        itemnode.ForeColor = Color.Green;
                        itemnode.Text = itemnode.Text;
                        itemnode.MatchedName = ctrlName;
                    }
                }
                group.Nodes.Add(itemnode);
            }
            treeView.EndUpdate();
        }
Esempio n. 45
0
 /// <summary>
 /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
 /// whether they are same application or different. To drop items on desktop use Desktop 
 /// class's Drop method. White starts and ends the drag from center of the UIItems.
 /// Some drag and drop operation need to wait for application to process something while item is being dragged.
 /// This can be set but configuring DragStepCount property. This is by default set to 1.
 /// </summary>
 /// <param name="draggedItem"></param>
 /// <param name="dropItem"></param>
 public virtual void DragAndDrop(IUIItem draggedItem, IUIItem dropItem)
 {
     Point startPosition = draggedItem.Bounds.Center();
     Point endPosition = dropItem.Bounds.Center();
     DragAndDrop(draggedItem, startPosition, dropItem, endPosition);
 }
Esempio n. 46
0
 private ListViewEvent(IUIItem listView, string action, object[] parameters) : base(listView)
 {
     actionName = action;
     this.parameters = parameters;
 }
Esempio n. 47
0
 public UserEvent(IUIItem uiItem)
 {
     this.uiItem = uiItem;
     timestamp = DateTime.Now;
 }
Esempio n. 48
0
 public ExceptionEvent(IUIItem uiItem, Exception exception)
     : base(uiItem)
 {
     this.exception = exception;
 }
Esempio n. 49
0
        private void AddEnum(IUIItem designerSurface)
        {
            designerSurface.RightClickAt(designerSurface.Location);
            var popUpMenu = _visualStudioMainWindow.Popup;
            var menuItem = popUpMenu.Item("Add New");
            menuItem.Click();
            var newEnum =
                menuItem.SubMenu(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("AddEnumTypeCommand_DesignerText")));
            newEnum.Click();
            var addEnum = _visualStudio.Find(
                x => x.Equals(_resourceHelper.GetEntityDesignResourceString("EnumDialog_NewEnumWindowTitle")),
                InitializeOption.NoCache);
            var enumTypeName = addEnum.Get<TextBox>(SearchCriteria.ByAutomationId("txtEnumTypeName"));
            enumTypeName.SetValue("EnumType" + _nameSuffix);

            var table = addEnum.Get<ListView>(SearchCriteria.ByAutomationId("dgEnumTypeMembers"));

            foreach (var row in table.Rows)
            {
                row.Select();
                row.DoubleClick();
                row.Focus();
            }

            var rowEntry =
                table.Get<UIItem>(
                    SearchCriteria.ByText(
                        "Item: Microsoft.Data.Entity.Design.UI.ViewModels.EnumTypeMemberViewModel, Column Display Index: 0"));
            var rowEntryValuePattern =
                (ValuePattern)
                    rowEntry.AutomationElement.GetCurrentPattern(ValuePattern.Pattern);
            rowEntryValuePattern.SetValue("EnumName" + _nameSuffix++);

            var btnOk = addEnum.Get<Button>(SearchCriteria.ByAutomationId("btnOk"));
            btnOk.Click();
        }
Esempio n. 50
0
 public CoreInterceptor(IUIItem uiItem, ActionListener actionListener)
 {
     coreInterceptContext = new CoreInterceptContext(uiItem, actionListener);
 }
Esempio n. 51
0
 public ComboBoxEvent(IUIItem uiItem, string selectedItem)
     : base(uiItem, selectedItem)
 {
 }
Esempio n. 52
0
 public CoreInterceptContext(IUIItem uiItem, ActionListener actionListener)
 {
     this.uiItem = uiItem;
     this.actionListener = actionListener;
 }
Esempio n. 53
0
 private int CompareItem(IUIItem item1, IUIItem item2)
 {
     if (item1 == null)
         return -1;
     else if (item2 == null)
         return 1;
     else
         return item1.AutomationElement.Current.AutomationId.CompareTo(item2.AutomationElement.Current.AutomationId);
 }
Esempio n. 54
0
 public virtual void DragAndDrop(IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
 {
     mouse.DragAndDrop(draggedItem, startPosition, dropItem, endPosition);
     ActionPerformed();
 }
Esempio n. 55
0
 /// <summary>
 /// Drags the dragged item and drops it on the drop item. This can be used for any two UIItems
 /// whether they are same application or different. To drop items on desktop use Desktop 
 /// class's Drop method. White starts and ends the drag from center of the UIItems.
 /// Some drag and drop operation need to wait for application to process something while item is being dragged.
 /// This can be set but configuring DragStepCount property. This is by default set to 1.
 /// </summary>
 /// <param name="draggedItem"></param>
 /// <param name="startPosition">Start point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 /// <param name="dropItem"></param>
 /// <param name="endPosition">End point of the drag. You can do uiItem.Bounds to get bounds of the UIItem and use RectX extension class in White.Core.UIA namespace to find different points</param>
 public virtual void DragAndDrop(IUIItem draggedItem, Point startPosition, IUIItem dropItem, Point endPosition)
 {
     Location = startPosition;
     HoldForDrag();
     draggedItem.ActionPerformed(Action.WindowMessage);
     var dragStepFraction = (float)(1.0 / CoreAppXmlConfiguration.Instance.DragStepCount);
     WhiteLogger.Instance.Info(CoreAppXmlConfiguration.Instance.DragStepCount + ":" + dragStepFraction);
     for (int i = 1; i <= CoreAppXmlConfiguration.Instance.DragStepCount; i++)
     {
         double newX = startPosition.X + (endPosition.X - startPosition.X) * (dragStepFraction * i);
         double newY = startPosition.Y + (endPosition.Y - startPosition.Y) * (dragStepFraction * i);
         var newPoint = new Point((int)newX, (int)newY);
         Location = newPoint;
         draggedItem.ActionPerformed(Action.WindowMessage);
     }
     LeftUp();
     dropItem.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 56
0
 public UIItemClickEvent(IUIItem uiItem) : base(uiItem) {}
Esempio n. 57
0
 public TextBoxEvent(IUIItem textBox)
     : base(textBox)
 {
 }
Esempio n. 58
0
 private void AddInheritance(IUIItem designerSurface, string baseEntity, string derivedEntity)
 {
     designerSurface.RightClickAt(designerSurface.Location);
     var popUpMenu = _visualStudioMainWindow.Popup;
     var menuItem = popUpMenu.Item("Add New");
     menuItem.Click();
     var newInheritance = menuItem.SubMenu(SearchCriteria.ByText("Inheritance..."));
     newInheritance.Click();
     var addInheritance = _visualStudio.Find(
         x => x.Equals(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_Title")),
         InitializeOption.NoCache);
     var entity1 =
         addInheritance.Get<ComboBox>(
             SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_SelectBaseEntity")));
     entity1.Item(baseEntity).Select();
     var entity2 =
         addInheritance.Get<ComboBox>(
             SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("NewInheritanceDialog_SelectDerivedEntity")));
     entity2.Item(derivedEntity).Select();
     var okButton =
         addInheritance.Get<Button>(SearchCriteria.ByText(_resourceHelper.GetEntityDesignResourceString("OKButton_AccessibleName")));
     okButton.Click();
 }
 public virtual bool Reject(IUIItem uiItem)
 {
     return uiItem is Window || (generatorOptions.IgnoreLabels && uiItem is Label);
 }
Esempio n. 60
0
        private TreeNode CreateNode(IUIItem item)
        {
            Check.NotNull(item, "item"); //NOXLATE
            var node = new TreeNode();
            switch (item.Function)
            {
                case UiItemFunctionType.Flyout:
                    {
                        node.ImageIndex = node.SelectedImageIndex = IDX_MENU;
                        node.Text = ((IFlyoutItem)item).Label;
                        node.Tag = item;

                        item.PropertyChanged += (s, evt) =>
                        {
                            if (evt.PropertyName == "Label") //NOXLATE
                            {
                                node.Text = ((IFlyoutItem)item).Label;
                                OnResourceChanged();
                            }
                        };
                    }
                    break;
                case UiItemFunctionType.Separator:
                    {
                        node.ImageIndex = node.SelectedImageIndex = IDX_SEPARATOR;
                        node.Text = Strings.Separator;
                        node.Tag = item;
                    }
                    break;
                case UiItemFunctionType.Widget:
                    {
                        node.ImageIndex = node.SelectedImageIndex = IDX_WIDGET;
                        node.Text = ((IWidgetItem)item).Widget;
                        node.Tag = item;

                        item.PropertyChanged += (s, evt) =>
                        {
                            if (evt.PropertyName == "Widget") //NOXLATE
                            {
                                node.Text = ((IWidgetItem)item).Widget;
                                OnResourceChanged();
                            }
                        };
                    }
                    break;
            }
            return node;
        }