public override string ToString() { if (Winner == WColor.EMPTY) { return("DRAW"); } else { string ret = ""; if (Winner == WColor.WHITE) { ret = "W+"; } else { ret = "B+"; } if (Resign) { ret += "R"; } else { ret += Margin.ToString("0.0"); } return(ret); } }
protected override void FillStyleAttributes(System.Web.UI.CssStyleCollection attributes, System.Web.UI.IUrlResolutionService urlResolver) { if (!string.IsNullOrEmpty(Position)) { attributes[HtmlTextWriterStyle.Position] = Position; } if (!string.IsNullOrEmpty(Visibility)) { attributes[HtmlTextWriterStyle.Visibility] = Visibility; } if (!Left.IsEmpty) { attributes[HtmlTextWriterStyle.Left] = Left.ToString(); } if (!Top.IsEmpty) { attributes[HtmlTextWriterStyle.Top] = Top.ToString(); } if (!string.IsNullOrEmpty(Margin)) { attributes[HtmlTextWriterStyle.Margin] = Margin.ToString(); } if (!string.IsNullOrEmpty(Padding)) { attributes[HtmlTextWriterStyle.Padding] = Padding.ToString(); } if (!string.IsNullOrEmpty(ListStyle)) { attributes["list-style"] = ListStyle.ToString(); } if (!string.IsNullOrEmpty(Float)) { attributes["float"] = Float.ToString(); } if (!string.IsNullOrEmpty(Display)) { attributes[HtmlTextWriterStyle.Display] = Display.ToString(); } if (!string.IsNullOrEmpty(Cursor)) { attributes[HtmlTextWriterStyle.Cursor] = Cursor.ToString(); } base.FillStyleAttributes(attributes, urlResolver); string[] filter = new string[] { "left", "right", "top", "bottom", "width", "height", "margin-left", "margin-right", "margin-top", "margin-bottom" }; foreach (string f in filter) { if (!string.IsNullOrEmpty(attributes[f])) { attributes[f] = attributes[f].Replace(",", "."); } } }
public List <KeyValuePair <string, object> > Serialize() { var list = new List <KeyValuePair <string, object> > (); foreach (var animation in Animations) { list.Add(new KeyValuePair <string, object>("animations", animation.Serialize())); } list.Add(new KeyValuePair <string, object>("margin", Margin.ToString())); list.Add(new KeyValuePair <string, object>("extrude_borders", ExtrudeBorders.ToString())); list.Add(new KeyValuePair <string, object>("inner_padding", InnerPadding.ToString())); return(list); }
public override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer, System.Web.UI.WebControls.WebControl owner) { if (!string.IsNullOrEmpty(Position)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Position, Position); } if (!string.IsNullOrEmpty(Visibility)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Visibility, Visibility); } if (!Left.IsEmpty) { writer.AddStyleAttribute(HtmlTextWriterStyle.Left, Left.ToString()); } if (!Top.IsEmpty) { writer.AddStyleAttribute(HtmlTextWriterStyle.Top, Top.ToString()); } if (!string.IsNullOrEmpty(Margin)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, Margin.ToString()); } if (!string.IsNullOrEmpty(Padding)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, Padding.ToString()); } if (!string.IsNullOrEmpty(ListStyle)) { writer.AddStyleAttribute("list-style", ListStyle.ToString()); } if (!string.IsNullOrEmpty(Float)) { writer.AddStyleAttribute("float", Float.ToString()); } if (!string.IsNullOrEmpty(Display)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Display, Display.ToString()); } if (!string.IsNullOrEmpty(Cursor)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Cursor, Cursor.ToString()); } base.AddAttributesToRender(writer, owner); }
public void SaveTo(string filename) { var file = new IniFile(); file["PARAMETERS"]["WIDTH"] = Width.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["HEIGHT"] = Height.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["X_OFFSET"] = XOffset.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["Z_OFFSET"] = ZOffset.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["MARGIN"] = Margin.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["SCALE_FACTOR"] = ScaleFactor.ToString(CultureInfo.InvariantCulture); file["PARAMETERS"]["DRAWING_SIZE"] = DrawingSize.ToString(CultureInfo.InvariantCulture); file.Save(filename); }
public String ToJson() { var sb = new StringBuilder("{"); sb.Append($"orientation:'{Orientation.ToString().ToLowerInvariant()}',"); if (Margin != null) { sb.Append($"margin: '{Margin.ToString()}',"); } if (Zoom != null) { sb.Append($"zoom: '{Zoom.ToString()}',"); } sb.RemoveTailComma(); sb.Append("}"); return(sb.ToString()); }
public string ToString(Theme t) { var a = new StylesheetStringBuilder(); a.AppendAttribute("background-color", t.ResolveColor(BackgroundColor)); a.AppendAttribute("background-image", BackgroundImage); a.AppendAttribute("width", Width); a.AppendAttribute("height", Height); if (null != Margin && !Margin.IsEmpty) { a.AppendAttribute("margin", Margin.ToString()); } if (null != Padding && !Padding.IsEmpty) { a.AppendAttribute("padding", Padding.ToString()); } if (ThemeBorder.AreSame(BorderTop, BorderBottom, BorderLeft, BorderRight)) { a.AppendAttribute("border", BorderTop.ToString(t)); } else { if (null != BorderTop && !BorderTop.IsEmpty) { a.AppendAttribute("border-top", BorderTop.ToString(t)); } if (null != BorderBottom && !BorderBottom.IsEmpty) { a.AppendAttribute("border-bottom", BorderBottom.ToString(t)); } if (null != BorderLeft && !BorderLeft.IsEmpty) { a.AppendAttribute("border-left", BorderLeft.ToString(t)); } if (null != BorderRight && !BorderRight.IsEmpty) { a.AppendAttribute("border-right", BorderRight.ToString(t)); } } return(a.ToString()); }
/// <summary> /// Creates XML for a given style /// </summary> /// <returns>Style in XML format</returns> public string ToXML() { StringBuilder result = new StringBuilder(); result.Append("<Style ID=\"" + ID + "\" FontFamily=\"" + Family + "\" FontSize=\"" + Size.ToString() + "\""); if (Style == FontStyles.Italic) { result.Append(" FontStyle=\"Italic\""); } if (Weight == FontWeights.Bold) { result.Append(" FontWeight=\"Bold\""); } if (Decorations == TextDecorations.Underline) { result.Append(" Decoration=\"Underline\""); } result.Append(Serialize.Brush(Foreground, " Foreground", false)); if (Background is SolidColorBrush) { if (((SolidColorBrush)Background).Color.A > 0) { result.Append(Serialize.Brush(Background, " Background", false)); } } result.Append(Serialize.Brush(BorderBrush, " BorderBrush", false)); result.Append(Serialize.Brush(ShadowBrush, " ShadowBrush", false)); result.Append(" Alignment=\"" + Alignment.ToString() + "\""); if (VerticalAlignment != VerticalAlignment.Bottom) { result.Append(" VerticalAlignment=\"" + VerticalAlignment.ToString() + "\""); } switch (Special) { case RichTextSpecialFormatting.Subscript: result.Append(" Special=\"Subscript\""); break; case RichTextSpecialFormatting.Superscript: result.Append(" Special=\"Superscript\""); break; default: break; } switch (Effect) { case TextBlockPlusEffect.Strike: result.Append(" Effect=\"Strike\""); break; default: break; } switch (BorderType) { case BorderEffect.Solid: result.Append(" Border=\"Solid\""); break; case BorderEffect.Dotted: result.Append(" Border=\"Dotted\""); break; case BorderEffect.Dashed: result.Append(" Border=\"Dashed\""); break; default: break; } switch (Shadow) { case ShadowEffect.Slight: result.Append(" Shadow=\"Slight\""); break; case ShadowEffect.Normal: result.Append(" Shadow=\"Normal\""); break; default: break; } if (Margin.Bottom != 0 || Margin.Left != 0 | Margin.Right != 0 || Margin.Top != 0) { result.Append(" Margin=\"" + Margin.ToString() + "\""); } result.Append(" />\r"); return(result.ToString()); }
public static string ToDescriptionString(this Margin val) { var attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false); return(attributes.Length > 0 ? attributes[0].Description : string.Empty); }
public virtual void WriteXml(System.Xml.XmlWriter writer) { //if (!string.IsNullOrWhiteSpace(Title)) // writer.WriteAttributeString("Title", Title); //if (IconSource != null) // writer.WriteAttributeString("IconSource", IconSource.ToString()); //if (IsSelected) // writer.WriteAttributeString("IsSelected", IsSelected.ToString()); //if (IsLastFocusedDocument) // writer.WriteAttributeString("IsLastFocusedDocument", IsLastFocusedDocument.ToString()); if (!string.IsNullOrWhiteSpace(ContentId)) { writer.WriteAttributeString("ContentId", ContentId); } if (Margin != 0) { writer.WriteAttributeString("Margin", Margin.ToString()); } if (BorderThickness != 0) { writer.WriteAttributeString("BorderThickness", BorderThickness.ToString()); } if (BorderColor != Colors.Transparent) { writer.WriteAttributeString("BorderColor", BorderColor.ToString()); } if (BackgroundColor != Colors.Transparent) { writer.WriteAttributeString("BackgroundColor", BackgroundColor.ToString()); } //if (ToolTip != null && ToolTip is string) // if (!string.IsNullOrWhiteSpace((string)ToolTip)) // writer.WriteAttributeString("ToolTip", (string)ToolTip); //if (FloatingLeft != 0.0) // writer.WriteAttributeString("FloatingLeft", FloatingLeft.ToString(CultureInfo.InvariantCulture)); //if (FloatingTop != 0.0) // writer.WriteAttributeString("FloatingTop", FloatingTop.ToString(CultureInfo.InvariantCulture)); //if (FloatingWidth != 0.0) // writer.WriteAttributeString("FloatingWidth", FloatingWidth.ToString(CultureInfo.InvariantCulture)); //if (FloatingHeight != 0.0) // writer.WriteAttributeString("FloatingHeight", FloatingHeight.ToString(CultureInfo.InvariantCulture)); //if (IsMaximized) // writer.WriteAttributeString("IsMaximized", IsMaximized.ToString()); //if (!CanClose) // writer.WriteAttributeString("CanClose", CanClose.ToString()); //if (!CanFloat) // writer.WriteAttributeString("CanFloat", CanFloat.ToString()); //if (LastActivationTimeStamp != null) // writer.WriteAttributeString("LastActivationTimeStamp", LastActivationTimeStamp.Value.ToString(CultureInfo.InvariantCulture)); //if (_previousContainer != null) //{ // var paneSerializable = _previousContainer as ILayoutPaneSerializable; // if (paneSerializable != null) // { // writer.WriteAttributeString("PreviousContainerId", paneSerializable.Id); // writer.WriteAttributeString("PreviousContainerIndex", _previousContainerIndex.ToString()); // } //} }
public List <Tuple <string, string> > ToList() { var paramList = new List <Tuple <string, string> > { new Tuple <string, string>("startfreq", string.Format("{0}MHz", WMonitorUtile.ConvertFreqValue(StartFreqUnit, "mhz", StartFreq))), new Tuple <string, string>("stopfreq", string.Format("{0}MHz", WMonitorUtile.ConvertFreqValue(StopFreqUnit, "mhz", StopFreq))), new Tuple <string, string>("rbw", string.Format("{0}kHz", WMonitorUtile.ConvertFreqValue(RbwUnit, "khz", Rbw))), new Tuple <string, string>("polarization", RmtpDefaultCollection.PolarizationSource[Polarization].ToString()), new Tuple <string, string>("smoothmode", RmtpDefaultCollection.SmoothWaySource[SmoothMode].ToString()), new Tuple <string, string>("storage", Storage?"on":"off"), new Tuple <string, string>("gainmode", RmtpDefaultCollection.GainModeSource[GainMode].ToString()), }; if (RmtpDefaultCollection.SmoothWaySource[SmoothMode] != SmoothWay.none) { paramList.Add(new Tuple <string, string>("smoothparam", SmoothParam.ToString(CultureInfo.InvariantCulture))); } if (RmtpDefaultCollection.GainModeSource[GainMode] == Rmtp.GainMode.mgc) { paramList.Add(new Tuple <string, string>("gainparam", string.Format("{0}dBuV", GainParam))); } if (!IsStudy) { if (HasThreshold) { var tt = RmtpDefaultCollection.SignalSholdSource[ThresholdType].ToString(); string signalthreshold; if (tt == "horizontal") { signalthreshold = string.Format("{0}dBμV", SignalThreshold); paramList.Add(new Tuple <string, string>("thresholdtype", tt)); paramList.Add(new Tuple <string, string>("signalthreshold", signalthreshold)); } else if (tt == "background") { //自定义门限 paramList.Add(new Tuple <string, string>("thresholdtype", "custom")); paramList.Add(new Tuple <string, string>("thresholddesc", ThresholdDesc)); paramList.Add(new Tuple <string, string>("customthreshold", CustomThresholdValues)); } else if (tt == "noise") { paramList.Add(new Tuple <string, string>("thresholdtype", tt)); } if (tt != "horizontal") { paramList.Add(new Tuple <string, string>("margin", Margin.ToString(CultureInfo.InvariantCulture))); } } } if (ChannelizeBands.Count > 0) { var sb = new StringBuilder(); foreach (var cb in ChannelizeBands) { sb.AppendFormat("{0};", cb); } if (sb.Length > 0) { sb = sb.Remove(sb.Length - 1, 1); } paramList.Add(new Tuple <string, string>("channelizebands", sb.ToString())); } return(paramList); }
public List <Tuple <string, string> > ToTupleString() { var paramList = new List <Tuple <string, string> >(); paramList.Add(new Tuple <string, string>("startfreq", string.Format("{0}MHz", WMonitorUtile.ConvertFreqValue(StartFreqUnit, "mhz", StartFreq)))); paramList.Add(new Tuple <string, string>("stopfreq", string.Format("{0}MHz", WMonitorUtile.ConvertFreqValue(StopFreqUnit, "mhz", StopFreq)))); paramList.Add(new Tuple <string, string>("step", string.Format("{0}kHz", WMonitorUtile.ConvertFreqValue(StepUnit, "khz", Step)))); paramList.Add(new Tuple <string, string>("ifbw", string.Format("{0}kHz", WMonitorUtile.ConvertFreqValue(IfbwUnit, "khz", Ifbw)))); paramList.Add(new Tuple <string, string>("polarization", RmtpDefaultCollection.PolarizationSource[Polarization].ToString())); paramList.Add(new Tuple <string, string>("detector", RmtpDefaultCollection.DetectorSource[SmoothMode].ToString())); //paramList.Add(new Tuple<string, string>("storage", Storage ? "on" : "off")); paramList.Add(new Tuple <string, string>("storage", "on")); if (RmtpDefaultCollection.DetectorSource[SmoothMode] != Detector.fast && RmtpDefaultCollection.DetectorSource[SmoothMode] != Detector.qbk && RmtpDefaultCollection.DetectorSource[SmoothMode] != Detector.avg) { paramList.Add(new Tuple <string, string>("smoothparam", SmoothParam.ToString(CultureInfo.InvariantCulture))); } paramList.Add(new Tuple <string, string>("ifbwmode", "xdb")); paramList.Add(new Tuple <string, string>("ifbwparam", "26")); paramList.Add(new Tuple <string, string>("statwindowtime", 5.ToString())); paramList.Add(new Tuple <string, string>("gainmode", RmtpDefaultCollection.GainModeSource[GainMode].ToString())); if (RmtpDefaultCollection.GainModeSource[GainMode] == Rmtp.GainMode.mgc) { paramList.Add(new Tuple <string, string>("gainparam", string.Format("{0}dBuV", GainParam))); } if (!IsStudy) { if (HasThreshold) { if (ConfigurationManager.AppSettings["FscanSignalShold"].Equals("1")) { var tt = RmtpDefaultCollection.SignalSholdSource[ThresholdType].ToString(); string signalthreshold; if (tt == "horizontal") { signalthreshold = string.Format("{0}dBμV", SignalThreshold); paramList.Add(new Tuple <string, string>("thresholdtype", tt)); paramList.Add(new Tuple <string, string>("signalthreshold", signalthreshold)); } else if (tt == "background") { //自定义门限 paramList.Add(new Tuple <string, string>("thresholdtype", "custom")); paramList.Add(new Tuple <string, string>("thresholddesc", ThresholdDesc)); paramList.Add(new Tuple <string, string>("customthreshold", CustomThresholdValues)); } else if (tt == "noise") { paramList.Add(new Tuple <string, string>("thresholdtype", tt)); } if (tt != "horizontal") { //paramList.Add(new Tuple<string, string>("margin", Margin.ToString(CultureInfo.InvariantCulture))); paramList.Add(new Tuple <string, string>("signalthreshold", Margin.ToString(CultureInfo.InvariantCulture))); } } else { string signalthreshold = string.Format("{0}dBμV", SignalThreshold); paramList.Add(new Tuple <string, string>("thresholdtype", ThresholdType)); paramList.Add(new Tuple <string, string>("signalthreshold", signalthreshold)); } } } return(paramList); }