示例#1
0
        public virtual PageObjectWrapper <T> SetText(string newText, bool clearElement = false)
        {
            if (SelectedElement == null)
            {
                return(this);
            }

            var validator = PageBase.GetDefaultValidator();

            if (validator == null)
            {
                if (clearElement)
                {
                    ClearElement();
                }

                SelectedElement.SendKeys(newText);
            }
            else if (validator != null && !validator.ExceptionFields.Any(selector => selector.Equals(LastSelector)))
            {
                if (clearElement)
                {
                    ClearElement();
                }

                SelectedElement.SendKeys(newText);
            }

            return(this);
        }
示例#2
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
        {
            AssociativeNode node;

            if (SelectedElement == null || !SelectedElement.Any())
            {
                node = AstFactory.BuildNullNode();
            }
            else
            {
                var els = selectedUniqueIds;

                var newInputs = els.Select(el =>
                                           AstFactory.BuildFunctionCall(
                                               new Func <string, bool, Element>(ElementSelector.ByUniqueId),
                                               new List <AssociativeNode>
                {
                    AstFactory.BuildStringNode(el),
                    AstFactory.BuildBooleanNode(true)
                }
                                               )).ToList();

                node = AstFactory.BuildExprList(newInputs);
            }

            return(new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) });
        }
示例#3
0
        public void RefreshPropertiesAndLocators()
        {
            if (SelectedElement != null)
            {
                if (SelectedElement.Properties == null || SelectedElement.Properties.Count == 0)
                {
                    SelectedElement.Properties = SelectedElement.GetElementProperties();
                }

                if (SelectedElement.Properties == null || SelectedElement.Properties.Count == 0)
                {
                    SelectedElement.Properties = ((IWindowExplorerTreeItem)mCurrentControlTreeViewItem).GetElementProperties();
                }

                if (SelectedElement.Locators == null || SelectedElement.Locators.Count == 0)
                {
                    SelectedElement.Locators = SelectedElement.GetElementLocators();
                }

                xPropertiesGrid.DataSourceList = SelectedElement.Properties;
                xLocatorsGrid.DataSourceList   = SelectedElement.Locators;

                Dispatcher.Invoke(() =>
                {
                    xPropertiesTextBlock.Text = SelectedElement.Properties == null ? "Properties" : string.Format("Properties ({0})", SelectedElement.Properties.Count);
                    xLocatorsTextBlock.Text   = SelectedElement.Locators == null ? "Locators" : string.Format("Locators ({0})", SelectedElement.Locators.Count);
                });
            }
        }
示例#4
0
        private void TestElementButtonClicked(object sender, RoutedEventArgs e)
        {
            if (!ValidateDriverAvalability())
            {
                return;
            }

            if (mSelectedLocator != null)
            {
                var testElement = new ElementInfo();
                testElement.Path     = SelectedElement.Path;
                testElement.Locators = new ObservableList <ElementLocator>()
                {
                    mSelectedLocator
                };

                //For Java Driver Widgets
                if (Platform.PlatformType() == ePlatformType.Java)  // WorkSpace.Instance.Solution.GetTargetApplicationPlatform(SelectedPOM.TargetApplicationKey).Equals(ePlatformType.Java))
                {
                    if (SelectedElement.GetType().Equals(typeof(GingerCore.Drivers.Common.HTMLElementInfo)))
                    {
                        var htmlElementInfo = new GingerCore.Drivers.Common.HTMLElementInfo()
                        {
                            Path = testElement.Path, Locators = testElement.Locators
                        };
                        testElement            = htmlElementInfo;
                        testElement.Properties = SelectedElement.Properties;
                    }
                }

                WindowExplorerDriver.TestElementLocators(testElement);
            }
        }
示例#5
0
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
        {
            GeometryObject geob      = null;
            string         stableRep = string.Empty;

            AssociativeNode node;

            if (SelectedElement != null)
            {
                var dbDocument = DocumentManager.Instance.CurrentDBDocument;
                if (dbDocument != null)
                {
                    var element = dbDocument.GetElement(SelectedElement);
                    if (element != null)
                    {
                        geob = element.GetGeometryObjectFromReference(SelectedElement);
                    }
                }

                stableRep = SelectedElement.ConvertToStableRepresentation(dbDocument);
            }

            var args = new List <AssociativeNode>
            {
                AstFactory.BuildStringNode(stableRep)
            };

            node = AstFactory.BuildFunctionCall(
                "GeometryObjectSelector",
                "ByReferenceStableRepresentation",
                args);

            return(new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) });
        }
示例#6
0
 void Updater_ElementsDeleted(Document document, IEnumerable <ElementId> deleted)
 {
     if (SelectedElement != null && document == selectionOwner)
     {
         SelectedElement = SelectedElement.Where(x => !deleted.Contains(x)).ToList();
     }
 }
示例#7
0
        /// ------------------------------------------------------------------------------------
        public bool SetSelectedComponentFile(int index)
        {
            if (SelectedElement == null)
            {
                SelectedComponentFile = null;
                return(false);
            }

            if (index < 0)
            {
                return(false);
            }

            var componentFiles = SelectedElement.GetComponentFiles();

            if (index >= componentFiles.Length)
            {
                return(false);
            }

            SelectedComponentFile = componentFiles[index];

            _currentEditorProviders = SelectedComponentFile.FileType.GetEditorProviders(
                GetHashCode(), SelectedComponentFile);

            return(true);
        }
示例#8
0
        //---------------------------------------------------------------------------------------------------------
        // Déplace l'élément sélectionné apès avoir posé les bonnes questions à l'utilisateur
        private void MoveElement(TimeSpan tsDeplacement, TimeSpan?tsDuree)
        {
            EModeDeplacementProjet mode = EModeDeplacementProjet.MoveAutoOnly;

            if (SelectedElement != null)
            {
                // Appelle une fonction de traitement du mouvement externe
                if (MoveElementFonctionDeleguee != null)
                {
                    MoveElementFonctionDeleguee(SelectedElement, tsDeplacement, tsDuree, true);
                }

                else
                {
                    if (m_formConfirmation.DemanderConfirmation(SelectedElement))
                    {
                        // Faire ici le mouvement
                        if (m_formConfirmation.DeplacerLesFilsNonAuto)
                        {
                            mode = EModeDeplacementProjet.MoveNonAuto;
                        }
                        SelectedElement.Move(tsDeplacement, tsDuree, mode, true);
                    }
                }

                // Déclenche l'événement lorsqu'un élément du Gantt est déplacé
                if (OnMoveElementDeGantt != null)
                {
                    OnMoveElementDeGantt(SelectedElement);
                }
            }
        }
示例#9
0
 public static bool HasLeaf(this SelectedElement element)
 {
     if (element.LeafProduct.GetName() == "InvalidLeafProduct")
     {
         return(false);
     }
     return(true);
 }
示例#10
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);

            if (SelectedElement != null)
            {
                SelectedElement.CacheInMemory();
            }
        }
示例#11
0
        /// ------------------------------------------------------------------------------------
        public bool DeleteComponentFile(ComponentFile file)
        {
            if (_currentEditorProviders.Any(editor => !editor.ComponentFileDeletionInitiated(file)))
            {
                return(false);
            }

            return(SelectedElement.DeleteComponentFile(file, true));
        }
        public override void MouseRelease(Vector2 mouseGlobalPosition)
        {
            base.MouseRelease(mouseGlobalPosition);

            if (IsSelectable)
            {
                SelectedElement?.MouseRelease(mouseGlobalPosition);
            }
        }
示例#13
0
 protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
 {
     if (SelectedElement != null)
     {
         XmlElement outEl = xmlDoc.CreateElement("instance");
         outEl.SetAttribute("id", SelectedElement.ConvertToStableRepresentation(DocumentManager.Instance.CurrentDBDocument));
         nodeElement.AppendChild(outEl);
     }
 }
示例#14
0
 public void analyseSelectedElement()
 {
     SelectedElement.analyse();
     selectedVirus.setCountAnalyse(selectedVirus.CountAnalyse + 1);
     if (selectedVirus.CountAnalyse >= selectedVirus.Level)
     {
         selectedVirus.setOutOfAction(true);
     }
 }
        public virtual TProperty SelectedElementAs <TProperty>()
        {
            if (!HasSelectedElement)
            {
                throw new NoSuchElementException("No selected element has been found");
            }

            return(SelectedElement.GetControlValueAs <TProperty>());
        }
示例#16
0
        public void SaveToXML(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("field");
            writer.WriteAttributeString("name", MyType.Name);
            writer.WriteAttributeString("value", SelectedElement.MyType.Name);

            SelectedElement.SaveToXML(writer);

            writer.WriteEndElement();
        }
示例#17
0
        public virtual PageObjectWrapper <T> ClearElement()
        {
            if (SelectedElement == null)
            {
                return(this);
            }

            SelectedElement.Clear();
            return(this);
        }
示例#18
0
        void Updater_ElementsDeleted(Document document, IEnumerable <ElementId> deleted)
        {
            if (SelectedElement != null && document.Equals(selectionOwner))
            {
                SelectedElement = SelectedElement.Where(x => !deleted.Contains(x)).ToList();

                RaisePropertyChanged("SelectedElement");
                RaisePropertyChanged("SelectionText");
                RequiresRecalc = true;
            }
        }
 public virtual void UnhighlightInternal()
 {
     if (IsSelectable && SelectedElement != null)
     {
         if (SelectedElement is UIContainer container && container.IsSelectable)
         {
             container.UnhighlightInternal();
         }
         SelectedElement.Unhighlight();
     }
 }
示例#20
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 protected DateTimeElementEditor GetCurrentElementEditor()
 {
     if (SelectedElement != null)
     {
         bool flag = base.RaiseModifyWithoutEditValueChange();
         if (!IsElementEdited && flag)
         {
             _fCurrentElementEditor = SelectedElement.CreateElementEditor(NonEmptyCurrentValue);
         }
     }
     return(_fCurrentElementEditor);
 }
示例#21
0
            void OnMouseDown(MouseDownEvent e)
            {
                if (m_Active)
                {
                    e.StopImmediatePropagation();
                    return;
                }

                m_Active   = false;
                m_Dragging = false;

                if (target == null)
                {
                    return;
                }

                SelectionContainer = target.GetFirstAncestorOfType <ISelection>();

                if (SelectionContainer == null)
                {
                    // Keep for potential later use in OnMouseUp (where e.target might be different then)
                    SelectionContainer = target.GetFirstOfType <ISelection>();
                    SelectedElement    = e.target as GraphElement;
                    return;
                }

                SelectedElement = target.GetFirstOfType <GraphElement>();

                if (SelectedElement == null)
                {
                    return;
                }

                if (e.button == (int)ActivateButton)
                {
                    // avoid starting a manipulation on a non movable object

                    if (!SelectedElement.IsDroppable())
                    {
                        return;
                    }

                    // Reset drag and drop
                    Vector2 localParentPosition = SelectedElement.ChangeCoordinatesTo(SelectedElement.parent, e.localMousePosition);

                    m_DragAndDropDelay.Init(localParentPosition);

                    m_Active = true;
                    target.CaptureMouse();
                    e.StopPropagation();
                }
            }
示例#22
0
        public void LoadFromXML(System.Xml.XmlNode node)
        {
            string selectedElementName = node.Attributes["value"].Value;
            int    index = _elements.IndexOfKey(selectedElementName);

            if (index < 0)
            {
                throw new FieldException("The enum \"" + this.MyType.DisplayName + "\" does not contain the enum element " + selectedElementName);
            }

            SelectedElementIndex = index;
            SelectedElement.LoadFromXML(node);
        }
示例#23
0
 private void Simulator_MouseMove(object sender, MouseEventArgs e)
 {
     if (CurrentMouseState == MouseState.Wire)
     {
         WireBuilder.EndPosition = e.Location;
     }
     else if (CurrentMouseState == MouseState.Drag)
     {
         Point off = GeometryUtil.GetOffset(e.Location, ClickedPosition);
         SelectedElement.Move(off);
         ClickedPosition = e.Location;
     }
     Invalidate(true);
 }
示例#24
0
        public static void MoveObjects(double canvasWidth,
                                       double canvasHeight,
                                       double elementLeft,
                                       double elementWidth,
                                       double elementTop,
                                       double elementHeigth,
                                       double offsetLeft,
                                       double offsetTop
                                       )
        {
            ResizeHandles.MoveObject(canvasWidth, canvasHeight, elementLeft, elementWidth, elementTop, elementHeigth);

            ResizeHandles.SelectedElement.MoveHandles();

            Guid elementId = SelectedElement.GetElementId();

            foreach (UIElement item in canvaselements.Values)
            {
                if (elementId == item.GetElementId())
                {
                    continue;
                }

                SectionCanvas itemCanvas = item.FindParentControlBase(typeof(SectionCanvas)) as SectionCanvas;

                double canvasItemWidth = ResizeHandles.SelectedElement.GetPropertyValue("ActualWidth").ToDouble();

                double canvasItemHeigth = ResizeHandles.SelectedElement.GetPropertyValue("ActualHeight").ToDouble();

                double canvasItemLeft = Canvas.GetLeft(item) + offsetLeft;

                double canvasItemTop = Canvas.GetTop(item) + offsetTop;

                if (canvasItemLeft <= 0 ||
                    canvasItemTop <= 0 ||
                    (canvasItemLeft + canvasItemWidth) > itemCanvas.ActualWidth ||
                    (canvasItemTop + canvasItemHeigth) > itemCanvas.ActualHeight)
                {
                    continue;
                }

                Canvas.SetLeft(item, canvasItemLeft);

                Canvas.SetTop(item, canvasItemTop);

                item.MoveHandles();
            }
        }
示例#25
0
 public void exploreSelectedElement()
 {
     if (SelectedElement.isNeighboorOfSelectedVirus() != -1)
     {
         // on lance l'exploration de l'élement
         SelectedElement.explore();
         // on définit le nouveau parent du virus qui a changé d'élement
         selectedVirus.transform.parent = SelectedElement.transform;
         // reset la position du virus pour le déplacer à l'origine de son nouveau parent
         //selectedVirus.GetComponentInParent<Transform>.transform.translate(0);
         // on change le nouvel élement du virus
         selectedVirus.setElement(SelectedElement);
         selectedVirus.updatePosition();
         selectedVirus.setHasExplored(true);
     }
 }
示例#26
0
        public void Render(CompendiumPageGump gump)
        {
            Console.WriteLine("Rendering Compendium Gump");

            try
            {
                var elements = m_elements.OrderBy(element => element.Z);

                foreach (var element in elements)
                {
                    element.Render(gump);
                }

                if (gump is CompendiumPreviewPageGump)
                {
                    if (SelectedElement != null)
                    {
                        gump.AddImage(SelectedElement.X - 45, SelectedElement.Y - 42, 4503);
                        SelectedElement.RenderOutline(gump);
                    }

                    if (ShowEditorGrid)
                    {
                        for (var x = 0; x < NUMBER_OF_GRID_COLUMNS; ++x)
                        {
                            for (var y = 0; y < NUMBER_OF_GRID_ROWS; ++y)
                            {
                                var param = (x * NUMBER_OF_GRID_ROWS) + y;

                                gump.AddButton(
                                    (x * GRID_BUTTON_WIDTH),
                                    (y * GRID_BUTTON_HEIGHT),
                                    GRID_BUTTON_ID,
                                    GRID_BUTTON_ID,
                                    b => onGridButtonButtonClick(b, param));
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#27
0
 public void AddSelectedElement(int id, bool ctrl, bool multi)
 {
     if (SelectedElementsCount != 0 & !multi && !ctrl)
     {
         UnselectElements();
     }
     if (SelectedElements.Contains(id))
     {
         SelectedElements.Remove(id);
         UnselectedElement?.Invoke(id);
     }
     else
     {
         SelectedElements.Add(id);
         SelectedElement?.Invoke(id);
     }
     ModelChanged?.Invoke(this);
 }
示例#28
0
 public override void CancelElementChanges()
 {
     if (SelectedElement != null)
     {
         if (SelectedElement.IsNew)
         {
             DeleteElement(SelectedElement);
             GoToElement(SelectionHistory[SelectionHistory.Count - 1]);
         }
         else
         {
             int i = SelectedElementIndex;
             SelectedElement.CancelEdit();
             NotifyPropertyChanged("SelectedElement");
             RefreshCollections();
             GoToElement(i);
         }
     }
 }
示例#29
0
        public void Render(CompendiumPageGump gump)
        {
            if (Compendium.LOG_MESSAGES)
            {
                Console.WriteLine("Rendering Compendium Gump");
            }

            try
            {
                var elements = m_elements.OrderBy(element => element.Z);

                foreach (BaseCompendiumPageElement element in elements)
                {
                    element.Render(gump);
                }

                if (gump is CompendiumPreviewPageGump)
                {
                    if (SelectedElement != null)
                    {
                        gump.AddImage(SelectedElement.X - 45, SelectedElement.Y - 42, 4503);
                        SelectedElement.RenderOutline(gump);
                    }

                    if (ShowEditorGrid)
                    {
                        for (int x = 0; x < NUMBER_OF_GRID_COLUMNS; ++x)
                        {
                            for (int y = 0; y < NUMBER_OF_GRID_ROWS; ++y)
                            {
                                gump.AddButton((x * GRID_BUTTON_WIDTH), (y * GRID_BUTTON_HEIGHT), GRID_BUTTON_ID,
                                               GRID_BUTTON_ID, GumpButtonType.Reply, onGridButtonButtonClick,
                                               (x * NUMBER_OF_GRID_ROWS) + y);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#30
0
        public virtual PageObjectWrapper <T> SelectByIndex(int index)
        {
            if (SelectedElement == null)
            {
                return(this);
            }

            var validator = PageBase.GetDefaultValidator();

            if (validator == null)
            {
                SelectedElement.SelectByIndex(index);
            }
            else if (validator != null && !validator.ExceptionFields.Any(selector => selector.Equals(LastSelector)))
            {
                SelectedElement.SelectByIndex(index);
            }

            return(this);
        }