public void SetTableAreaDate(byte[] areaData, bool bShowAnimation) { ColorFill pNewItem = new ColorFill(); pNewItem.byIndex = 0; pNewItem.FillMaterial = DatetoMaterial(areaData[0]); ColorFillList.Add(pNewItem); for (byte i = 1; i < areaData.Length; i++) { pNewItem = new ColorFill(); pNewItem.byIndex = i; pNewItem.FillMaterial = DatetoMaterial(areaData[areaData.Length - i]); ColorFillList.Add(pNewItem); } if (!bShowAnimation) { for (int i = 0; i < ColorFillList.Count; i++) { ColorFill pItem = ColorFillList[i]; pointObj[pItem.byIndex].material = pItem.FillMaterial; } ColorFillList.Clear(); } }
public IShape GetShapeObject(string shapeCommand) { IShape oShape = null; switch (shapeCommand) { case "R": oShape = new Rectangle(_consoleBuffer); _logger.LogDebug("Created rectangle"); break; case "C": oShape = new Canvas(_consoleBuffer, _consoleImpl); _logger.LogDebug("Created Canvas"); break; case "L": oShape = new Line(_consoleBuffer); _logger.LogDebug("Created Line"); break; case "B": oShape = new ColorFill(_consoleBuffer); _logger.LogDebug("Created ColorFill"); break; } return(oShape); }
public void Throw_ArgumentException_When_IncorrectInput() { //Arrange var mockConsoleBuffer = MockConsoleBuffer.Default(); mockConsoleBuffer.Setup(x => x.CanvasWidth).Returns(20); mockConsoleBuffer.Setup(x => x.CanvasLength).Returns(4); var colorFillObj = new ColorFill(mockConsoleBuffer.Object); //Assert Assert.Throws <ArgumentException>(() => colorFillObj.Initialize(TestDataFactory.ColorFillInvalidInput)); }
public void Throw_InvalidCoordinatesException_When_OutsideCanvas() { //Arrange var mockConsoleBuffer = MockConsoleBuffer.Default(); mockConsoleBuffer.Setup(x => x.CanvasWidth).Returns(20); mockConsoleBuffer.Setup(x => x.CanvasLength).Returns(4); var colorFillObj = new ColorFill(mockConsoleBuffer.Object); //Assert Assert.Throws <InvalidCoordinatesException>(() => colorFillObj.Initialize(TestDataFactory.ColorFillOutsideCanvas)); }
public void Throw_InvalidShapeException_When_NoCanvas() { //Arrange var mockConsoleBuffer = MockConsoleBuffer.Default(); mockConsoleBuffer.Setup(x => x.CanvasWidth).Returns(-1); mockConsoleBuffer.Setup(x => x.CanvasLength).Returns(-1); var colorFillObj = new ColorFill(mockConsoleBuffer.Object); //Assert Assert.Throws <InvalidShapeCreationException>(() => colorFillObj.Initialize(TestDataFactory.ColorFillInput)); }
/// <summary> /// Sirve como la función hash predeterminada. /// </summary> /// <returns>Código hash para el objeto actual.</returns> public override int GetHashCode() { int hash = 17; // Un número primo int prime = 31; // Otro número primo. hash = hash * prime + MetadataItemName.GetHashCode(); hash = hash * prime + PdfPageN.GetHashCode(); hash = hash * prime + IsLastPage.GetHashCode(); hash = hash * prime + ((PdfRectangle == null) ? 0 : PdfRectangle.GetHashCode()); hash = hash * prime + (RegexPattern ?? "").GetHashCode(); hash = hash * prime + Position.GetHashCode(); hash = hash * prime + (SourceTypeName ?? "").GetHashCode(); hash = hash * prime + ((ColorFill == null) ? 0 : ColorFill.GetHashCode()); hash = hash * prime + ((ColorStroke == null) ? 0 : ColorStroke.GetHashCode()); hash = hash * prime + ((FontSize == null) ? 0 : FontSize.GetHashCode()); hash = hash * prime + ((FontType == null) ? 0 : FontType.GetHashCode()); return(hash); }
public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Asterisk")); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")).Value = Name; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")).Value = Text; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Sign")).Value = Sign; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorLine")).Value = ColorLine.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Price")).Value = Price.ToString(CultureProvider.Common); if (DateStart.HasValue) { node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")).Value = DateStart.Value.ToString("ddMMyyyy HHmmss", CultureProvider.Common); } node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Shape")).Value = Shape.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Transparency")).Value = Transparency.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TransparencyText")).Value = TransparencyText.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Radius")).Value = Radius.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); }
public void Update(float deltaTime) { if (ColorFillList.Count != 0) { filldelay -= deltaTime; if (filldelay < 0) { filldelay = 0.05f; ColorFill pItem = ColorFillList[0]; pointObj[pItem.byIndex].material = pItem.FillMaterial; Utility.ListRemoveAt(ColorFillList, 0); } } if (isPointRotate) { m_pointTrans.localRotation = Quaternion.AngleAxis(pointAngle, Vector3.down); pointAngle += deltaTime * pointSpeed; if (pointAngle < 360) { pointSpeed += deltaTime * 80; } else if (pointAngle >= 720) { pointAxis = pointSpeed * pointSpeed / (30 * pointIndex + 1440); pointAngle = 720; m_StopSpeed = pointSpeed; m_StopAngle = pointAngle; rotateCount = 0; isPointRotate = false; isPointStop = true; } } if (isPointStop) { rotateCount += deltaTime; pointSpeed -= pointAxis * deltaTime; if (rotateCount >= m_StopSpeed / pointAxis) { rotateCount = m_StopSpeed / pointAxis; isPointResult = true; isPointStop = false; } m_StopAngle = pointAngle + m_StopSpeed * rotateCount - pointAxis * (rotateCount * rotateCount) / 2f; m_pointTrans.localRotation = Quaternion.AngleAxis(m_StopAngle, Vector3.down); } if (isRotate) { m_AnimalTrans.localRotation = Quaternion.AngleAxis(angle, Vector3.up); angle += deltaTime * speed; if (angle < 360) { if (speed < 220) { speed += deltaTime * 90; } } else if (angle >= 720) { axis = speed * speed / (30 * index + 1440); angle = 720; m_StopSpeed2 = speed; m_StopAngle2 = angle; rotateCount2 = 0; isRotate = false; isStop = true; } } if (isStop) { rotateCount2 += deltaTime; speed -= axis * deltaTime; if (rotateCount2 >= m_StopSpeed2 / axis) { rotateCount2 = m_StopSpeed2 / axis; isResult = true; isStop = false; } m_StopAngle2 = angle + m_StopSpeed2 * rotateCount2 - axis * (rotateCount2 * rotateCount2) / 2f; m_AnimalTrans.localRotation = Quaternion.AngleAxis(m_StopAngle2, Vector3.up); } if (isResult && isPointResult) { areaAnim.SetBool("isAreaClose", false); areaAnim.SetBool("isAreaOpen", true); cameraAnim.SetBool("isCameraBack", false); cameraAnim.SetBool("isCameraFront", true); } }
internal override void Generate() { // Add control to dialog UpdateLayout(); DXControl = _groupBox = Parent.DialogRender.AddGroupBox(0, EffectiveLocation.X, EffectiveLocation.Y, EffectiveSize.Width, EffectiveSize.Height, ColorBorder.ToColorValue(), ColorFill.ToColorValue()); ControlModel.IsVisible = IsVisible; ControlModel.IsEnabled = IsEnabled; // Setup event hooks SetupMouseEvents(); }
/// <summary> /// Determina si el objeto especificado es igual al objeto actual. /// </summary> /// <param name="obj">Objeto que se va a comparar con el objeto actual.</param> /// <returns>Es true si el objeto especificado es igual al objeto actual; /// en caso contrario, es false.</returns> public override bool Equals(object obj) { PdfTagPattern input = (obj as PdfTagPattern); if (input == null) { throw new ArgumentException("Parámetro de tipo incorrecto."); } bool equalsTextString = false; bool equalsRectangle = false; if (input.SourceTypeName.Equals("TextStringInfos")) // Comprobamos si las propiedades de los textString coinciden { if (FontSize != null && input.FontSize != null && ColorFill != null && input.ColorFill != null && ColorStroke != null && input.ColorStroke != null && FontType != null && input.FontType != null && TsType != null && input.TsType != null) { if (ColorFill.Equals(input.ColorFill) && ColorStroke.Equals(input.ColorStroke) && FontSize.Equals(input.FontSize) && FontType.Equals(input.FontType) && TsType.Equals(input.TsType)) { if ((TsType.Equals("X") || TsType.Equals("Y")) && TsCoordinate.Equals(input.TsCoordinate)) { equalsTextString = true; } else if (TsType.Equals("NA")) { equalsTextString = true; } } } } else { equalsTextString = true; } if (PdfRectangle != null && input.PdfRectangle != null) // Comprobamos si el rectángulo coincide && FontType==null { equalsRectangle = PdfRectangle.Equals(input.PdfRectangle); } else { equalsRectangle = true; } return((MetadataItemName == input.MetadataItemName && PdfPageN == input.PdfPageN && IsLastPage == input.IsLastPage && equalsRectangle && RegexPattern == input.RegexPattern && Position == input.Position && SourceTypeName == input.SourceTypeName) && equalsTextString); }
public void SaveInXML(XmlElement parentNode, CandleChartControl owner) { var node = parentNode.AppendChild(parentNode.OwnerDocument.CreateElement("Comment")); var attrName = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Name")); attrName.Value = Name; var attrText = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Text")); attrText.Value = Text; var attrColor = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("Color")); attrColor.Value = color.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorText")).Value = ColorText.ToArgb().ToString(); var attrPivotPrice = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotPrice")); attrPivotPrice.Value = PivotPrice.ToString(CultureProvider.Common); var attrPivotTime = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("PivotTime")); attrPivotTime.Value = owner.chart.StockSeries.GetCandleOpenTimeByIndex((int)Math.Round(PivotIndex)).ToString( "ddMMyyyy HHmmss", CultureProvider.Common); var attrArrowLength = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ArrowLength")); attrArrowLength.Value = ArrowLength.ToString(); var attrArrowAngle = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ArrowAngle")); attrArrowAngle.Value = ArrowAngle.ToString(CultureProvider.Common); var attrHideArrow = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("HideArrow")); attrHideArrow.Value = HideArrow.ToString(); var attrHideBox = node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("HideBox")); attrHideBox.Value = HideBox.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("DrawFrame")).Value = DrawFrame.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("ColorFill")).Value = ColorFill.ToArgb().ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("FillTransparency")).Value = FillTransparency.ToString(); node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("TextCustom")).Value = TextCustom; node.Attributes.Append(parentNode.OwnerDocument.CreateAttribute("magic")).Value = Magic.ToString(); }