Holds the different elements for attack types
Ejemplo n.º 1
1
 /// <summary>
 /// Serializes the specified <see cref="Element"/> to XML.
 /// </summary>
 /// <param name="root">
 /// The <c>Element</c> to serialize, including all its children.
 /// </param>
 /// <remarks>
 /// The generated XML will be indented and have a full XML
 /// declaration header.
 /// </remarks>
 /// <exception cref="ArgumentNullException">root is null.</exception>
 public void Serialize(Element root)
 {
     var settings = new XmlWriterSettings();
     settings.Indent = true;
     //settings.NamespaceHandling = NamespaceHandling.OmitDuplicates;
     this.Serialize(root, settings);
 }
        public void ShouldCallSetBackgroundColorOnlyOnceWithNestedCallsToOnAndOff()
        {
            // GIVEN
            var domContainer = new Mock<DomContainer>().Object;
            var nativeElementMock = new Mock<INativeElement>();
            var element = new Element(domContainer, nativeElementMock.Object);

            Settings.HighLightColor = "myTestColor";
            var highLight = new HighlightAction(element);

            nativeElementMock.Expect(nativeElement => nativeElement.IsElementReferenceStillValid()).Returns(true);
            nativeElementMock.Expect(nativeElement => nativeElement.GetStyleAttributeValue("backgroundColor")).Returns("initialColor").AtMostOnce();
            nativeElementMock.Expect(nativeElement => nativeElement.SetStyleAttributeValue("backgroundColor", "myTestColor")).AtMostOnce();
            nativeElementMock.Expect(nativeElement => nativeElement.SetStyleAttributeValue("backgroundColor", "initialColor")).AtMostOnce();

            // WHEN
            highLight.On();
            highLight.On();
            highLight.On();
            highLight.Off();
            highLight.Off();
            highLight.Off();

            // THEN
            nativeElementMock.VerifyAll();
        }
Ejemplo n.º 3
1
		/// <summary>
		/// Creates texture atlas from stream.
		/// </summary>
		/// <param name="device"></param>
		public TextureAtlas ( RenderSystem rs, Stream stream, bool useSRgb = false )
		{
			var device = rs.Game.GraphicsDevice;

			using ( var br = new BinaryReader(stream) ) {
			
				br.ExpectFourCC("ATLS", "texture atlas");
				
				int count = br.ReadInt32();
				
				for ( int i=0; i<count; i++ ) {
					var element = new Element();
					element.Index	=	i;
					element.Name	=	br.ReadString();
					element.X		=	br.ReadInt32();
					element.Y		=	br.ReadInt32();
					element.Width	=	br.ReadInt32();
					element.Height	=	br.ReadInt32();

					elements.Add( element );
				}				

				int ddsFileLength	=	br.ReadInt32();
				
				var ddsImageBytes	=	br.ReadBytes( ddsFileLength );

				texture	=	new UserTexture( rs, ddsImageBytes, useSRgb );
			}


			dictionary	=	elements.ToDictionary( e => e.Name );
		}
Ejemplo n.º 4
0
 public void Hover(Element element)
 {
     var sequenceBuilder = new Actions(selenium);
     var actionSequenceBuilder = sequenceBuilder.MoveToElement((IWebElement) element.Native);
     var action = actionSequenceBuilder.Build();
     action.Perform();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Exports a FabricArea as an IfcGroup.  There is no geometry to export.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool ExportFabricArea(ExporterIFC exporterIFC, Element element, ProductWrapper productWrapper)
        {
            if (element == null)
                return false;

            HashSet<IFCAnyHandle> fabricSheetHandles = null;
            if (!ExporterCacheManager.FabricAreaHandleCache.TryGetValue(element.Id, out fabricSheetHandles))
                return false;

            if (fabricSheetHandles == null || fabricSheetHandles.Count == 0)
                return false;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                string guid = GUIDUtil.CreateGUID(element);
                IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle();
                string revitObjectType = exporterIFC.GetFamilyName();
                string name = NamingUtil.GetNameOverride(element, revitObjectType);
                string description = NamingUtil.GetDescriptionOverride(element, null);
                string objectType = NamingUtil.GetObjectTypeOverride(element, revitObjectType);

                IFCAnyHandle fabricArea = IFCInstanceExporter.CreateGroup(file, guid,
                    ownerHistory, name, description, objectType);

                productWrapper.AddElement(element, fabricArea);

                IFCInstanceExporter.CreateRelAssignsToGroup(file, GUIDUtil.CreateGUID(), ownerHistory,
                    null, null, fabricSheetHandles, null, fabricArea);

                tr.Commit();
                return true;
            }
        }
Ejemplo n.º 6
0
        public void ElementCreate()
        {
            Element e = new Element(3.141592);
            Assert.IsNotNull(e);

            Element p = new Element(100);
            Element q = new Element(p);
            Element z = new Element(DateTime.Now);

            ConstExpr j = new ConstExpr(z);
            ConstExpr k = new ConstExpr(j.Value.BoolValue());

            ConstExpr v = new ConstExpr(k);
            ConstExpr u = new ConstExpr(v);

            Element b = new Element(true);
            Element i = new Element(100);
            Element l = new Element(9812080980101);
            Element d = new Element(3.1314);
            Element s = new Element("Hello World!");
            Element dt = new Element(DateTime.Now);
            Element ts = new Element(TimeSpan.FromSeconds(100));
            Element r = new Element(new Regex("abc[0-9]"));

            Assert.IsTrue(b.DataType == ElementType.BOOL);
            Assert.IsTrue(l.DataType == ElementType.LONG);
            Assert.IsTrue(d.DataType == ElementType.DOUBLE);
            Assert.IsTrue(s.DataType == ElementType.STRING);
            Assert.IsTrue(dt.DataType == ElementType.DATETIME);
            Assert.IsTrue(ts.DataType == ElementType.TIMESPAN);
            Assert.IsTrue(r.DataType == ElementType.REGEX);
        }
        /// <summary>
        /// Gets IFC covering type for an element.
        /// </summary>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="typeName">
        /// The type name.
        /// </param>
        public static Toolkit.IFCCoveringType GetIFCCoveringType(Element element, string typeName)
        {
            string value = null;
            if (!ParameterUtil.GetStringValueFromElementOrSymbol(element, "IfcType", out value))
            {
                value = typeName;
            }
            if (String.IsNullOrEmpty(value))
                return Toolkit.IFCCoveringType.NotDefined;

            string newValue = NamingUtil.RemoveSpacesAndUnderscores(value);

            if (String.Compare(newValue, "USERDEFINED", true) == 0)
                return Toolkit.IFCCoveringType.UserDefined;
            if (String.Compare(newValue, "CEILING", true) == 0)
                return Toolkit.IFCCoveringType.Ceiling;
            if (String.Compare(newValue, "FLOORING", true) == 0)
                return Toolkit.IFCCoveringType.Flooring;
            if (String.Compare(newValue, "CLADDING", true) == 0)
                return Toolkit.IFCCoveringType.Cladding;
            if (String.Compare(newValue, "ROOFING", true) == 0)
                return Toolkit.IFCCoveringType.Roofing;
            if (String.Compare(newValue, "INSULATION", true) == 0)
                return Toolkit.IFCCoveringType.Insulation;
            if (String.Compare(newValue, "MEMBRANE", true) == 0)
                return Toolkit.IFCCoveringType.Membrane;
            if (String.Compare(newValue, "SLEEVING", true) == 0)
                return Toolkit.IFCCoveringType.Sleeving;
            if (String.Compare(newValue, "WRAPPING", true) == 0)
                return Toolkit.IFCCoveringType.Wrapping;

            return Toolkit.IFCCoveringType.NotDefined;
        }
Ejemplo n.º 8
0
        public Element GetPrivate(Jid jid, Element element)
        {
            CheckArgs(jid, element);

            var elementStr = ExecuteScalar<string>(new SqlQuery("jabber_private").Select("element").Where("jid", jid.Bare).Where("tag", element.TagName).Where("namespace", element.Namespace));
            return !string.IsNullOrEmpty(elementStr) ? ElementSerializer.DeSerializeElement<Element>(elementStr) : null;
        }
Ejemplo n.º 9
0
        public void AddResource(Element element)
        {
            locker.EnterWriteLock();
            try
            {
                CreateDir();
                string filePath = Path.Combine(this.path, ResXResourceFileHelper.GetFileName(element.Category, element.Culture));
                XDocument document = GetResxDocument(filePath);

                if (document == null)
                {
                    document = CreateResXDocument();
                }
                var exists = document.Root.Elements("data")
                   .FirstOrDefault(d => d.Attribute("name").Value == element.Name);
                if (exists == null)
                {
                    document.Root.Add(
                    new XElement("data",
                        new XAttribute("name", element.Name),
                        new XAttribute(XNamespace.Xml + "space", "preserve"),
                        new XElement("value", element.Value)));
                    document.Save(filePath);
                }
            }
            finally
            {
                locker.ExitWriteLock();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Exports an element to IFC footing.
        /// </summary>
        /// <param name="exporterIFC">
        /// The ExporterIFC object.
        /// </param>
        /// <param name="element">
        /// The element.
        /// </param>
        /// <param name="geometryElement">
        /// The geometry element.
        /// </param>
        /// <param name="ifcEnumType">
        /// The string value represents the IFC type.
        /// </param>
        /// <param name="productWrapper">
        /// The IFCProductWrapper.
        /// </param>
        public static void ExportFooting(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement,
           string ifcEnumType, IFCProductWrapper productWrapper)
        {
            // export parts or not
            bool exportParts = PartExporter.CanExportParts(element);
            if (exportParts && !PartExporter.CanExportElementInPartExport(element, element.Level.Id, false))
                return;

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                using (IFCPlacementSetter setter = IFCPlacementSetter.Create(exporterIFC, element))
                {
                    using (IFCExtrusionCreationData ecData = new IFCExtrusionCreationData())
                    {                      
                        ecData.SetLocalPlacement(setter.GetPlacement());
                      
                        IFCAnyHandle prodRep = null;
                        if (!exportParts)
                        {
                            ElementId catId = CategoryUtil.GetSafeCategoryId(element);

                            BodyExporterOptions bodyExporterOptions = new BodyExporterOptions(true);
                            prodRep = RepresentationUtil.CreateBRepProductDefinitionShape(element.Document.Application, exporterIFC,
                               element, catId, geometryElement, bodyExporterOptions, null, ecData);
                            if (IFCAnyHandleUtil.IsNullOrHasNoValue(prodRep))
                            {
                                ecData.ClearOpenings();
                                return;
                            }
                        }

                        string instanceGUID = ExporterIFCUtils.CreateGUID(element);
                        string origInstanceName = exporterIFC.GetName();
                        string instanceName = NamingUtil.GetNameOverride(element, origInstanceName);
                        string instanceDescription = NamingUtil.GetDescriptionOverride(element, null);
                        string instanceObjectType = NamingUtil.GetObjectTypeOverride(element, exporterIFC.GetFamilyName());
                        string instanceElemId = NamingUtil.CreateIFCElementId(element);
                        Toolkit.IFCFootingType footingType = GetIFCFootingType(element, ifcEnumType);

                        IFCAnyHandle footing = IFCInstanceExporter.CreateFooting(file, instanceGUID, exporterIFC.GetOwnerHistoryHandle(),
                            instanceName, instanceDescription, instanceObjectType, ecData.GetLocalPlacement(), prodRep, instanceElemId, footingType);

                        if (exportParts)
                        {
                            PartExporter.ExportHostPart(exporterIFC, element, footing, productWrapper, setter, setter.GetPlacement(), null);
                        }

                        productWrapper.AddElement(footing, setter, ecData, LevelUtil.AssociateElementToLevel(element));

                        OpeningUtil.CreateOpeningsIfNecessary(footing, element, ecData, exporterIFC, ecData.GetLocalPlacement(), setter, productWrapper);

                        PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
                    }
                }

                tr.Commit();
            }
        }
        /// <summary>
        /// Creates uniformat classification.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC.</param>
        /// <param name="file">The file.</param>
        /// <param name="element">The element.</param>
        /// <param name="elemHnd">The element handle.</param>
        public static void CreateUniformatClassification(ExporterIFC exporterIFC, IFCFile file, Element element, IFCAnyHandle elemHnd)
        {
            // Create Uniformat classification, if it is not set.
            string uniformatKeyString = "Uniformat";
            string uniformatCode = "";
            if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_CODE, false, out uniformatCode) == null)
                ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Code", out uniformatCode);
            string uniformatDescription = "";

            if (!String.IsNullOrWhiteSpace(uniformatCode))
            {
                if (ParameterUtil.GetStringValueFromElementOrSymbol(element, BuiltInParameter.UNIFORMAT_DESCRIPTION, false, out uniformatDescription) == null)
                    ParameterUtil.GetStringValueFromElementOrSymbol(element, "Assembly Description", out uniformatDescription);
            }

            IFCAnyHandle classification;
            if (!ExporterCacheManager.ClassificationCache.ClassificationHandles.TryGetValue(uniformatKeyString, out classification))
            {
                classification = IFCInstanceExporter.CreateClassification(file, "http://www.csiorg.net/uniformat", "1998", null, uniformatKeyString);
                ExporterCacheManager.ClassificationCache.ClassificationHandles.Add(uniformatKeyString, classification);
            }

                InsertClassificationReference(exporterIFC, file, element, elemHnd, uniformatKeyString, uniformatCode, uniformatDescription, "http://www.csiorg.net/uniformat" );

        }
Ejemplo n.º 12
0
 private void CheckArgs(Jid jid, Element element)
 {
     if (jid == null) throw new ArgumentNullException("jid");
     if (element == null) throw new ArgumentNullException("element");
     if (string.IsNullOrEmpty(element.TagName)) throw new ArgumentNullException("element.TagName");
     if (string.IsNullOrEmpty(element.Namespace)) throw new ArgumentNullException("element.Namespace");
 }
        /// <summary>
        /// Calculates the end hook angle for a rebar.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
        /// <param name="element">The element to calculate the value.</param>
        /// <param name="elementType">The element type.</param>
        /// <returns>
        /// True if the operation succeed, false otherwise.
        /// </returns>
        public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
        {
            RebarBendData bendData = null;
            if (element is Rebar)
                bendData = (element as Rebar).GetBendData();
            else if (element is RebarInSystem)
                bendData = (element as RebarInSystem).GetBendData();
            
            if (bendData != null)
            {
                if (bendData.HookLength1 > MathUtil.Eps())
                {
                    ElementId hookAtEndTypeId;
                    if (ParameterUtil.GetElementIdValueFromElement(element, BuiltInParameter.REBAR_ELEM_HOOK_END_TYPE, out hookAtEndTypeId) != null)
                    {
                        RebarHookType rebarHookType = element.Document.GetElement(hookAtEndTypeId) as RebarHookType;
                        if (rebarHookType != null)
                        {
							//HookAngle is measured in radians, so scale directly.
                            m_Angle = rebarHookType.HookAngle *180 / Math.PI;
                            return true;
                        }
                    }
                }
            }
            return false;
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Exports a Rebar, AreaReinforcement or PathReinforcement to IFC ReinforcingBar.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="element">The element.</param>
        /// <param name="filterView">The view.</param>
        /// <param name="productWrapper">The product wrapper.</param>
        public static void Export(ExporterIFC exporterIFC,
            Element element, Autodesk.Revit.DB.View filterView, ProductWrapper productWrapper)
        {
            if (element is Rebar)
            {
                ExportRebar(exporterIFC, element, filterView, productWrapper);
            }
            else if (element is AreaReinforcement)
            {
                AreaReinforcement areaReinforcement = element as AreaReinforcement;
                IList<ElementId> rebarIds = areaReinforcement.GetRebarInSystemIds();

                Document doc = areaReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
            else if (element is PathReinforcement)
            {
                PathReinforcement pathReinforcement = element as PathReinforcement;
                IList<ElementId> rebarIds = pathReinforcement.GetRebarInSystemIds();

                Document doc = pathReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
        }
Ejemplo n.º 15
0
 public void ParseEquity(Element fieldData)
 {
     string tenor = fieldData.GetElementAsString("ID_BB_SEC_NUM_DES");
     double px_mid = fieldData.GetElementAsFloat64("PRIOR_CLOSE_MID");
     tenor = tenor.Replace(isin,"");
     pointsCourbe.Add(TenorToDate(tenor), px_mid);
 }
Ejemplo n.º 16
0
		public override void ElementHandle(XmppStream stream, Element element, XmppHandlerContext context)
		{
			context.Sender.SendTo(stream, new Compressed());
			var connection = context.Sender.GetXmppConnection(stream.ConnectionId);
			connection.SetStreamTransformer(new GZipTransformer());
			context.Sender.ResetStream(stream);
		}
Ejemplo n.º 17
0
 public Route(Element route, Jid from, Jid to)
     : this()
 {
     RouteElement	= route;
     From			= from;
     To				= to;
 }
 public void SetElementMenuDetail(Element element)
 {
     if (element != null)
     {
         _elementMenuDetail = element;
     }
 }
Ejemplo n.º 19
0
 public WorkDetailViewModel(Element Element = null)
 {
     if(Element != null)
     {
         this.Content = GetWorkByElement(Element);
     }
 }
Ejemplo n.º 20
0
        public PathViewModel(RepositoryNavigationRequest request, AbstractTreeNode node)
        {
            Elements = new List<Element>();

            CurrentItem = new Element(
                new RepositoryNavigationRequest(request) { Path = node.Path },
                request.Treeish,
                node);

            var currentNode = node;

            while (currentNode.Parent != null)
            {
                currentNode = currentNode.Parent;
                if (currentNode.Parent != null)
                {
                    Elements.Add(
                        new Element(new RepositoryNavigationRequest(request) { Path = currentNode.Path },
                        request.Treeish,
                        currentNode));
                }
            }

            Elements = new List<Element>(Elements.Reverse());
            Root = new Element(request, request.Treeish, currentNode);
            IsRootEqualToCurrentItem = (currentNode == node);
        }
Ejemplo n.º 21
0
        public Element ReadNextElement()
        {
            if (_atEof || ReadBoundary())
                return null;

            var elem = new Element();
            string header;
            while ((header = ReadHeaders()) != null)
            {
                if (StrUtils.StartsWith(header, "Content-Disposition:", true))
                {
                    elem.Name = GetContentDispositionAttribute(header, "name");
                    elem.Filename = StripPath(GetContentDispositionAttributeWithEncoding(header, "filename"));
                }
                else if (StrUtils.StartsWith(header, "Content-Type:", true))
                {
                    elem.ContentType = header.Substring("Content-Type:".Length).Trim();
                }
            }

            long start = data.Position;
            elem.Start = start;
            long pos = MoveToNextBoundary();
            if (pos == -1)
                return null;

            elem.Length = pos - start;
            return elem;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Calculates perimeter for a slab.
 /// </summary>
 /// <param name="exporterIFC">
 /// The ExporterIFC object.
 /// </param>
 /// <param name="extrusionCreationData">
 /// The IFCExtrusionCreationData.
 /// </param>
 /// <param name="element">
 /// The element to calculate the value.
 /// </param>
 /// <param name="elementType">
 /// The element type.
 /// </param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     if (extrusionCreationData == null)
         return false;
     m_Perimeter = extrusionCreationData.ScaledOuterPerimeter;
     return m_Perimeter > MathUtil.Eps();
 }
 /// <summary>
 /// Calculates shape parameter A for a rebar.
 /// </summary>
 /// <param name="exporterIFC">The ExporterIFC object.</param>
 /// <param name="extrusionCreationData">The IFCExtrusionCreationData.</param>
 /// <param name="element">The element to calculate the value.</param>
 /// <param name="elementType">The element type.</param>
 /// <returns>
 /// True if the operation succeed, false otherwise.
 /// </returns>
 public override bool Calculate(ExporterIFC exporterIFC, IFCExtrusionCreationData extrusionCreationData, Element element, ElementType elementType)
 {
     bool ret = (ParameterUtil.GetDoubleValueFromElement(element, BuiltInParameterGroup.PG_GEOMETRY, "A", out m_ShapeParameterA) != null);
     if (ret)
         m_ShapeParameterA = UnitUtil.ScaleLength(m_ShapeParameterA);
     return ret;
 }
Ejemplo n.º 24
0
 public MemberAccess(TextPosition tp, Element acs, string member)
     : base(tp)
 {
     Access = acs;
     Member = member;
     AppendChild(Access);
 }
Ejemplo n.º 25
0
        public void AllAttributesEmptyOrNull_TwoAttributesOneWithValues()
        {
            Element element = new Element();
            element.MaxOccurs = 1;
            element.MinOccurs = 0;
            element.Name = "baseElement";
            element.Parent = null;
            element.RootElement = true;
            element.SpecialLength = false;
            element.Type = "DataType.String";
            element.Value = "baseElement";
            element.Documentation = "baseElement";
            element.IsAdvanced = true;

            NewRelic.AgentConfiguration.Parts.Attribute attribute = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute.Name = "attributeName";
            attribute.Parent = element;

            element.Attributes.Add(attribute);

            NewRelic.AgentConfiguration.Parts.Attribute attribute2 = new NewRelic.AgentConfiguration.Parts.Attribute();
            attribute2.Name = "attribute2Name";
            attribute2.Parent = element;
            attribute2.Value = "attribute2Value";

            element.Attributes.Add(attribute2);

            Assert.IsFalse(element.AllAttributesEmptyOrNull());
        }
        // Извърша двоично търсене.
        private static int BinarySearch(Element<int>[] elements, int elementToSearch)
        {
            int leftIndex = 0;
            int rightIndex = elements.Length - 1;
            int result = NotFound;
            while (leftIndex <= rightIndex)
            {
                int midIndex = (leftIndex + rightIndex) / 2;
                if (elementToSearch < elements[midIndex].Key)
                {
                    rightIndex = midIndex - 1;
                }
                else if (elementToSearch > elements[midIndex].Key)
                {
                    leftIndex = midIndex + 1;
                }
                else
                {
                    result = midIndex;
                    break;
                }
            }

            return result;
        }
Ejemplo n.º 27
0
        public void Check(Element field)
        {
            var seleniumElement = SeleniumElement(field);

            if (!seleniumElement.Selected)
                seleniumElement.Click();
        }
 /// <summary>
 /// Called when the collider associated encounters another collider.
 /// Check if the object encountered is an element, if it is the case, it is put in <see cref="ElementDetected"/>.
 /// </summary>
 /// <param name="other">The collider encountered.</param>
 void OnTriggerEnter2D(Collider2D other)
 {
     Component com = other.gameObject.GetComponent<Element>();
     Element element = com as Element;
     if (element != null)
         ElementDetected = element;
 }
Ejemplo n.º 29
0
        /// <summary>
        /// Renders a single value that can be selected by the user.
        /// </summary>
        /// <param name="label">Text representing the value to the user.</param>
        /// <param name="value">The value that will be applied to the setting if chosen by the user.</param>
        /// <param name="parent">DOM element that should be the parent of the value's DOM fragment.</param>
        protected void renderValue(string label, object value, Element parent)
        {
            // Creates a SPAN element
            var span = (HTMLSpanElement)window.document.createElement("SPAN");
            span.innerHTML = label;

            // As with the menu, handling the mousedown event prevents focus changes caused by the click event on some browsers
            span.addEventListener("mousedown", (e) =>
            {
                e.preventDefault();
                e.stopPropagation();

                // do nothing if this is already the selected value
                if (this.value == value) return;

                // select the new value
                this.value = value;
                select(value);

                // notify the menu and other settings of the selection
                triggerChanged(key, value);
            }, false);

            span["value"] = value;
            spans.push(span);
            parent.appendChild(span);
        }
        public void UpdateVisibility(Element element)
        {
            var mainWindow = MainWindow.MIns;
            if (mainWindow == null)
                return;

            if (element?.GetElementType() == null)
                return;

            switch (element.GetElementType().GetElementType())
            {
                case ElementType.Type.BUILDING_CITYGUARD_HOUSE:
                    EnableCanvas(mainWindow.recruit_cityguard);
                    break;

                case ElementType.Type.BUILDING_MOONGLOW_TOWER:
                    EnableCanvas(mainWindow.recruit_mage);
                    EnableCanvas(mainWindow.recruit_warlock);
                    break;

                case ElementType.Type.BUILDING_STABLE:
                    EnableCanvas(mainWindow.recruit_crossbow);
                    EnableCanvas(mainWindow.recruit_knight);
                    EnableCanvas(mainWindow.recruit_paladin);
                    break;

                case ElementType.Type.BUILDING_TRAINING_GROUND:
                    EnableCanvas(mainWindow.recruit_berserker);
                    EnableCanvas(mainWindow.recruit_guardian);
                    EnableCanvas(mainWindow.recruit_ranger);
                    EnableCanvas(mainWindow.recruit_templar);
                    break;
            }
        }
Ejemplo n.º 31
0
        internal static NSAttributedString ToAttributed(this FormattedString formattedString, Element owner,
                                                        Color defaultForegroundColor)
        {
            if (formattedString == null)
            {
                return(null);
            }
            var attributed = new NSMutableAttributedString();

            foreach (var span in formattedString.Spans)
            {
                if (span.Text == null)
                {
                    continue;
                }

                attributed.Append(span.ToAttributed(owner, defaultForegroundColor));
            }

            return(attributed);
        }
Ejemplo n.º 32
0
        //		public override void Layout (int l, int t, int r, int b)
        //		{
        //			base.Layout (l, t, r, b);
        //		}

        void Clicked(object sender, AdapterView.ItemClickEventArgs e)
        {
            Element.NotifyItemSelected(Element.Items.ToList()[e.Position]);
        }
Ejemplo n.º 33
0
 protected override void UpdatePlaceholderColor()
 {
     _hintColorSwitcher = _hintColorSwitcher ?? new TextColorSwitcher(EditText.HintTextColors, Element.UseLegacyColorManagement());
     _hintColorSwitcher.UpdateTextColor(EditText, Element.PlaceholderColor, EditText.SetHintTextColor);
 }
Ejemplo n.º 34
0
 protected override void UpdateTextColor(Color color)
 {
     _textColorSwitcher = _textColorSwitcher ?? new TextColorSwitcher(EditText.TextColors, Element.UseLegacyColorManagement());
     _textColorSwitcher.UpdateTextColor(EditText, color);
 }
Ejemplo n.º 35
0
 IEnumerable <IHtmlAttribute> IHtmlElement.Attributes()
 {
     return(Element.Attributes());
 }
Ejemplo n.º 36
0
 IEnumerable <IHtmlNode> IHtmlContainer.Nodes()
 {
     return(Element.Nodes());
 }
Ejemplo n.º 37
0
 protected virtual void UpdateFont()
 {
     EditText.Typeface = Element.ToTypeface();
     EditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
 }
Ejemplo n.º 38
0
 protected virtual void OnImageFailed(object sender, ExceptionRoutedEventArgs exceptionRoutedEventArgs)
 {
     Log.Warning("Image Loading", $"Image failed to load: {exceptionRoutedEventArgs.ErrorMessage}");
     Element?.SetIsLoading(false);
 }