public void Invoke(long currentAddress, Width currentWidth) { if(updateContext != null) { updateContext(); } if((currentWidth & width) != 0) { action(currentAddress, currentWidth); } }
public CFIFlash(string fileName, int size, Width bits = Width.DoubleWord, bool nonPersistent = false) { switch(bits) { case Width.Byte: busWidth = 0; break; case Width.Word: busWidth = 1; break; case Width.DoubleWord: busWidth = 2; break; default: throw new ArgumentOutOfRangeException(); } CheckSize(size); this.size = size; // default erase block is whole flash or 256KB EraseBlockSize = Math.Min(size, DefaultEraseBlockSize); this.nonPersistent = nonPersistent; Init(fileName); CheckBuffer(0); }
public override void OnInitialize() { Width.Set(480, 0f); Height.Set(20f, 0f); Append(rewardText); }
/** * Record the vertex, uv, and color information for a single character. */ private void DrawChar(FontRenderer fr, char letter, float xPos, float yPos, Color letterColor, Script scriptType, Width fontWidth) { if (fontCharacters.ContainsKey(letter)) { Rect pos = new Rect(screenXOffset + xPos, screenYOffset - ((scriptType == Script.Superscript) ? yPos - fontLetterHalfHeight : yPos), (fontWidth == Width.Normal ? fontLetterWidth : (fontWidth == Width.Half ? fontLetterHalfWidth : fontLetterDoubleWidth)), (scriptType != Script.Normal) ? fontLetterHalfHeight : fontLetterHeight); fr.vertices.Add(new Vector3(pos.xMin, pos.yMin, 0.0f)); fr.vertices.Add(new Vector3(pos.xMax, pos.yMin, 0.0f)); fr.vertices.Add(new Vector3(pos.xMin, pos.yMax, 0.0f)); fr.vertices.Add(new Vector3(pos.xMax, pos.yMax, 0.0f)); Rect uv = fontCharacters[letter]; fr.uvs.Add(new Vector2(uv.xMin, uv.yMin)); fr.uvs.Add(new Vector2(uv.xMax, uv.yMin)); fr.uvs.Add(new Vector2(uv.xMin, uv.yMax)); fr.uvs.Add(new Vector2(uv.xMax, uv.yMax)); fr.colors.Add(letterColor); } else if (!characterWarnings.Contains(letter)) { JUtil.LogMessage(this, "Warning: Attempted to print a character \"{0}\" (u{1}) not present in the font.", letter.ToString(), letter); characterWarnings.Add(letter); } }
/// <summary> /// Gets the hash code for this Size /// </summary> /// <returns>Hash code value for this size</returns> public override int GetHashCode() { return(Width.GetHashCode() ^ Height.GetHashCode()); }
/// <inheritdoc /> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (Text != null) { hashCode = hashCode * 59 + Text.GetHashCode(); } if (TextAngle != null) { hashCode = hashCode * 59 + TextAngle.GetHashCode(); } if (Font != null) { hashCode = hashCode * 59 + Font.GetHashCode(); } if (Width != null) { hashCode = hashCode * 59 + Width.GetHashCode(); } if (Height != null) { hashCode = hashCode * 59 + Height.GetHashCode(); } if (Opacity != null) { hashCode = hashCode * 59 + Opacity.GetHashCode(); } if (Align != null) { hashCode = hashCode * 59 + Align.GetHashCode(); } if (VAlign != null) { hashCode = hashCode * 59 + VAlign.GetHashCode(); } if (BgColor != null) { hashCode = hashCode * 59 + BgColor.GetHashCode(); } if (BorderColor != null) { hashCode = hashCode * 59 + BorderColor.GetHashCode(); } if (BorderPad != null) { hashCode = hashCode * 59 + BorderPad.GetHashCode(); } if (BorderWidth != null) { hashCode = hashCode * 59 + BorderWidth.GetHashCode(); } if (ShowArrow != null) { hashCode = hashCode * 59 + ShowArrow.GetHashCode(); } if (ArrowColor != null) { hashCode = hashCode * 59 + ArrowColor.GetHashCode(); } if (Arrowhead != null) { hashCode = hashCode * 59 + Arrowhead.GetHashCode(); } if (StartArrowhead != null) { hashCode = hashCode * 59 + StartArrowhead.GetHashCode(); } if (ArrowSide != null) { hashCode = hashCode * 59 + ArrowSide.GetHashCode(); } if (ArrowSize != null) { hashCode = hashCode * 59 + ArrowSize.GetHashCode(); } if (StartArrowSize != null) { hashCode = hashCode * 59 + StartArrowSize.GetHashCode(); } if (ArrowWidth != null) { hashCode = hashCode * 59 + ArrowWidth.GetHashCode(); } if (Standoff != null) { hashCode = hashCode * 59 + Standoff.GetHashCode(); } if (StartStandoff != null) { hashCode = hashCode * 59 + StartStandoff.GetHashCode(); } if (Ax != null) { hashCode = hashCode * 59 + Ax.GetHashCode(); } if (Ay != null) { hashCode = hashCode * 59 + Ay.GetHashCode(); } if (AXref != null) { hashCode = hashCode * 59 + AXref.GetHashCode(); } if (AyRef != null) { hashCode = hashCode * 59 + AyRef.GetHashCode(); } if (XRef != null) { hashCode = hashCode * 59 + XRef.GetHashCode(); } if (X != null) { hashCode = hashCode * 59 + X.GetHashCode(); } if (XAnchor != null) { hashCode = hashCode * 59 + XAnchor.GetHashCode(); } if (XShift != null) { hashCode = hashCode * 59 + XShift.GetHashCode(); } if (YRef != null) { hashCode = hashCode * 59 + YRef.GetHashCode(); } if (Y != null) { hashCode = hashCode * 59 + Y.GetHashCode(); } if (YAnchor != null) { hashCode = hashCode * 59 + YAnchor.GetHashCode(); } if (YShift != null) { hashCode = hashCode * 59 + YShift.GetHashCode(); } if (ClickToShow != null) { hashCode = hashCode * 59 + ClickToShow.GetHashCode(); } if (XClick != null) { hashCode = hashCode * 59 + XClick.GetHashCode(); } if (YClick != null) { hashCode = hashCode * 59 + YClick.GetHashCode(); } if (HoverText != null) { hashCode = hashCode * 59 + HoverText.GetHashCode(); } if (HoverLabel != null) { hashCode = hashCode * 59 + HoverLabel.GetHashCode(); } if (CaptureEvents != null) { hashCode = hashCode * 59 + CaptureEvents.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (TemplateItemName != null) { hashCode = hashCode * 59 + TemplateItemName.GetHashCode(); } return(hashCode); } }
public UISlicedImage(Asset <Texture2D> texture) { _texture = texture; Width.Set(_texture.Width(), 0f); Height.Set(_texture.Height(), 0f); }
/// <summary> /// <para>Returns a nicely formatted string for this Rect.</para> /// </summary> /// <param name="format"></param> public string ToString(string format) => $"(x:{x.ToString(format)}, y:{y.ToString(format)}, z:{z.ToString(format)}, width:{Width.ToString(format)}, height:{Height.ToString(format)}, depth:{Depth.ToString(format)})";
public override int GetHashCode() { return(Width.GetHashCode() ^ (Color == null ? 0 : Color.GetHashCode())); }
protected override void Execute(CodeActivityContext context) { var el = Element.Get(context); if (el == null) { throw new ArgumentException("element cannot be null"); } var screen = Screen.Get(context); var x = X.Get(context); var y = Y.Get(context); var width = Width.Get(context); var height = Height.Get(context); var animatemove = AnimateMove.Get(context); var windowstate = WindowState.Get(context); if (width <= 30 || height <= 10) { } else { var allScreens = System.Windows.Forms.Screen.AllScreens.ToList(); if (screen < 0) { Log.Warning("screen cannot be below 0, using screen 0"); screen = 0; } if (screen >= allScreens.Count) { Log.Warning("screen " + screen + " does not exists, using " + (allScreens.Count - 1) + " instead"); screen = allScreens.Count - 1; } x += allScreens[screen].WorkingArea.X; y += allScreens[screen].WorkingArea.Y; var _window = ((UIElement)el).GetWindow(); var window = new UIElement(_window); if (_window.Properties.NativeWindowHandle.IsSupported) { GenericTools.Restore(_window.Properties.NativeWindowHandle.Value); } if (animatemove) { window.MoveWindowTo(x, y, width, height); } if (!animatemove) { window.SetWindowSize(width, height); window.SetWindowPosition(x, y); } if (!string.IsNullOrEmpty(windowstate) && _window.Properties.NativeWindowHandle.IsSupported) { switch (windowstate) { case "Normal": GenericTools.Restore(_window.Properties.NativeWindowHandle.Value); break; case "Minimized": GenericTools.Minimize(_window.Properties.NativeWindowHandle.Value); break; case "Maximized": GenericTools.Maximized(_window.Properties.NativeWindowHandle.Value); break; } } } }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Visible != null) { hashCode = hashCode * 59 + Visible.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Symmetric != null) { hashCode = hashCode * 59 + Symmetric.GetHashCode(); } if (Array != null) { hashCode = hashCode * 59 + Array.GetHashCode(); } if (ArrayMinus != null) { hashCode = hashCode * 59 + ArrayMinus.GetHashCode(); } if (Value != null) { hashCode = hashCode * 59 + Value.GetHashCode(); } if (ValueMinus != null) { hashCode = hashCode * 59 + ValueMinus.GetHashCode(); } if (TraceRef != null) { hashCode = hashCode * 59 + TraceRef.GetHashCode(); } if (TraceRefMinus != null) { hashCode = hashCode * 59 + TraceRefMinus.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (Thickness != null) { hashCode = hashCode * 59 + Thickness.GetHashCode(); } if (Width != null) { hashCode = hashCode * 59 + Width.GetHashCode(); } if (ArraySrc != null) { hashCode = hashCode * 59 + ArraySrc.GetHashCode(); } if (ArrayMinusSrc != null) { hashCode = hashCode * 59 + ArrayMinusSrc.GetHashCode(); } return(hashCode); } }
public override void WriteInitializationScript(System.IO.TextWriter writer) { var options = new Dictionary <string, object>(Events); var positionOptions = new Dictionary <string, object>(); if (Position.Bottom != 20) { positionOptions.Add("bottom", Position.Bottom); } if (Position.Right != 20) { positionOptions.Add("right", Position.Right); } if (Position.Top != int.MinValue) { positionOptions.Add("top", Position.Top); } if (Position.Left != int.MinValue) { positionOptions.Add("left", Position.Left); } if (!Position.Pinned) { positionOptions.Add("pinned", Position.Pinned); } if (positionOptions.Count > 0) { options.Add("position", positionOptions); } if (Stacking != NotificationStackingSettings.Default) { options["stacking"] = Stacking; } if (!HideOnClick) { options["hideOnClick"] = HideOnClick; } if (Button) { options["button"] = Button; } if (AllowHideAfter > 0) { options["allowHideAfter"] = AllowHideAfter; } if (AutoHideAfter != 5000) { options["autoHideAfter"] = AutoHideAfter; } if (AppendTo.HasValue()) { options["appendTo"] = AppendTo; } if (Width.HasValue()) { options["width"] = Width; } if (Height.HasValue()) { options["height"] = Height; } var animation = Animation.ToJson(); if (animation.Any()) { if (animation["animation"] is bool) { options["animation"] = false; } else { options["animation"] = animation["animation"]; } } if (Templates.Any()) { options["templates"] = Templates.Select(t => t.Serialize()); } writer.Write(Initializer.Initialize(Selector, "Notification", options)); base.WriteInitializationScript(writer); }
public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (Show != null) { hashCode = hashCode * 59 + Show.GetHashCode(); } if (Start != null) { hashCode = hashCode * 59 + Start.GetHashCode(); } if (End != null) { hashCode = hashCode * 59 + End.GetHashCode(); } if (Size != null) { hashCode = hashCode * 59 + Size.GetHashCode(); } if (Project != null) { hashCode = hashCode * 59 + Project.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (UseColorMap != null) { hashCode = hashCode * 59 + UseColorMap.GetHashCode(); } if (Width != null) { hashCode = hashCode * 59 + Width.GetHashCode(); } if (Highlight != null) { hashCode = hashCode * 59 + Highlight.GetHashCode(); } if (HighlightColor != null) { hashCode = hashCode * 59 + HighlightColor.GetHashCode(); } if (HighlightWidth != null) { hashCode = hashCode * 59 + HighlightWidth.GetHashCode(); } return(hashCode); } }
public override string ToString() { return(Width.ToString() + " x " + Height.ToString() + String.Format(" {0:0.00} fps ", 10000000.0 / Fps) + Standard); }
public XElement ToXml() { return(new XElement("dummy", new XElement(GraphMLFormat.xmlnsY + "ShapeNode", new XElement(GraphMLFormat.xmlnsY + "Geometry", new XAttribute("x", X.ToString(CultureInfo.InvariantCulture)), new XAttribute("y", Y.ToString(CultureInfo.InvariantCulture)), new XAttribute("width", Width.ToString(CultureInfo.InvariantCulture)), new XAttribute("height", Height.ToString(CultureInfo.InvariantCulture))), new XElement(GraphMLFormat.xmlnsY + "Shape", new XAttribute("type", ShapeToGraphML(Shape)))))); }
public BusHookHandler(Action<long, Width> action, Width width, Action updateContext) { this.action = action; this.width = width; this.updateContext = updateContext; }
public void WriteXml(XmlWriter writer) { // Save info here writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteStartElement("Rooms"); foreach (Room r in rooms) { if (GetOutsideRoom() == r) { // Skip the outside room. Alternatively, should SetupWorld be changed to not create one? continue; } writer.WriteStartElement("Room"); r.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("Tiles"); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { if (tiles[x, y].Type != TileType.Empty) { writer.WriteStartElement("Tile"); tiles[x, y].WriteXml(writer); writer.WriteEndElement(); } } } writer.WriteEndElement(); writer.WriteStartElement("Inventories"); foreach (string objectType in inventoryManager.inventories.Keys) { foreach (Inventory inv in inventoryManager.inventories[objectType]) { // If we don't have a tile, that means this is in a character's inventory (or some other non-tile location // which means we shouldn't save that Inventory here, the character will take care of saving and loading // the inventory properly. if (inv.tile != null) { writer.WriteStartElement("Inventory"); inv.WriteXml(writer); writer.WriteEndElement(); } } } writer.WriteEndElement(); writer.WriteStartElement("Furnitures"); foreach (Furniture furn in furnitures) { writer.WriteStartElement("Furniture"); furn.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("Characters"); foreach (Character c in characters) { writer.WriteStartElement("Character"); c.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteElementString("Skybox", skybox.name); writer.WriteStartElement("Wallet"); foreach (Currency currency in Wallet.Currencies.Values) { writer.WriteStartElement("Currency"); currency.WriteXml(writer); writer.WriteEndElement(); } writer.WriteEndElement(); Scheduler.Scheduler.Current.WriteXml(writer); }
/// <inheritdoc/> public override int GetHashCode() => X.GetHashCode() * 397 ^ Y.GetHashCode() * 397 ^ Width.GetHashCode() * 397 ^ Height.GetHashCode() * 397;
/// <summary> /// Реализация метода Draw из абстрактного класса DrawTool. Имитирует рисование квадрата. /// </summary> /// <param name="ToolsOutputHandler">Контроллер вывода данных.</param> public override void Draw(OutputHandler ToolsOutputHandler) { // По средствам данного контроллера происходит отвязка данного класса от конкретной реализации вывода данных. ToolsOutputHandler.PrintLine("Рисуем кистью, Цвет: " + Color + " Размер: " + Height.ToString() + "x" + Width.ToString()); }
bool kakuninClose() { if (rec.rfu != null && bool.Parse(config.get("IsConfirmCloseMsgBox"))) { var _m = (rec.rfu.isPlayOnlyMode) ? "視聴" : "録画"; DialogResult res = MessageBox.Show(_m + "中ですが終了しますか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (res == DialogResult.No) { return(false); } } try{ util.debugWriteLine("width " + Width.ToString() + " height " + Height.ToString() + " restore width " + RestoreBounds.Width.ToString() + " restore height " + RestoreBounds.Height.ToString()); if (originalSize != Size.Empty) { config.set("Width", originalSize.Width.ToString()); config.set("Height", originalSize.Height.ToString()); config.set("X", Location.X.ToString()); config.set("Y", Location.Y.ToString()); } else { if (this.WindowState == FormWindowState.Normal) { config.set("Width", Width.ToString()); config.set("Height", Height.ToString()); config.set("X", Location.X.ToString()); config.set("Y", Location.Y.ToString()); } else { config.set("Width", RestoreBounds.Width.ToString()); config.set("Height", RestoreBounds.Height.ToString()); config.set("X", RestoreBounds.X.ToString()); config.set("Y", RestoreBounds.Y.ToString()); } } //MessageBox.Show("o " + originalSize + " " + this.WindowState + " l " + Location + " " + Width + " " + Height + " r " + RestoreBounds.X + " " + RestoreBounds.Y + " " + RestoreBounds.Width + " " + RestoreBounds.Height + " c " + config.get("X") + " " + config.get("Y")); } catch (Exception e) { util.debugWriteLine(e.Message + " " + e.StackTrace); } player.stopPlaying(true, true); try { if (rec != null && rec.rfu != null && rec.rfu.h5r != null && rec.rfu.h5r.wsr != null) { var _r = rec.rfu.h5r.wsr; rec.stopRecording(rec.rfu.isPlayOnlyMode); for (var i = 0; i < 100; i++) { // util.debugWriteLine("close rec commentSW " + i); if (_r.commentSW == null) { break; } Thread.Sleep(100); } util.debugWriteLine("end close sw"); /* * _r.isRetry = false; * _r.rec.isRetry = false; * _r.rec.isEndProgram = true; * _r.isEndProgram = true; * * Task.Run(() => { * _r.stopRecording(); * if (_r.rec != null) _r.rec.waitForEnd(); * for (var i = 0; i < 1000 && rec.rfu != null; i++) { * util.debugWriteLine("wait rec close " + i); * Thread.Sleep(100); * } * util.debugWriteLine("wait rec close end"); * }).Wait(); */ } } catch (Exception e) { util.debugWriteLine(e.Message + e.Source + e.StackTrace + e.TargetSite); } return(true); }
private void DrawChar(char letter, float x, float y, Color letterColor, Script scriptType, Width fontWidth) { if (fontCharacters.ContainsKey(letter)) { // This is complicated. // The destination rectangle has coordinates given in pixels, from top left corner of the texture. // The source rectangle has coordinates in normalised texture coordinates (!) from bottom left corner of the texture! // And without the LoadPixelMatrix, DrawTexture produces nonsense anyway. Graphics.DrawTexture( new Rect(x, (scriptType == Script.Subscript) ? y + fontLetterHalfHeight : y, (fontWidth == Width.Normal ? fontLetterWidth : (fontWidth == Width.Half ? fontLetterHalfWidth : fontLetterDoubleWidth)), (scriptType != Script.Normal) ? fontLetterHalfHeight : fontLetterHeight), fontTexture[fontTextureIndex], fontCharacters[letter], 0, 0, 0, 0, letterColor ); } else { if (!characterWarnings[letter]) { JUtil.LogMessage(this, "Warning: Attempted to print a character \"{0}\" (u{1}) not present in the font.", letter.ToString(), letter); characterWarnings[letter] = true; } } }
private long maxMemory; //maximum memory Terraria could allocate before crashing if it was the only process on the system public UIMemoryBar() { Width.Set(0f, 1f); Height.Set(20f, 0f); memoryBarItems = new List <MemoryBarItem>(); }
/// <inheritdoc cref="object.GetHashCode"/> public override int GetHashCode() => 859600377 ^ Width.GetHashCode() ^ Height.GetHashCode();
public override int GetHashCode() { return(X.GetHashCode() + Y.GetHashCode() + Width.GetHashCode() + Height.GetHashCode()); }
public HeaderElement(string header) { this.header = header; Width.Set(0f, 1f); Height.Set(30f, 0f); }
//------------------------------------------------------------------------ private void frmMain_FormClosing(object sender, FormClosingEventArgs e) { IDockContent[] docs = dockPanel.DocumentsToArray(); for (int i = 0; i < docs.Length; i++) { if (((frmSource)docs[i]).AbortClose()) { e.Cancel = true; return; } } if (WindowState == FormWindowState.Maximized) { Config.SetValue("Window_Maximized", "true", true); } else { Config.SetValue("Window_Left", Left.ToString(), true); Config.SetValue("Window_Top", Top.ToString(), true); Config.SetValue("Window_Width", Width.ToString(), true); Config.SetValue("Window_Height", Height.ToString(), true); Config.SetValue("Window_Maximized", "false", true); } if (Explorer.DockState.ToString().Substring(0, 4) == "Dock") { string position = Explorer.DockState.ToString(); Config.SetValue("Explorer_State", position, true); if (position.Contains("Left")) { Config.SetValue("Explorer_Size", Explorer.Width.ToString(), true); } else if (position.Contains("Right")) { Config.SetValue("Explorer_Size", Explorer.Width.ToString(), true); } else if (position.Contains("Top")) { Config.SetValue("Explorer_Size", Explorer.Height.ToString(), true); } else if (position.Contains("Bottom")) { Config.SetValue("Explorer_Size", Explorer.Height.ToString(), true); } } if (Errors.DockState.ToString().Substring(0, 4) == "Dock") { string position = Errors.DockState.ToString(); Config.SetValue("Errors_State", position, true); if (position.Contains("Left")) { Config.SetValue("Errors_Size", Errors.Width.ToString(), true); } else if (position.Contains("Right")) { Config.SetValue("Errors_Size", Errors.Width.ToString(), true); } else if (position.Contains("Top")) { Config.SetValue("Errors_Size", Errors.Height.ToString(), true); } else if (position.Contains("Bottom")) { Config.SetValue("Errors_Size", Errors.Height.ToString(), true); } } Config.Save(Application.StartupPath + "\\config.xml"); Util.DisconnectAll(); }
public ConfigElement() { Width.Set(0f, 1f); Height.Set(30f, 0f); }
/// <inheritdoc /> public bool Equals([AllowNull] Annotation other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Visible == other.Visible || Visible != null && Visible.Equals(other.Visible) ) && ( Text == other.Text || Text != null && Text.Equals(other.Text) ) && ( TextAngle == other.TextAngle || TextAngle != null && TextAngle.Equals(other.TextAngle) ) && ( Font == other.Font || Font != null && Font.Equals(other.Font) ) && ( Width == other.Width || Width != null && Width.Equals(other.Width) ) && ( Height == other.Height || Height != null && Height.Equals(other.Height) ) && ( Opacity == other.Opacity || Opacity != null && Opacity.Equals(other.Opacity) ) && ( Align == other.Align || Align != null && Align.Equals(other.Align) ) && ( VAlign == other.VAlign || VAlign != null && VAlign.Equals(other.VAlign) ) && ( BgColor == other.BgColor || BgColor != null && BgColor.Equals(other.BgColor) ) && ( BorderColor == other.BorderColor || BorderColor != null && BorderColor.Equals(other.BorderColor) ) && ( BorderPad == other.BorderPad || BorderPad != null && BorderPad.Equals(other.BorderPad) ) && ( BorderWidth == other.BorderWidth || BorderWidth != null && BorderWidth.Equals(other.BorderWidth) ) && ( ShowArrow == other.ShowArrow || ShowArrow != null && ShowArrow.Equals(other.ShowArrow) ) && ( ArrowColor == other.ArrowColor || ArrowColor != null && ArrowColor.Equals(other.ArrowColor) ) && ( Arrowhead == other.Arrowhead || Arrowhead != null && Arrowhead.Equals(other.Arrowhead) ) && ( StartArrowhead == other.StartArrowhead || StartArrowhead != null && StartArrowhead.Equals(other.StartArrowhead) ) && ( ArrowSide == other.ArrowSide || ArrowSide != null && ArrowSide.Equals(other.ArrowSide) ) && ( ArrowSize == other.ArrowSize || ArrowSize != null && ArrowSize.Equals(other.ArrowSize) ) && ( StartArrowSize == other.StartArrowSize || StartArrowSize != null && StartArrowSize.Equals(other.StartArrowSize) ) && ( ArrowWidth == other.ArrowWidth || ArrowWidth != null && ArrowWidth.Equals(other.ArrowWidth) ) && ( Standoff == other.Standoff || Standoff != null && Standoff.Equals(other.Standoff) ) && ( StartStandoff == other.StartStandoff || StartStandoff != null && StartStandoff.Equals(other.StartStandoff) ) && ( Ax == other.Ax || Ax != null && Ax.Equals(other.Ax) ) && ( Ay == other.Ay || Ay != null && Ay.Equals(other.Ay) ) && ( AXref == other.AXref || AXref != null && AXref.Equals(other.AXref) ) && ( AyRef == other.AyRef || AyRef != null && AyRef.Equals(other.AyRef) ) && ( XRef == other.XRef || XRef != null && XRef.Equals(other.XRef) ) && ( X == other.X || X != null && X.Equals(other.X) ) && ( XAnchor == other.XAnchor || XAnchor != null && XAnchor.Equals(other.XAnchor) ) && ( XShift == other.XShift || XShift != null && XShift.Equals(other.XShift) ) && ( YRef == other.YRef || YRef != null && YRef.Equals(other.YRef) ) && ( Y == other.Y || Y != null && Y.Equals(other.Y) ) && ( YAnchor == other.YAnchor || YAnchor != null && YAnchor.Equals(other.YAnchor) ) && ( YShift == other.YShift || YShift != null && YShift.Equals(other.YShift) ) && ( ClickToShow == other.ClickToShow || ClickToShow != null && ClickToShow.Equals(other.ClickToShow) ) && ( XClick == other.XClick || XClick != null && XClick.Equals(other.XClick) ) && ( YClick == other.YClick || YClick != null && YClick.Equals(other.YClick) ) && ( HoverText == other.HoverText || HoverText != null && HoverText.Equals(other.HoverText) ) && ( HoverLabel == other.HoverLabel || HoverLabel != null && HoverLabel.Equals(other.HoverLabel) ) && ( CaptureEvents == other.CaptureEvents || CaptureEvents != null && CaptureEvents.Equals(other.CaptureEvents) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( TemplateItemName == other.TemplateItemName || TemplateItemName != null && TemplateItemName.Equals(other.TemplateItemName) )); }
protected bool Equals(ColumnSettings other) { return(string.Equals(ColumnName, other.ColumnName) && Width.Equals(other.Width) && IsHidden.Equals(other.IsHidden)); }
public override string ToString() { return("{x=" + X.ToString(CultureInfo.CurrentCulture) + ",y=" + Y.ToString(CultureInfo.CurrentCulture) + ",Width=" + Width.ToString(CultureInfo.CurrentCulture) + ",Height=" + Height.ToString(CultureInfo.CurrentCulture) + "}"); }
public override string ToString() { var culture = CultureInfo.CurrentCulture; return($"{{ Left = {Left.ToString(culture)}, Top = {Top.ToString(culture)} , Right = {Right.ToString(culture)}, Bottom = {Bottom.ToString(culture)} }}, {{ Width: {Width.ToString(culture)}, Height: {Height.ToString(culture)} }}"); }
/// <summary> /// Compares the value of the current instance to the specified GeographicSize. /// </summary> /// <param name="value">A <strong>GeographicSize</strong> object to compare against.</param> /// <returns>A <strong>Boolean</strong>, <strong>True</strong> if the values of both objects are precisely the same.</returns> public bool Equals(GeographicSize value) { return(Width.Equals(value.Width) && Height.Equals(value.Height)); }
/// <summary> /// Renders the <see cref="SvgElement"/> and contents to the specified <see cref="Graphics"/> object. /// </summary> protected override void Render(ISvgRenderer renderer) { if (!Visible || !Displayable) { return; } if (Width.Value > 0.0f && Height.Value > 0.0f && this.Href != null) { var img = GetImage(this.Href); if (img != null) { RectangleF srcRect; var bmp = img as Image; var svg = img as SvgFragment; if (bmp != null) { srcRect = new RectangleF(0, 0, bmp.Width, bmp.Height); } else if (svg != null) { srcRect = new RectangleF(new PointF(0, 0), svg.GetDimensions()); } else { return; } var destClip = new RectangleF(this.Location.ToDeviceValue(renderer, this), new SizeF(Width.ToDeviceValue(renderer, UnitRenderingType.Horizontal, this), Height.ToDeviceValue(renderer, UnitRenderingType.Vertical, this))); RectangleF destRect = destClip; this.PushTransforms(renderer); renderer.SetClip(new Region(destClip), CombineMode.Intersect); this.SetClip(renderer); if (AspectRatio != null && AspectRatio.Align != SvgPreserveAspectRatio.none) { var fScaleX = destClip.Width / srcRect.Width; var fScaleY = destClip.Height / srcRect.Height; var xOffset = 0.0f; var yOffset = 0.0f; if (AspectRatio.Slice) { fScaleX = Math.Max(fScaleX, fScaleY); fScaleY = Math.Max(fScaleX, fScaleY); } else { fScaleX = Math.Min(fScaleX, fScaleY); fScaleY = Math.Min(fScaleX, fScaleY); } switch (AspectRatio.Align) { case SvgPreserveAspectRatio.xMinYMin: break; case SvgPreserveAspectRatio.xMidYMin: xOffset = (destClip.Width - srcRect.Width * fScaleX) / 2; break; case SvgPreserveAspectRatio.xMaxYMin: xOffset = (destClip.Width - srcRect.Width * fScaleX); break; case SvgPreserveAspectRatio.xMinYMid: yOffset = (destClip.Height - srcRect.Height * fScaleY) / 2; break; case SvgPreserveAspectRatio.xMidYMid: xOffset = (destClip.Width - srcRect.Width * fScaleX) / 2; yOffset = (destClip.Height - srcRect.Height * fScaleY) / 2; break; case SvgPreserveAspectRatio.xMaxYMid: xOffset = (destClip.Width - srcRect.Width * fScaleX); yOffset = (destClip.Height - srcRect.Height * fScaleY) / 2; break; case SvgPreserveAspectRatio.xMinYMax: yOffset = (destClip.Height - srcRect.Height * fScaleY); break; case SvgPreserveAspectRatio.xMidYMax: xOffset = (destClip.Width - srcRect.Width * fScaleX) / 2; yOffset = (destClip.Height - srcRect.Height * fScaleY); break; case SvgPreserveAspectRatio.xMaxYMax: xOffset = (destClip.Width - srcRect.Width * fScaleX); yOffset = (destClip.Height - srcRect.Height * fScaleY); break; } destRect = new RectangleF(destClip.X + xOffset, destClip.Y + yOffset, srcRect.Width * fScaleX, srcRect.Height * fScaleY); } if (bmp != null) { renderer.DrawImage(bmp, destRect, srcRect, GraphicsUnit.Pixel); bmp.Dispose(); } else if (svg != null) { var currOffset = new PointF(renderer.Transform.OffsetX, renderer.Transform.OffsetY); renderer.TranslateTransform(-currOffset.X, -currOffset.Y); renderer.ScaleTransform(destRect.Width / srcRect.Width, destRect.Height / srcRect.Height); renderer.TranslateTransform(currOffset.X + destRect.X, currOffset.Y + destRect.Y); renderer.SetBoundable(new GenericBoundable(srcRect)); svg.RenderElement(renderer); renderer.PopBoundable(); } this.ResetClip(renderer); this.PopTransforms(renderer); } // TODO: cache images... will need a shared context for this // TODO: support preserveAspectRatio, etc } }
private void AddHeaderCell(ITableHeader header, string text, Width width = null) { IText headerText; ITableCell cell = header.AddCell(); Color startColor = new Color(117, 117, 117); Color endColor = new Color(84, 84, 84); cell.Borders = bordersStyle; cell.Background = new Background(new LinearGradientBrush(startColor, endColor, 90)); cell.Alignment.Vertical = Alignment.Middle; if (width != null) { cell.Width = width; } headerText = cell.AddText(); headerText.Style.Font = headerFont; headerText.Style.Brush = Brushes.White; headerText.Alignment = TextAlignment.Center; headerText.AddContent(text); }
public override int GetHashCode() { return(Left.GetHashCode() ^ Top.GetHashCode() ^ Width.GetHashCode() ^ Height.GetHashCode()); }
protected override void Render(HtmlTextWriter writer) { try { DateTime tmpDate; try { tmpDate = this.SelectedDate == "" ? DateTime.Now : Convert.ToDateTime(SelectedDate); } catch (Exception ex) { tmpDate = DateTime.Now; } string temp = CssClass; CssClass = ""; if (temp == "") { temp = "ampicker"; } writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0"); writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString()); writer.RenderBeginTag(HtmlTextWriterTag.Table); writer.RenderBeginTag(HtmlTextWriterTag.Tr); if (Text != "") { writer.AddAttribute(HtmlTextWriterAttribute.Style, "white-space:nowrap"); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.Write(Text); writer.RenderEndTag(); } writer.AddAttribute(HtmlTextWriterAttribute.Width, Width.ToString()); writer.RenderBeginTag(HtmlTextWriterTag.Td); writer.AddAttribute("class", temp); writer.AddAttribute("id", ClientID); writer.AddAttribute("name", ClientID); writer.AddAttribute("onblur", "return window." + ClientID + ".onblur(this);"); writer.AddAttribute("onkeypress", "return window." + ClientID + ".onlyDateChars(event);"); //writer.AddAttribute("onkeydown", "return window." & Me.ClientID & ".KeyPress(event);") //writer.AddAttribute("onclick", "return window." & Me.ClientID & ".Click(event);showalert();") if (Enabled == false) { writer.AddAttribute("disabled", "disabled"); } if (ShowDateBox) { writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); } dtFI = Thread.CurrentThread.CurrentCulture.DateTimeFormat; if (!(string.IsNullOrEmpty(SelectedDate))) { DateTime dte = DateTime.Parse(SelectedDate); SelectedDate = dte.ToString(dtFI.ShortDatePattern + " " + dtFI.ShortTimePattern); } writer.AddAttribute("type", "hidden"); writer.AddAttribute("id", "hid_" + ClientID); writer.AddAttribute("name", "hid_" + ClientID); writer.AddAttribute("value", SelectedDate); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); writer.AddAttribute("id", "cal_" + ClientID); writer.AddAttribute("style", "display:none;position:absolute;"); writer.RenderBeginTag(HtmlTextWriterTag.Div); writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderBeginTag(HtmlTextWriterTag.Td); if (ImageUrl == string.Empty) { ImageUrl = Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.calendar.gif"); } if (Enabled) { writer.AddAttribute("src", ImageUrl); writer.AddAttribute("onclick", "window." + ClientID + ".Toggle(event);"); writer.AddAttribute("id", "img_" + ClientID); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); } writer.RenderEndTag(); writer.RenderEndTag(); writer.RenderEndTag(); var str = new StringBuilder(); str.Append("<script type=\"text/javascript\">"); cal = new System.Globalization.GregorianCalendar(); if (Thread.CurrentThread.CurrentCulture != null) { cal = Thread.CurrentThread.CurrentCulture.Calendar; } DateFormat = dtFI.ShortDatePattern; TimeFormat = dtFI.ShortTimePattern; str.Append("window." + ClientID + "=new asDatePicker('" + ClientID + "');"); str.Append("window." + ClientID + ".Locale='" + Context.Request.UserLanguages[0].Substring(0, 2).ToUpper() + "';"); str.Append("window." + ClientID + ".SelectedDate='" + SelectedDate + "';"); str.Append("window." + ClientID + ".Width='" + CalendarWidth + "';"); str.Append("window." + ClientID + ".Height='" + CalendarHeight + "';"); str.Append("window." + ClientID + ".DateFormat='" + dtFI.ShortDatePattern + "';"); str.Append("window." + ClientID + ".TimeFormat='" + dtFI.ShortTimePattern + "';"); str.Append("window." + ClientID + ".Year=" + tmpDate.Year + ";"); str.Append("window." + ClientID + ".Month=" + (tmpDate.Month - 1) + ";"); str.Append("window." + ClientID + ".Day=" + tmpDate.Day + ";"); str.Append("window." + ClientID + ".SelectedYear=" + tmpDate.Year + ";"); str.Append("window." + ClientID + ".SelectedMonth=" + (tmpDate.Month - 1) + ";"); str.Append("window." + ClientID + ".SelectedDay=" + tmpDate.Day + ";"); str.Append("window." + ClientID + ".ShowTime=" + ShowTime.ToString().ToLower() + ";"); str.Append("window." + ClientID + ".DefaultTime='" + DefaultTime + "';"); str.Append("window." + ClientID + ".CallbackFlag='" + CallbackFlag + "';"); if (!(string.IsNullOrEmpty(RelatedControl))) { Control ctl = Parent.FindControl(RelatedControl); if (ctl == null) { ctl = Page.FindControl(RelatedControl); } if (ctl == null) { RelatedControl = string.Empty; } else { RelatedControl = ctl.ClientID; } } str.Append("window." + ClientID + ".linkedControl='" + RelatedControl + "';"); if (IsEndDate) { str.Append("window." + ClientID + ".isEndDate=true;"); } else { str.Append("window." + ClientID + ".isEndDate=false;"); } string sTime = string.Empty; SelectedTime = tmpDate.ToString(TimeFormat); if (ShowTime) { if (SelectedTime != "12:00 AM") { sTime = SelectedTime; } if (TimeRequired) { str.Append("window." + ClientID + ".RequireTime=true;"); } else { str.Append("window." + ClientID + ".RequireTime=false;"); } } else { str.Append("window." + ClientID + ".RequireTime=false;"); } str.Append("window." + ClientID + ".SelectedTime='" + sTime + "';"); if (string.IsNullOrEmpty(ImgNext)) { str.Append("window." + ClientID + ".ImgNext='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_nextMonth.gif") + "';"); } else { str.Append("window." + ClientID + ".ImgNext='" + Page.ResolveUrl(ImgNext) + "';"); } if (string.IsNullOrEmpty(ImgPrev)) { str.Append("window." + ClientID + ".ImgPrev='" + Page.ClientScript.GetWebResourceUrl(GetType(), "DotNetNuke.Modules.ActiveForums.CustomControls.Resources.cal_prevMonth.gif") + "';"); } else { str.Append("window." + ClientID + ".ImgPrev='" + Page.ResolveUrl(ImgPrev) + "';"); } if (SelectedDate != "") { try { if (ShowTime == false && sTime == string.Empty) { str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ").formatDP('" + DateFormat + "','" + ClientID + "');"); str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + ",0,0,0,0);"); } else { str.Append("window." + ClientID + ".textbox.value=new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0).formatDP('" + DateFormat + " " + TimeFormat + "','" + ClientID + "');"); str.Append("window." + ClientID + ".dateSel = new Date(" + tmpDate.Year + "," + (tmpDate.Month - 1) + "," + tmpDate.Day + "," + tmpDate.Hour + "," + tmpDate.Minute + ",0);"); } } catch (Exception ex) { } } int xMonths = cal.GetMonthsInYear(cal.GetYear(tmpDate), cal.GetEra(tmpDate)); int currMonth = cal.GetMonth(tmpDate); int currYear = cal.GetYear(tmpDate); int currDay = cal.GetDayOfMonth(tmpDate); str.Append("window." + ClientID + ".MonthDays = new Array("); for (int i = 0; i < xMonths; i++) { str.Append(cal.GetDaysInMonth(currYear, i + 1)); if (i < (xMonths - 1)) { str.Append(","); } } str.Append(");"); str.AppendLine(); string[] mNames = dtFI.MonthNames; str.Append("window." + ClientID + ".MonthNames = new Array("); for (int i = 0; i < xMonths; i++) { str.Append("'" + mNames[i] + "'"); if (i < (xMonths - 1)) { str.Append(","); } } str.Append(");"); str.AppendLine(); str.Append("window." + ClientID + ".ShortMonthNames = new Array("); string[] mAbbr = dtFI.AbbreviatedMonthNames; for (int i = 0; i < xMonths; i++) { str.Append("'" + mAbbr[i] + "'"); if (i < (xMonths - 1)) { str.Append(","); } } str.Append(");"); str.AppendLine(); str.Append("window." + ClientID + ".ShortDayNames = new Array("); string[] dAbbr = dtFI.AbbreviatedDayNames; for (int i = 0; i <= 6; i++) { str.Append("'" + dAbbr[i] + "'"); if (i < 6) { str.Append(","); } } str.Append(");"); str.AppendLine(); str.Append("window." + ClientID + ".Class={"); str.Append("CssCalendarStyle:'" + CssCalendarStyle + "',"); str.Append("CssMonthStyle:'" + CssMonthStyle + "',"); str.Append("CssWeekendStyle:'" + CssWeekendStyle + "',"); str.Append("CssWeekdayStyle:'" + CssWeekdayStyle + "',"); str.Append("CssSelectedDayStyle:'" + CssSelectedDayStyle + "',"); str.Append("CssCurrentMonthDayStyle:'" + CssCurrentMonthDayStyle + "',"); str.Append("CssOtherMonthDayStyle:'" + CssOtherMonthDayStyle + "',"); str.Append("CssDayHeaderStyle:'" + CssDayHeaderStyle + "',"); str.Append("CssCurrentDayStyle:'" + CssCurrentDayStyle + "'};"); str.Append("window." + ClientID + ".selectedDate=window." + ClientID + ".textbox.value;"); str.Append("window." + ClientID + ".timeLabel='[RESX:Time]';"); str.Append("</script>"); writer.Write(str); } catch (Exception ex) { } }
public static void AddWatchpointHook(this SystemBus sysbus, long address, Width width, Access access, string pythonScript) { var engine = new WatchpointHookPythonEngine(sysbus, pythonScript); sysbus.AddWatchpointHook(address, width, access, true, engine.Hook); }