コード例 #1
0
        protected override void BuildClasses(ClassBuilder builder)
        {
            builder.Append(ClassProvider.Switch());
            builder.Append(ClassProvider.SwitchChecked(Checked?.ToString() == bool.TrueString));

            base.BuildClasses(builder);
        }
コード例 #2
0
        void page_ValidationHandler(ctlPage sender, CommandEventArgs e)
        {
            if (e.CommandArgument == null)
            {
                return;
            }
            var strGroupName = (string)e.CommandArgument;

            if (((MetaValidationGroupName == strGroupName) || (strGroupName == "All")) &&
                MetaValidationRequired)
            {
                //DoValidation
                var errorMessage =
                    CustomValidation.GenericValidation(
                        Checked.ToString(),
                        MetaCaption,
                        MetaMandatory,
                        MetaValidationType.ToString(),
                        MetaValidationErrorCode.ToString(),
                        "ctlRadioButton");
                if (!string.IsNullOrEmpty(errorMessage))
                {
                    sender.ErrorMessage = errorMessage;
                    Attributes.Add("style", StyleConstants.ValidationError);
                }
                else
                {
                    Attributes.Add("style", "");
                }
            }
        }
コード例 #3
0
ファイル: ExtendedControls.cs プロジェクト: AgentTy/General
        private void OnCheckedChanged(object o, EventArgs e)
        {
            if (_blnOverride)
            {
                Checked = _blnOverrideValue;
            }

            if (SaveToCookie)
            {
                General.Cookies.SetCookie(CookieID, Checked.ToString());
            }
        }
コード例 #4
0
ファイル: RadioButton.cs プロジェクト: mpetrinidev/winforms
        /// <include file='doc\RadioButton.uex' path='docs/doc[@for="RadioButton.ToString"]/*' />
        /// <devdoc>
        ///     Returns a string representation for this control.
        /// </devdoc>
        /// <internalonly/>
        public override string ToString()
        {
            string s = base.ToString();

            return(s + ", Checked: " + Checked.ToString());
        }
コード例 #5
0
        internal void Render(HtmlTextWriter writer)
        {
            var l = new List <string>(CssClasses);

            if (Expanded != true && ChildNodes.Count > 0)
            {
                l.Add("closed");
            }
            if (l.Count > 0)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, string.Join(" ", l.ToArray()));
            }
            if (!string.IsNullOrEmpty(ToolTip))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
            }
            if (!string.IsNullOrEmpty(Value))
            {
                writer.AddAttribute("uid", Value);
            }
            if (Draggable)
            {
                writer.AddAttribute("drag", "true");
                writer.AddAttribute("unselectable", "on");
            }
            if (ShowCheckBox)
            {
                writer.AddAttribute("checked", Checked.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Li);
            if (!string.IsNullOrEmpty(ImageUrl))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Src, ImageUrl);
                writer.RenderBeginTag(HtmlTextWriterTag.Img);
                writer.RenderEndTag(); //img
            }
            //if (Draggable)
            //{
            //    writer.AddAttribute(HtmlTextWriterAttribute.Href, "#");
            //    writer.RenderBeginTag(HtmlTextWriterTag.A);
            //}

            writer.RenderBeginTag(HtmlTextWriterTag.Span);
            writer.Write(Text);
            writer.RenderEndTag(); //span
            //if (Draggable)
            //    writer.RenderEndTag(); //a
            if (ChildNodes.Count > 0)
            {
                writer.AddStyleAttribute("list-style-type", "none");
                writer.RenderBeginTag(HtmlTextWriterTag.Ul);
                foreach (var n in ChildNodes)
                {
                    n.Render(writer);
                }
                writer.RenderEndTag(); //ul
            }
            writer.RenderEndTag();     //li


            //HtmlInputCheckBox cb = new HtmlInputCheckBox();
            //cb.Checked = m.Visible;

            //StringWriter cw = new StringWriter();
            //HtmlTextWriter writer = new HtmlTextWriter(cw);
            //cb.RenderControl(writer);
            //n.Text = cw.ToString() + n.Text;
        }
コード例 #6
0
 public void UpdateCheckedDescription()
 {
     CheckedDescription = Checked.ToString();
 }
コード例 #7
0
ファイル: DialogControl.cs プロジェクト: Hsiett/galaxy-pp
        protected void PrintBaseInit(StringBuilder builder, DialogControl defaultBase)
        {
            builder.Append("\t\tDialogControlSetSize(");
            builder.Append(Name);
            builder.Append(", PlayerGroupAll(), ");
            builder.Append(Size.Width);
            builder.Append(", ");
            builder.Append(Size.Height);
            builder.AppendLine(");");

            builder.Append("\t\tDialogControlSetPosition(");
            builder.Append(Name);
            builder.Append(", PlayerGroupAll(), ");
            builder.Append(Anchor.ToSCIIString());
            builder.Append(", ");
            builder.Append(Offset.X);
            builder.Append(", ");
            builder.Append(Offset.Y);
            builder.AppendLine(");");


            if (Enabled != defaultBase.Enabled)
            {
                builder.Append("\t\tDialogControlSetEnabled(");
                builder.Append(Name);
                builder.Append(", PlayerGroupAll(), ");
                builder.Append(Enabled.ToString().ToLower());
                builder.AppendLine(");");
            }
            if (Visible != defaultBase.Visible)
            {
                builder.Append("\t\tDialogControlSetVisible(");
                builder.Append(Name);
                builder.Append(", PlayerGroupAll(), ");
                builder.Append(Visible.ToString().ToLower());
                builder.AppendLine(");");
            }
            if (FullDialog != defaultBase.Visible)
            {
                builder.Append("\t\tDialogControlSetVisible(");
                builder.Append(Name);
                builder.Append(", PlayerGroupAll(), ");
                builder.Append(Visible.ToString().ToLower());
                builder.AppendLine(");");
            }
            if (Text != defaultBase.Text)
            {
                builder.Append("\t\tDialogControlSetPropertyAsText(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyText, PlayerGroupAll(), \"");
                builder.Append(Text);
                builder.AppendLine("\");");
            }
            if (EditText != defaultBase.EditText)
            {
                builder.Append("\t\tDialogControlSetPropertyAsString(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyEditText, PlayerGroupAll(), \"");
                builder.Append(EditText);
                builder.AppendLine("\");");
            }
            if (TintColors[0] != defaultBase.TintColors[0] ||
                TintColors[1] != defaultBase.TintColors[1] ||
                TintColors[2] != defaultBase.TintColors[2])
            {
                if (TintColors[0] == TintColors[1] && TintColors[1] == TintColors[2])
                {
                    //because the parameters for ColorWithAlpha is r,g,b,a in 0~100,
                    // we need to scale by 100
                    builder.Append("\t\tDialogControlSetPropertyAsColor(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyColor, PlayerGroupAll(), ColorWithAlpha(");
                    Vector4 color = TintColors[0].ToVector4() * 100;
                    builder.Append(color.X);
                    builder.Append(", ");
                    builder.Append(color.Y);
                    builder.Append(", ");
                    builder.Append(color.Z);
                    builder.Append(", ");
                    builder.Append(color.W);
                    builder.AppendLine("));");
                }
                else
                {
                    builder.AppendLine("\t\tfor (int i = 0; i < 16; i++)");
                    builder.AppendLine("\t\t{");
                    builder.AppendLine("\t\t\tif (PlayerStatus(i) == c_playerStatusActive &&");
                    builder.AppendLine("\t\t\t    PlayerType(i) == c_playerTypeUser)");
                    builder.AppendLine("\t\t\t{");
                    builder.AppendLine("\t\t\t\tswitch (PlayerRace(i))");
                    builder.AppendLine("\t\t\t\t{");

                    builder.AppendLine("\t\t\t\t\tcase \"Terr\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsColor(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyColor, PlayerGroupSingle(i), ColorWithAlpha(");
                    Vector4 color = TintColors[0].ToVector4() * 100;
                    builder.Append(color.X);
                    builder.Append(", ");
                    builder.Append(color.Y);
                    builder.Append(", ");
                    builder.Append(color.Z);
                    builder.Append(", ");
                    builder.Append(color.W);
                    builder.AppendLine("));");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Prot\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsColor(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyColor, PlayerGroupSingle(i), ColorWithAlpha(");
                    color = TintColors[1].ToVector4() * 100;
                    builder.Append(color.X);
                    builder.Append(", ");
                    builder.Append(color.Y);
                    builder.Append(", ");
                    builder.Append(color.Z);
                    builder.Append(", ");
                    builder.Append(color.W);
                    builder.AppendLine("));");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Zerg\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsColor(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyColor, PlayerGroupSingle(i), ColorWithAlpha(");
                    color = TintColors[2].ToVector4() * 100;
                    builder.Append(color.X);
                    builder.Append(", ");
                    builder.Append(color.Y);
                    builder.Append(", ");
                    builder.Append(color.Z);
                    builder.Append(", ");
                    builder.Append(color.W);
                    builder.AppendLine("));");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t}");
                    builder.AppendLine("\t\t\t}");
                    builder.AppendLine("\t\t}");
                }
            }

            if (ImagePaths[0] != defaultBase.ImagePaths[0] ||
                ImagePaths[1] != defaultBase.ImagePaths[1] ||
                ImagePaths[2] != defaultBase.ImagePaths[2])
            {
                if (ImagePaths[0] == ImagePaths[1] && ImagePaths[1] == ImagePaths[2])
                {
                    builder.Append("\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyImage, PlayerGroupAll(), \"");
                    builder.Append(_imagePath2ScriptPath(ImagePaths[0].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                }
                else
                {
                    builder.AppendLine("\t\tfor (int i = 0; i < 16; i++)");
                    builder.AppendLine("\t\t{");
                    builder.AppendLine("\t\t\tif (PlayerStatus(i) == c_playerStatusActive &&");
                    builder.AppendLine("\t\t\t    PlayerType(i) == c_playerTypeUser)");
                    builder.AppendLine("\t\t\t{");
                    builder.AppendLine("\t\t\t\tswitch (PlayerRace(i))");
                    builder.AppendLine("\t\t\t\t{");

                    builder.AppendLine("\t\t\t\t\tcase \"Terr\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(ImagePaths[0].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Prot\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(ImagePaths[1].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Zerg\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(ImagePaths[2].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t}");
                    builder.AppendLine("\t\t\t}");
                    builder.AppendLine("\t\t}");
                }
            }

            /*if (TextStyle != null &&
             *  (defaultBase.TextStyle == null ||
             *  TextStyle.Name != defaultBase.TextStyle.Name))
             * {
             *  builder.Append("\t\tDialogControlSetPropertyAsString(");
             *  builder.Append(Name);
             *  builder.Append(", c_triggerControlPropertyStyle, PlayerGroupAll(), \"");
             *  builder.Append(TextStyle.Name.Replace("\\", "\\\\"));
             *  builder.AppendLine("\");");
             * }*/
            if ((TextStyles[0] != null &&
                 (defaultBase.TextStyles[0] == null ||
                  TextStyles[0].Name != defaultBase.TextStyles[0].Name)) ||

                (TextStyles[1] != null &&
                 (defaultBase.TextStyles[1] == null ||
                  TextStyles[1].Name != defaultBase.TextStyles[1].Name)) ||

                (TextStyles[1] != null &&
                 (defaultBase.TextStyles[1] == null ||
                  TextStyles[1].Name != defaultBase.TextStyles[1].Name)))
            {
                if (TextStyles[0] == TextStyles[1] && TextStyles[1] == TextStyles[2])
                {
                    builder.Append("\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyStyle, PlayerGroupAll(), \"");
                    builder.Append(TextStyles[0].Name.Replace("\\", "\\\\"));
                    builder.AppendLine("\");");
                }
                else
                {
                    builder.AppendLine("\t\tfor (int i = 0; i < 16; i++)");
                    builder.AppendLine("\t\t{");
                    builder.AppendLine("\t\t\tif (PlayerStatus(i) == c_playerStatusActive &&");
                    builder.AppendLine("\t\t\t    PlayerType(i) == c_playerTypeUser)");
                    builder.AppendLine("\t\t\t{");
                    builder.AppendLine("\t\t\t\tswitch (PlayerRace(i))");
                    builder.AppendLine("\t\t\t\t{");

                    if (TextStyles[0] != null)
                    {
                        builder.AppendLine("\t\t\t\t\tcase \"Terr\":");
                        builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                        builder.Append(Name);
                        builder.Append(", c_triggerControlPropertyStyle, PlayerGroupSingle(i), \"");
                        builder.Append(TextStyles[0].Name.Replace("\\", "\\\\"));
                        builder.AppendLine("\");");
                        builder.AppendLine("\t\t\t\t\t\tbreak;");
                    }
                    if (TextStyles[1] != null)
                    {
                        builder.AppendLine("\t\t\t\t\tcase \"Prot\":");
                        builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                        builder.Append(Name);
                        builder.Append(", c_triggerControlPropertyImage, PlayerGroupSingle(i), \"");
                        builder.Append(TextStyles[1].Name.Replace("\\", "\\\\"));
                        builder.AppendLine("\");");
                        builder.AppendLine("\t\t\t\t\t\tbreak;");
                    }
                    if (TextStyles[2] != null)
                    {
                        builder.AppendLine("\t\t\t\t\tcase \"Zerg\":");
                        builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                        builder.Append(Name);
                        builder.Append(", c_triggerControlPropertyImage, PlayerGroupSingle(i), \"");
                        builder.Append(TextStyles[2].Name.Replace("\\", "\\\\"));
                        builder.AppendLine("\");");
                        builder.AppendLine("\t\t\t\t\t\tbreak;");
                    }
                    builder.AppendLine("\t\t\t\t}");
                    builder.AppendLine("\t\t\t}");
                    builder.AppendLine("\t\t}");
                }
            }

            if (Tiled != defaultBase.Tiled)
            {
                builder.Append("\t\tDialogControlSetPropertyAsBool(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyTiled, PlayerGroupAll(), ");
                builder.Append(Tiled.ToString().ToLower());
                builder.AppendLine(");");
            }

            /*if (Tiled != defaultBase.Tiled)
             * {
             *  builder.Append("\t\tDialogControlSetPropertyAsBool(");
             *  builder.Append(Name);
             *  builder.Append(", c_triggerControlPropertyTiled, PlayerGroupAll(), ");
             *  builder.Append(Tiled.ToString().ToLower());
             *  builder.AppendLine(");");
             * }*/
            if (Checked != defaultBase.Checked)
            {
                builder.Append("\t\tDialogControlSetPropertyAsBool(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyChecked, PlayerGroupAll(), ");
                builder.Append(Checked.ToString().ToLower());
                builder.AppendLine(");");
            }
            if (ToolTip != defaultBase.ToolTip)
            {
                builder.Append("\t\tDialogControlSetPropertyAsText(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyTooltip, PlayerGroupAll(), \"");
                builder.Append(ToolTip.Replace("\\", "\\\\"));
                builder.AppendLine("\");");
            }
            if (ImageType != defaultBase.ImageType)
            {
                builder.Append("\t\tDialogControlSetPropertyAsInt(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyImageType, PlayerGroupAll(), ");
                builder.Append(ImageType.ToSCIIString());
                builder.AppendLine(");");
            }
            if (BlendMode != defaultBase.BlendMode)
            {
                builder.Append("\t\tlibNtve_gf_SetDialogItemBlendMode(");
                builder.Append(Name);
                builder.Append(", ");
                builder.Append(BlendMode.ToSCIIString());
                builder.AppendLine(", PlayerGroupAll());");
            }
            if (HoverImagePaths[0] != defaultBase.HoverImagePaths[0] ||
                HoverImagePaths[1] != defaultBase.HoverImagePaths[1] ||
                HoverImagePaths[2] != defaultBase.HoverImagePaths[2])
            {
                if (HoverImagePaths[0] == HoverImagePaths[1] && HoverImagePaths[1] == HoverImagePaths[2])
                {
                    builder.Append("\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyHoverImage, PlayerGroupAll(), \"");
                    builder.Append(_imagePath2ScriptPath(HoverImagePaths[0].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                }
                else
                {
                    builder.AppendLine("\t\tfor (int i = 0; i < 16; i++)");
                    builder.AppendLine("\t\t{");
                    builder.AppendLine("\t\t\tif (PlayerStatus(i) == c_playerStatusActive &&");
                    builder.AppendLine("\t\t\t    PlayerType(i) == c_playerTypeUser)");
                    builder.AppendLine("\t\t\t{");
                    builder.AppendLine("\t\t\t\tswitch (PlayerRace(i))");
                    builder.AppendLine("\t\t\t\t{");

                    builder.AppendLine("\t\t\t\t\tcase \"Terr\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyHoverImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(HoverImagePaths[0].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Prot\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyHoverImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(HoverImagePaths[1].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t\tcase \"Zerg\":");
                    builder.Append("\t\t\t\t\t\tDialogControlSetPropertyAsString(");
                    builder.Append(Name);
                    builder.Append(", c_triggerControlPropertyHoverImage, PlayerGroupSingle(i), \"");
                    builder.Append(_imagePath2ScriptPath(HoverImagePaths[2].Replace("\\", "\\\\")));
                    builder.AppendLine("\");");
                    builder.AppendLine("\t\t\t\t\t\tbreak;");

                    builder.AppendLine("\t\t\t\t}");
                    builder.AppendLine("\t\t\t}");
                    builder.AppendLine("\t\t}");
                }
            }
            if (RenderPriority != defaultBase.RenderPriority)
            {
                builder.Append("\t\tDialogControlSetPropertyAsInt(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyRenderPriority, PlayerGroupAll(), ");
                builder.Append(RenderPriority);
                builder.AppendLine(");");
            }
            if (MinValue != defaultBase.MinValue)
            {
                builder.Append("\t\tDialogControlSetPropertyAsFixed(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyMinValue, PlayerGroupAll(), ");
                builder.Append(MinValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
                builder.AppendLine(");");
            }
            if (MaxValue != defaultBase.MaxValue)
            {
                builder.Append("\t\tDialogControlSetPropertyAsFixed(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyMaxValue, PlayerGroupAll(), ");
                builder.Append(MaxValue.ToString(CultureInfo.InvariantCulture.NumberFormat));
                builder.AppendLine(");");
            }
            if (Value != defaultBase.Value)
            {
                builder.Append("\t\tDialogControlSetPropertyAsFixed(");
                builder.Append(Name);
                builder.Append(", c_triggerControlPropertyValue, PlayerGroupAll(), ");
                builder.Append(Value.ToString(CultureInfo.InvariantCulture.NumberFormat));
                builder.AppendLine(");");
            }
            if (Items != null)
            {
                foreach (string item in Items)
                {
                    builder.Append("\t\tDialogControlAddItem(");
                    builder.Append(Name);
                    builder.Append(", PlayerGroupAll(), \"");
                    builder.Append(item);
                    builder.AppendLine("\");");
                }
            }
            if (SelectionIndex != defaultBase.SelectionIndex)
            {
                builder.Append("\t\tDialogControlSelectItem(");
                builder.Append(Name);
                builder.Append(", PlayerGroupAll(), ");
                builder.Append(SelectionIndex);
                builder.AppendLine(");");
            }

            //windywell enable mouse event for all users if events count >0
            if (Events.Count > 0)
            {
                //libNtve_gf_SetDialogItemAcceptMouse(test->bounder,true,PlayerGroupAll());
                builder.Append("\t\tlibNtve_gf_SetDialogItemAcceptMouse(");
                builder.Append(Name);
                builder.AppendLine(",true,PlayerGroupAll());");

                //to avoid the calling of the following event state chane
                //builder.AppendLine("\t\tWait(0.1,c_timeReal);");
            }

            foreach (KeyValuePair <string, string> pair in Events)
            {
                //to avoid the calling of the following event state change, using InvokeAsync<>()
                builder.Append("\t\tInvokeAsync<this->AddEventDialogControl>(");
                builder.Append(Data.DialogIdentiferName);
                builder.Append("_");
                builder.Append(Name);
                builder.Append("_");
                builder.Append(pair.Key);
                builder.Append(", c_playerAny, ");
                builder.Append(Name);
                switch (pair.Key)
                {
                case "OnClicked":
                    builder.AppendLine(", c_triggerControlEventTypeClick);");
                    break;

                case "OnAnyEvent":
                    builder.AppendLine(", c_triggerControlEventTypeAny);");
                    break;

                case "OnChecked":
                    builder.AppendLine(", c_triggerControlEventTypeChecked);");
                    break;

                case "OnMouseEnter":
                    builder.AppendLine(", c_triggerControlEventTypeMouseEnter);");
                    break;

                case "OnMouseExit":
                    builder.AppendLine(", c_triggerControlEventTypeMouseExit);");
                    break;

                case "OnTextChanged":
                    builder.AppendLine(", c_triggerControlEventTypeTextChanged);");
                    break;

                case "OnValueChanged":
                    builder.AppendLine(", c_triggerControlEventTypeValueChanged);");
                    break;

                case "OnSelectionChanged":
                    builder.AppendLine(", c_triggerControlEventTypeSelectionChanged);");
                    break;

                case "OnSelectionDoubleClicked":
                    builder.AppendLine(", c_triggerControlEventTypeSelectionDoubleClicked);");
                    break;
                }
            }
        }
コード例 #8
0
 public override string AttributeValue(string name)
 {
     return(name == "type"? "checkbox" :
            name == "checked"? Checked.ToString().ToLower() :
            null);
 }
コード例 #9
0
        /// <summary>
        /// Render the tool to the specified HtmlTextWriter object. Usually a Page.
        /// </summary>
        protected virtual void RenderImage(HtmlTextWriter output)
        {
            if (Type == ToolButtonType.Checkbox)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");
                output.AddAttribute(HtmlTextWriterAttribute.Value, Checked.ToString());
                output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_Checked");
                output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "_Checked");
                output.RenderBeginTag(HtmlTextWriterTag.Input);
                output.RenderEndTag();

                output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");
                output.AddAttribute(HtmlTextWriterAttribute.Value, GroupName);
                output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_GroupName");
                output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "_GroupName");
                output.RenderBeginTag(HtmlTextWriterTag.Input);
                output.RenderEndTag();
            }

            output.AddAttribute(HtmlTextWriterAttribute.Type, "hidden");
            output.AddAttribute(HtmlTextWriterAttribute.Value, "True");
            output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_Enabled");
            output.AddAttribute(HtmlTextWriterAttribute.Name, UniqueID + "_Enabled");
            output.RenderBeginTag(HtmlTextWriterTag.Input);
            output.RenderEndTag();

            if (AllowRollOver /*&& this.OverImageURL != string.Empty*/)
            {
                output.AddAttribute("onmouseover", string.Format("ATB_toolButtonMouseOver('{0}');", ClientID));
            }

            output.AddAttribute("onmouseout", string.Format("ATB_toolButtonMouseOut('{0}');", ClientID));
            output.AddAttribute("onmousedown", string.Format("ATB_toolButtonMouseDown('{0}');", ClientID));
            output.AddAttribute("onmouseup", string.Format("ATB_toolButtonMouseUp('{0}');", ClientID));
            output.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
            output.AddAttribute(HtmlTextWriterAttribute.Border, "0");

            output.AddAttribute("onselectstart", "return false");

            string onclick = string.Empty;

            if (!UsePopupOnClick)
            {
                if (this.ClientSideClick != string.Empty)
                {
                    onclick += this.ClientSideClick;
                }

                if (this.Click != null)
                {
                    onclick += this.Page.GetPostBackEventReference(this);
                }
            }
            else
            {
                if (this.ClientSideClick != string.Empty)
                {
                    onclick += this.ClientSideClick;
                }
                onclick += string.Format("return ATB_showPopup('{0}');", PopupContents.ID);
            }

            if (onclick != string.Empty)
            {
                output.AddAttribute(HtmlTextWriterAttribute.Onclick, onclick);
            }

            output.AddStyleAttribute("margin", margin.ToString());

            if (System.Web.HttpContext.Current != null)
            {
                if (Page.Request.Browser.Browser.ToUpper() == "IE")
                {
                    output.AddStyleAttribute("cursor", "hand");
                }
                else
                {
                    output.AddStyleAttribute("cursor", "pointer");
                }
            }
            output.AddAttribute(HtmlTextWriterAttribute.Id, ClientID + "_toolButtonTable");

            if (Checked)
            {
                if (BackColorClicked != Color.Empty)
                {
                    output.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, Utils.Color2Hex(BackColorClicked));
                }

                if (backImageClicked != string.Empty)
                {
                    output.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, backImageClicked);
                }
            }

            if (backImage != string.Empty)
            {
                output.AddStyleAttribute(HtmlTextWriterStyle.BackgroundImage, backImage);
            }

            output.RenderBeginTag(HtmlTextWriterTag.Table);
            output.RenderBeginTag(HtmlTextWriterTag.Tr);

            if (Text != string.Empty && TextAlign == TextAlign.Left)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                output.Write(Text);
                output.RenderEndTag();
            }

            if (Text == string.Empty || ImageURL != string.Empty)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Td);

                string fullImagePath = string.Empty;
                if (Parent != null && Parent is ActiveUp.WebControls.Toolbar)
                {
                    PopupContents.ImagesDirectory = ((Toolbar)Parent).ImagesDirectory;
                    fullImagePath = Utils.ConvertToImageDir(((Toolbar)Parent).ImagesDirectory, this.ImageURL);
                }
                else
                {
                    fullImagePath = ImageURL;
                }
#if (!FX1_1)
                if (fullImagePath == string.Empty)
                {
                    fullImagePath = Utils.ConvertToImageDir(((Toolbar)Parent).ImagesDirectory == string.Empty ? string.Empty : ((Toolbar)Parent).ImagesDirectory, ImageURL, "button.gif", Page, this.GetType());
                }
#endif
                string clientID = this.ClientID.Replace(":", "_");

                //this.ClientSideClick += "this.disabled=true;";

                if (this.NavigateURL != string.Empty)
                {
                    output.AddAttribute(HtmlTextWriterAttribute.Href, this.NavigateURL);
                    if (this.Target != string.Empty)
                    {
                        output.AddAttribute(HtmlTextWriterAttribute.Target, this.Target);
                    }
                    output.RenderBeginTag(HtmlTextWriterTag.A);                     // A
                }

                this.ControlStyle.AddAttributesToRender(output);
                Unit borderWidth = base.BorderWidth;
                if (borderWidth.IsEmpty)
                {
                    output.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                }
                output.AddAttribute(HtmlTextWriterAttribute.Name, clientID);
                output.AddAttribute(HtmlTextWriterAttribute.Alt, this.ToolTip);
                output.AddAttribute(HtmlTextWriterAttribute.Src, fullImagePath);


                if (AllowRollOver && Text == string.Empty && OverImageURL != string.Empty)
                {
                    if (Parent != null && Parent is ActiveUp.WebControls.Toolbar)
                    {
                        string imageOver = string.Empty;

                        if (((Toolbar)Parent).ImagesDirectory == string.Empty)
                        {
                            imageOver = OverImageURL;
                        }
                        else
                        {
                            imageOver = Utils.ConvertToImageDir(((Toolbar)Parent).ImagesDirectory, this.OverImageURL);
                        }

                        output.AddAttribute("onmouseover", "ATB_swapButton('" + clientID + "', '" + imageOver + "');");
                    }
                    else
                    {
                        output.AddAttribute("onmouseover", "ATB_swapButton('" + clientID + "', '" + this.OverImageURL + "');");
                    }
                }

                if (Parent != null && Parent is ActiveUp.WebControls.Toolbar)
                {
                    string imageURL = string.Empty;


#if (!FX1_1)
                    if (imageURL.TrimEnd() == string.Empty)
                    {
                        imageURL = Utils.ConvertToImageDir(((Toolbar)Parent).ImagesDirectory == string.Empty ? string.Empty : ((Toolbar)Parent).ImagesDirectory, ImageURL, "button.gif", Page, this.GetType());
                    }
#else
                    if (((Toolbar)Parent).ImagesDirectory == string.Empty)
                    {
                        imageURL = ImageURL;
                    }
                    else
                    {
                        imageURL = Utils.ConvertToImageDir(((Toolbar)Parent).ImagesDirectory, this.ImageURL);
                    }
#endif
                    output.AddAttribute("onmouseout", "ATB_swapButton('" + clientID + "', '" + imageURL + "');");
                }
                else
                {
                    output.AddAttribute("onmouseout", "ATB_swapButton('" + clientID + "', '" + this.ImageURL + "');");
                }

                output.RenderBeginTag(HtmlTextWriterTag.Img);
                output.RenderEndTag();

                if (this.NavigateURL != string.Empty)
                {
                    output.RenderEndTag();                     // /A
                }
                output.RenderEndTag();
            }

            if (Text != string.Empty && TextAlign == TextAlign.Right)
            {
                output.RenderBeginTag(HtmlTextWriterTag.Td);
                output.Write(Text);
                output.RenderEndTag();
            }

            output.RenderEndTag();
            output.RenderEndTag();
        }
コード例 #10
0
 public string GetTextValue()
 {
     return(Checked.ToString());
 }
コード例 #11
0
ファイル: RadioButton.cs プロジェクト: ForNeVeR/pnet
 // Convert this object into a string.
 public override string ToString()
 {
     return(GetType().FullName.ToString() + ", Checked: " + Checked.ToString());
 }
コード例 #12
0
 public override void ToJSON(JObject ParentObject)
 {
     ParentObject["required"] = Required;
     ParentObject[_CheckedSubField.ToXmlNodeName(true)] = Checked.ToString().ToLower();
 }