/// <summary>
        /// Converts this shape C# using the KimonoCore library.
        /// </summary>
        /// <returns>The kimono core.</returns>
        public override string ToKimonoCore()
        {
            var sourceCode = "";

            // Build with Kimono Core
            sourceCode += $"// Build {Name} shape\n" +
                          $"var {ElementName} = new KimonoShapeBezier({Left}f, {Top}f, {Right}f, {Bottom}f)" + "{" +
                          $"\n\tRotationDegrees = {RotationDegrees}," +
                          $"\n\tVisible = {Visible.ToString().ToLower()}," +
                          $"\n\tStyle = {Style.ElementName}," +
                          $"\n\tClosed = {Closed.ToString().ToLower()}" +
                          "};\n\n";

            // Add the points to the shape
            sourceCode += $"// Add points to {Name} shape\n";
            foreach (KimonoBezierPoint point in Points)
            {
                sourceCode += $"{ElementName}.AddPoint({point.ControlPoint.X}f, {point.ControlPoint.Y}f, {point.EndPoint.X}f, {point.EndPoint.Y}f);\n";
            }

            // Add any connections
            var connections = ConnectionsToKimonoCore();

            if (connections != null)
            {
                sourceCode += $"\n{connections}";
            }

            // Draw shape
            sourceCode += $"\n// Draw {Name} shape\n" +
                          $"{ElementName}.Draw(canvas);\n";

            // Return code
            return(sourceCode);
        }
Beispiel #2
0
		internal void WriteAttributes(TextWriter outText, bool closing)
		{
			if (_ownerdocument.OptionOutputAsXml)
			{
				if (_attributes == null)
				{
					return;
				}
				// we use Hashitems to make sure attributes are written only once
				foreach (HtmlAttribute att in _attributes.Hashitems.Values)
				{
					WriteAttribute(outText, att);
				}
				return;
			}

			if (!closing)
			{
				if (_attributes != null)
					foreach (HtmlAttribute att in _attributes)
						WriteAttribute(outText, att);

				if (!_ownerdocument.OptionAddDebuggingAttributes) return;

				WriteAttribute(outText, _ownerdocument.CreateAttribute("_closed", Closed.ToString()));
				WriteAttribute(outText, _ownerdocument.CreateAttribute("_children", ChildNodes.Count.ToString()));

				int i = 0;
				foreach (HtmlNode n in ChildNodes)
				{
					WriteAttribute(outText, _ownerdocument.CreateAttribute("_child_" + i,
																		   n.Name));
					i++;
				}
			}
			else
			{
				if (_endnode == null || _endnode._attributes == null || _endnode == this)
					return;

				foreach (HtmlAttribute att in _endnode._attributes)
					WriteAttribute(outText, att);

				if (!_ownerdocument.OptionAddDebuggingAttributes) return;

				WriteAttribute(outText, _ownerdocument.CreateAttribute("_closed", Closed.ToString()));
				WriteAttribute(outText, _ownerdocument.CreateAttribute("_children", ChildNodes.Count.ToString()));
			}
		}
Beispiel #3
0
        //
        /// <summary>
        /// Create a 'to string'.
        /// </summary>
        public override string ToString()
        {
            //
            StringBuilder _return = new StringBuilder("record:[");

            _return.AppendFormat("IncidentId: {0}, ", IncidentId.ToString());
            _return.AppendFormat("ServerId: {0}, ", ServerId.ToString());
            _return.AppendFormat("IPAddress: {0}, ", IPAddress);
            _return.AppendFormat("NIC: {0}, ", NIC);
            _return.AppendFormat("NetworkName: {0}, ", NetworkName);
            _return.AppendFormat("AbuseEmailAddress: {0}, ", AbuseEmailAddress);
            _return.AppendFormat("ISPTicketNumber: {0}, ", ISPTicketNumber);
            _return.AppendFormat("Mailed: {0}, ", Mailed.ToString());
            _return.AppendFormat("Closed: {0}, ", Closed.ToString());
            _return.AppendFormat("Special: {0}, ", Special.ToString());
            _return.AppendFormat("Notes: {0}, ", Notes);
            _return.AppendFormat("CreatedDate: {0}]", CreatedDate.ToString());
            return(_return.ToString());
        }
Beispiel #4
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            var buttons = new StringBuilder("[");
            var id      = output.Attributes["id"]?.Value;

            if (HasSave)
            {
                buttons.Append($"{{ text:'{SaveButtonName}', iconCls:'icon-ok', handler:function(){{ {OnSave} }} }},");
            }
            if (HasClose)
            {
                buttons.Append($"{{ text:'{CloseButtonName}', iconCls:'icon-cancel', handler:function(){{ {(id != null ? $"$('#{id}').window('close')" : "")} }} }},");
            }


            buttons.Append("]");

            Options.AddIf(OnClose.IsNotNullOrWhiteSpace(), EasyuiConsts.Dialog_OnClose, GetJavaScriptString($"function(){{ {OnClose} }}"));

            Options.AddIf(IsMax, EasyuiConsts.Dialog_IsMax, IsMax);

            Options.Add(EasyuiConsts.Dialog_Buttons, GetJavaScriptString(buttons.ToString()));

            output.Attributes.Add(EasyuiConsts.Dialog_Closed, Closed.ToString().ToCamelCase());

            if (Closed)
            {
                var style = output.Attributes["style"]?.ToString() ?? "";
                if (style.IsNotNullOrWhiteSpace() && !style.EndsWith(";"))
                {
                    style += ";";
                }
                style += "display: none;";
                output.Attributes.SetAttribute("style", style);
            }

            await base.ProcessAsync(context, output);
        }
Beispiel #5
0
 internal void WriteAttributes(TextWriter outText, bool closing)
 {
     if (_ownerdocument.OptionOutputAsXml)
     {
         if (_attributes != null)
         {
             foreach (HtmlAttribute attribute in _attributes.Hashitems.Values)
             {
                 WriteAttribute(outText, attribute);
             }
         }
     }
     else if (!closing)
     {
         if (_attributes != null)
         {
             foreach (HtmlAttribute attribute2 in (IEnumerable <HtmlAttribute>)_attributes)
             {
                 WriteAttribute(outText, attribute2);
             }
         }
         if (_ownerdocument.OptionAddDebuggingAttributes)
         {
             WriteAttribute(outText, _ownerdocument.CreateAttribute("_closed", Closed.ToString()));
             WriteAttribute(outText, _ownerdocument.CreateAttribute("_children", ChildNodes.Count.ToString()));
             int num = 0;
             foreach (HtmlNode node in (IEnumerable <HtmlNode>)ChildNodes)
             {
                 WriteAttribute(outText, _ownerdocument.CreateAttribute("_child_" + num, node.Name));
                 num++;
             }
         }
     }
     else if (((_endnode != null) && (_endnode._attributes != null)) && (_endnode != this))
     {
         foreach (HtmlAttribute attribute3 in (IEnumerable <HtmlAttribute>)_endnode._attributes)
         {
             WriteAttribute(outText, attribute3);
         }
         if (_ownerdocument.OptionAddDebuggingAttributes)
         {
             WriteAttribute(outText, _ownerdocument.CreateAttribute("_closed", Closed.ToString()));
             WriteAttribute(outText, _ownerdocument.CreateAttribute("_children", ChildNodes.Count.ToString()));
         }
     }
 }