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); }
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) }); }
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); }); } }
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); } }
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) }); }
void Updater_ElementsDeleted(Document document, IEnumerable <ElementId> deleted) { if (SelectedElement != null && document == selectionOwner) { SelectedElement = SelectedElement.Where(x => !deleted.Contains(x)).ToList(); } }
/// ------------------------------------------------------------------------------------ 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); }
//--------------------------------------------------------------------------------------------------------- // 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); } } }
public static bool HasLeaf(this SelectedElement element) { if (element.LeafProduct.GetName() == "InvalidLeafProduct") { return(false); } return(true); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); if (SelectedElement != null) { SelectedElement.CacheInMemory(); } }
/// ------------------------------------------------------------------------------------ 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); } }
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); } }
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>()); }
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(); }
public virtual PageObjectWrapper <T> ClearElement() { if (SelectedElement == null) { return(this); } SelectedElement.Clear(); return(this); }
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(); } }
/// <summary> /// /// </summary> /// <returns></returns> protected DateTimeElementEditor GetCurrentElementEditor() { if (SelectedElement != null) { bool flag = base.RaiseModifyWithoutEditValueChange(); if (!IsElementEdited && flag) { _fCurrentElementEditor = SelectedElement.CreateElementEditor(NonEmptyCurrentValue); } } return(_fCurrentElementEditor); }
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(); } }
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); }
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); }
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(); } }
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); } }
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); } }
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); }
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); } } }
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); } }
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); }