Exemplo n.º 1
0
        public ControlDefinition(ControlType controlType)
        {
            if (!Enum.IsDefined(typeof(ControlType), controlType))
            {
                throw new InvalidEnumArgumentException(nameof(controlType), (Int32)controlType, typeof(ControlType));
            }

            this.ControlType = controlType;

            var value = controlType.ToString();

            if (value.StartsWith(Constants.Wpf))
            {
                this.ProjectType = ProjectType.Wpf;
                this.ShortName   = value.Substring(3).SplitWords();
            }
            else if (value.StartsWith(Constants.Xamarin))
            {
                this.ProjectType = ProjectType.Xamarin;
                this.ShortName   = value.Substring(7).SplitWords();
            }
            else if (value.StartsWith(Constants.Silverlight))
            {
                this.ProjectType = ProjectType.Silverlight;
                this.ShortName   = value.Substring(11).SplitWords();
            }
            else
            {
                this.ProjectType = ProjectType.Uwp;
                this.ShortName   = value.Substring(3).SplitWords();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 重写文本输入框的输出(简单模式,用于表格里编辑使用)
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOutSimple(HtmlTextWriter writer)
        {
            this.LabelWidth = 0;
            base.LoadControlCssStyle(writer);
            if (this.ReadOnly)
            {
                writer.AddAttribute("readonly", "readonly");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-readonly");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
            }

            base.LoadCommonAttribute(writer);

            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "99999");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            if (!string.IsNullOrEmpty(this.DefaultValue))
            {
                writer.AddAttribute("value", this.DefaultValue);
            }

            this.AddAttributeToText(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.AddAttribute("clstype", ControlType.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
        }
Exemplo n.º 3
0
            private float ConfigureSingleAxisInputResponse(string block_name, ControlType control_type)
            {
                System.Text.RegularExpressions.Regex regex;
                float global_scaler;

                switch (control_type)
                {
                case ControlType.pitch:
                    regex         = new System.Text.RegularExpressions.Regex(PITCH_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_PITCH_SCALER;
                    break;

                case ControlType.yaw:
                    regex         = new System.Text.RegularExpressions.Regex(YAW_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_YAW_SCALER;
                    break;

                case ControlType.roll:
                    regex         = new System.Text.RegularExpressions.Regex(ROLL_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_ROLL_SCALER;
                    break;

                case ControlType.up_down:
                    regex         = new System.Text.RegularExpressions.Regex(UP_DOWN_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_UP_DOWN_SCALER;
                    break;

                case ControlType.left_right:
                    regex         = new System.Text.RegularExpressions.Regex(LEFT_RIGHT_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_LEFT_RIGHT_SCALER;
                    break;

                case ControlType.forward_back:
                    regex         = new System.Text.RegularExpressions.Regex(FORWARD_BACK_COMMAND_NAME_PATTERN, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    global_scaler = GLOBAL_MAGNITUDE_SCALER * GLOBAL_FORWARD_BACK_SCALER;
                    break;

                default:
                    throw new Exception($"Error: control type {control_type.ToString()} not accounted for.");
                }

                System.Text.RegularExpressions.Match m = regex.Match(block_name);

                if (!m.Success)
                {
                    return(0);
                }

                string[] parts_of_name = m.Value.Substring(0, m.Length - 1).Split(':');
                float    response;

                //response has assigned value assigned during evaluation of if statement
                //response defaults to 1.0 if number portion of name is not found or if float parse fails
                if (parts_of_name.Length != 2 || !float.TryParse(parts_of_name[1], out response))
                {
                    response = 1.0f;
                }

                return(response * global_scaler);
            }
Exemplo n.º 4
0
        public static Dictionary<string, string> ReadLocalizationConfig(ControlType controlType)
        {
            string configPath = string.Format(configPathFormat, controlType.ToString(), RunTimeLocaliationTypeString);

            Dictionary<string, string> dicNameValue = new Dictionary<string, string>();

            if (File.Exists(configPath))
            {
                XmlDocument xd = new XmlDocument();
                xd.Load(configPath);

                XmlNodeList xnDataList = xd.SelectNodes("configuration/root/data");

                foreach (XmlNode xn in xnDataList)
                {
                    if (!dicNameValue.Keys.Contains(xn.Attributes["name"].Value))
                    {
                        dicNameValue.Add(xn.Attributes["name"].Value,xn.Attributes["value"].Value);
                    }
                }
            }

           
            return dicNameValue;
        }
Exemplo n.º 5
0
        internal static Wix.Control ConvertToWControl(this IWixControl srcControl, ControlType controlType)
        {
            var wControl = new Wix.Control { Type = controlType.ToString() };

            wControl.CopyCommonPropertiesFrom(srcControl);

            return wControl;
        }
Exemplo n.º 6
0
 public override string ToString()
 {
     if (!string.IsNullOrEmpty(Description))
     {
         return($"{ControlType}: {Description}");
     }
     return(ControlType.ToString());
 }
Exemplo n.º 7
0
    public void AddControl(ControlType type, Vector2 position)
    {
        var element = new ControlElement()
        {
            id = model.GenerateUniqueID(), name = type.ToString(), position = position
        };

        model.AddElement(element, model.root, 0);
    }
Exemplo n.º 8
0
        /// <summary>
        /// Converts <see cref="IWixControl"/> into an instance of <see cref="WixSharp.Controls.Control"/>.
        /// </summary>
        /// <param name="srcControl">The source control.</param>
        /// <param name="controlType">Type of the control.</param>
        /// <returns></returns>
        public static WixSharp.Controls.Control ConvertToWControl(this IWixControl srcControl, ControlType controlType)
        {
            var wControl = new WixSharp.Controls.Control {
                Type = controlType.ToString()
            };

            wControl.CopyCommonPropertiesFrom(srcControl);

            return(wControl);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 返回组件的类型
        /// </summary>
        public virtual T GetBaseType <T>()
        {
            Type type = typeof(T);

            if (m_controlType.ToString() == type.Name)
            {
                return((T)(object)this);
            }
            return(default(T));
        }
        public DisciplineBasedProxy[] GetDisciplinesWithUsingFilters(string disciplineName, ControlType?controlType, string groupName)
        {
            var parameters = GetDefaultParameters();

            AddParameterIfNotNullOrEmpty(parameters, HttpParameters.DisciplineName, disciplineName);
            AddParameterIfNotNullOrEmpty(parameters, HttpParameters.ControlType, controlType?.ToString());
            AddParameterIfNotNullOrEmpty(parameters, HttpParameters.GroupName, groupName);

            return(SendRequest <DisciplineBasedProxy[]>("GetDisciplinesWithUsingFilters", parameters));
        }
        public static bool HasCustomAttribute <TCustomAttributeType>(ControlType controlType)
        {
            var memberInfo = typeof(ControlType).GetMember(controlType.ToString()).FirstOrDefault();

            if (memberInfo != null)
            {
                return(memberInfo.GetCustomAttributes(typeof(TCustomAttributeType), false).FirstOrDefault() != null);
            }

            return(false);
        }
Exemplo n.º 12
0
 protected override void OnXmlWriteTag(XmlWriterEventArgs e)
 {
     e.XmlWriter.WriteAttributeString("type", m_type.ToString());
     e.XmlWriter.WriteAttributeString("position", XmlRectangle.ToString(m_position));
     e.XmlWriter.WriteAttributeString("enabled", m_enabled.ToString());
     e.XmlWriter.WriteAttributeString("display_install", m_display_install.ToString());
     e.XmlWriter.WriteAttributeString("display_uninstall", m_display_uninstall.ToString());
     e.XmlWriter.WriteAttributeString("check", m_check.ToString());
     e.XmlWriter.WriteAttributeString("has_value_disabled", m_has_value_disabled.ToString());
     base.OnXmlWriteTag(e);
 }
Exemplo n.º 13
0
        public BaseControl FindControl(string controlName, string controlFrame = null)
        {
            IElement control;
            By       webControlLocator;

            if (string.IsNullOrEmpty(controlName) && string.IsNullOrEmpty(controlFrame))
            {
                throw new ArgumentException("The control and container names must not have a null or empty value.");
            }

            if (!string.IsNullOrEmpty(controlName) && string.IsNullOrEmpty(controlFrame))
            {
                control = SearchElement(Source, controlName);

                webControlLocator =
                    By.XPath(string.Format(GenericControlXPath, control.GetAttribute(DOMAttributes.ControlNameAttribute)));
            }
            else if (string.IsNullOrEmpty(controlName) && !string.IsNullOrEmpty(controlFrame))
            {
                control = SearchElementContainer(Source, controlFrame);

                controlName = controlFrame;

                webControlLocator =
                    By.XPath(string.Format(GenericControlXPath, control.GetAttribute(DOMAttributes.ControlNameAttribute)));
            }
            else
            {
                // The control has a container
                IElement container = SearchElementContainer(Source, controlFrame);
                control = SearchElement(container.OuterHtml, controlName);

                webControlLocator =
                    By.XPath(string.Format(GenericContainerControlXPath,
                                           container.GetAttribute(DOMAttributes.ControlNameAttribute),
                                           control.GetAttribute(DOMAttributes.ControlNameAttribute)));
            }

            // The control type value of the custom attribute from the HTML element.
            string controlType = control.GetAttribute(DOMAttributes.ControlTypeAttribute);

            // The enum value from the ControlType enum.
            ControlType enumControlTypeValue = DescriptionAttributeUtil.GetValueFromDescription <ControlType>(controlType);

            // The web control Type from the current assembly.
            Type webControlType = AssemblyHelper.GetTypeFromAssembly(enumControlTypeValue.ToString(), _currentAssembly);

            // the WebControl instance.
            dynamic webControl = Activator.CreateInstance(webControlType, controlName, webControlLocator,
                                                          Config.ImplicitTimeoutInSeconds);

            return(webControl);
        }
Exemplo n.º 14
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement("moduleControl");
     WriteXmlInternal(writer);
     writer.WriteElementString("controlTitle", ControlTitle);
     writer.WriteElementString("controlType", ControlType.ToString());
     writer.WriteElementString("iconFile", IconFile);
     writer.WriteElementString("helpUrl", HelpURL);
     if (ViewOrder > Null.NullInteger)
     {
         writer.WriteElementString("viewOrder", ViewOrder.ToString());
     }
     writer.WriteEndElement();
 }
Exemplo n.º 15
0
        /// <summary>
        /// 重写文本输入框的输出(简单模式,用于表格里编辑使用)
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOutSimple(HtmlTextWriter writer)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "99999");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddAttribute("clstype", ControlType.ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-inline");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, (this.ReadOnly ? "" : "layui-input ") + "tableInput" + (this.ReadOnly ? " layui-input-readonly" : ""));
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID + "_D");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_D");
            if (!string.IsNullOrEmpty(this.FieldName))
            {
                writer.AddAttribute("FieldName", this.FieldName);
            }
            if (!string.IsNullOrEmpty(this.FieldAlias))
            {
                writer.AddAttribute("FieldAlias", this.FieldAlias);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "30px");
            if (!this.ReadOnly)
            {
                writer.AddAttribute("onfocus", "JointDynaminCombox.Init('" + this.ClientID + "_D" + "');");
                writer.AddAttribute("onkeyup", "JointDynaminCombox.OnKeyUp('" + this.ClientID + "_D" + "');");
                //writer.AddAttribute("onblur", "JointDynaminCombox.Blur(this);");
            }
            if (!string.IsNullOrEmpty(this.HiddenTrueValue))
            {
                writer.AddAttribute("lay-value", this.HiddenTrueValue);
            }
            if (!string.IsNullOrEmpty(this.DefaultValue))
            {
                writer.AddAttribute("value", this.DefaultValue);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-icon layui-icon-triangle-d");
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "top:20%;right:7px;position:absolute;color:#c2c2c2;cursor:pointer;");
            writer.AddAttribute("onclick", "JointDynaminCombox.Show('" + this.ClientID + "_D" + "', true);$('#" + this.ClientID + "_D" + "').focus();");
            writer.RenderBeginTag(HtmlTextWriterTag.I);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.Write("<script type='text/javascript' language='javascript'>" + this.ClientInitScript + "</script>");
        }
Exemplo n.º 16
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            var type = ControlType.ToString().ToUpperInvariant();

            builder.Append(type);

            if (!String.IsNullOrEmpty(Label))
            {
                builder.AppendFormat(" '{0}'", Label);
            }

            if (WhenExpression != null)
            {
                builder.AppendFormat(" WHEN {0}", WhenExpression);
            }
        }
Exemplo n.º 17
0
    public static void SaveXML()
    {
        XmlDocument xmlDoc = new XmlDocument();

        try
        {
            xmlDoc.Load(path);
            foreach (XmlNode add in xmlDoc.GetElementsByTagName("add"))
            {
                if (add.Attributes["key"].Value == "DEVICE_ID")
                {
                    add.Attributes["value"].Value = DeviceId;
                }
                if (add.Attributes["key"].Value == "IP")
                {
                    add.Attributes["value"].Value = ServerIP;
                }
                if (add.Attributes["key"].Value == "PORT")
                {
                    add.Attributes["value"].Value = ServerPort;
                }
                if (add.Attributes["key"].Value == "SMENA")
                {
                    add.Attributes["value"].Value = Smena.ToString();
                }
                if (add.Attributes["key"].Value == "LOCATION")
                {
                    add.Attributes["value"].Value = Location.ToString();
                }
                if (add.Attributes["key"].Value == "CONTROL_TYPE")
                {
                    add.Attributes["value"].Value = ControlType.ToString();
                }
                if (add.Attributes["key"].Value == "CONTROL_TABNO")
                {
                    add.Attributes["value"].Value = ControlTabNo.ToString();
                }
            }
            xmlDoc.Save(path);
        }
        catch (Exception exp)
        {
            MessageBox.Show("Отсутствует файл настроек или неверные настройки!\n\n" + exp, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
        }
    }
Exemplo n.º 18
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Writes a ModuleControlInfo to an XmlWriter
        /// </summary>
        /// <param name="writer">The XmlWriter to use</param>
        /// -----------------------------------------------------------------------------
        public void WriteXml(XmlWriter writer)
        {
            //Write start of main elemenst
            writer.WriteStartElement("moduleControl");

            //write out properties
            WriteXmlInternal(writer);
            writer.WriteElementString("controlTitle", ControlTitle);
            writer.WriteElementString("controlType", ControlType.ToString());
            writer.WriteElementString("iconFile", IconFile);
            writer.WriteElementString("helpUrl", HelpURL);
            writer.WriteElementString("supportsPopUps", SupportsPopUps.ToString());
            if (ViewOrder > Null.NullInteger)
            {
                writer.WriteElementString("viewOrder", ViewOrder.ToString());
            }
            //Write end of main element
            writer.WriteEndElement();
        }
Exemplo n.º 19
0
        public static UIACondition GetCondition(UIACondition parentCondition, ITestObject testObject, ControlType controlType)
        {
            string        controlName             = "";
            UIATestObject beforeAnalyzeConditions = (UIATestObject)testObject;

            //TODO find the xmlname

            /*
             * string[] splitcondtion = conditions.Split(new string[] { DescriptionString.PropertySplitString }, StringSplitOptions.None);
             *
             * foreach (string c in splitcondtion)
             * {
             *  if (!c.Contains(DescriptionString.AssignOperator))
             *  {
             *      xmlname = c;
             *      break;
             *  }
             * }*/

            if (controlName != "")
            {
                throw new NotImplementedException();
                //testObject = UIAJsonPersister.LoadData(controlName, parentCondition.TestObject);
            }

            UIACondition selfCondition = new UIACondition(beforeAnalyzeConditions, parentCondition);

            AutomationElement element = null;

            element = FindAutomationElement(selfCondition);

            if (element != null)
            {
                selfCondition.AutomationElement = element;
                selfCondition.ParentCondition.AddChild(selfCondition);
            }
            else
            {
                _Logger.WriteWarning("Object no found:" + controlType.ToString() + " ,Condition:" + testObject);
            }
            return(selfCondition);
        }
Exemplo n.º 20
0
        protected virtual string GetDetailControl(ControlType control)
        {
            switch (control)
            {
            case ControlType.CheckBoxList:
            case ControlType.MultipleEasySearch:
                return("DetailMultiSelect");

            case ControlType.RichText:
                return("DetailHTML");

            case ControlType.TextArea:
                return("DetailTextArea");

            case ControlType.Label:
            case ControlType.Text:
            case ControlType.Date:
            case ControlType.DateTime:
            case ControlType.Time:
            case ControlType.Combo:
            case ControlType.CheckBox:
            case ControlType.Password:
            case ControlType.EasySearch:
            case ControlType.Custom:
            case ControlType.RadioGroup:
                return("Detail");

            case ControlType.Hidden:
                return(control.ToString());

            case ControlType.ListBox:
            case ControlType.FolderPicker:
            case ControlType.FilePicker:
            case ControlType.FontPicker:
            case ControlType.ColorPicker:
                TkDebug.ThrowToolkitException(string.Format(ObjectUtil.SysCulture,
                                                            "系统不支持{0}控件", control), this);
                break;
            }
            return(string.Empty);
        }
Exemplo n.º 21
0
        internal void RenderColumn(RenderContext context, Int32 colIndex)
        {
            CheckValid();
            var column = new TagBuilder("data-grid-column");

            SetColumnRole(column);

            MergeBindingAttribute(context, column, "header", nameof(Header), Header);

            MergeBindingAttributeBool(column, context, "v-if", nameof(If), If);

            MergeBoolAttribute(column, context, nameof(Editable), Editable);
            if (_noPadding)
            {
                column.MergeAttribute(":no-padding", "true");
            }
            if (Sort != null)
            {
                column.MergeAttribute(":sort", Sort.Value.ToString().ToLowerInvariant());
            }
            if (SortProperty != null)
            {
                column.MergeAttribute("sort-prop", SortProperty);
            }
            if (Small != null)
            {
                column.MergeAttribute(":small", Small.Value.ToString().ToLowerInvariant());
            }

            var boldBind = GetBinding(nameof(Bold));

            if (boldBind != null)
            {
                column.MergeAttribute("bold", $"{{{boldBind.GetPath(context)}}}");
            }
            else if (Bold != null)
            {
                column.MergeAttribute("bold", Bold.Value.ToString().ToLowerInvariant());
            }

            MergeBoolAttribute(column, context, nameof(Fit), Fit);
            if (Width != null)
            {
                column.MergeAttribute("width", Width.Value);
            }
            var iconBind = GetBinding(nameof(Icon));

            if (iconBind != null)
            {
                column.MergeAttribute("bind-icon", iconBind.Path /*without context*/);
            }
            else if (Icon != Icon.NoIcon)
            {
                column.MergeAttribute("icon", Icon.ToString().ToKebabCase());
            }
            if (Wrap != WrapMode.Default)
            {
                column.MergeAttribute("wrap", Wrap.ToString().ToKebabCase(), true);
            }

            var markBind = GetBinding(nameof(Mark));

            if (markBind != null)
            {
                column.MergeAttribute("mark", markBind.Path /*!without context!*/);
            }
            else if (Mark != null)
            {
                throw new XamlException("The Mark property must be a binding");
            }

            CreateEditable();

            Boolean isTemplate = Content is UIElementBase;
            String  tmlId      = null;

            if (!isTemplate)
            {
                // always content without a SEMICOLON!
                var bindProp = GetBinding(nameof(Content));
                if (bindProp != null)
                {
                    column.MergeAttribute("content", bindProp.Path /*!without context!*/);
                    if (bindProp.DataType != DataType.String)
                    {
                        column.MergeAttribute("data-type", bindProp.DataType.ToString());
                    }
                    if (bindProp.HideZeros)
                    {
                        column.MergeAttribute(":hide-zeros", "true");
                    }
                    if (!String.IsNullOrEmpty(bindProp.Format))
                    {
                        column.MergeAttribute("format", bindProp.Format);
                    }
                }
                else if (Content != null)
                {
                    throw new XamlException($"The Content property must be a binding ({Content})");
                }
            }

            Bind ctBind = GetBinding(nameof(ControlType));

            if (ctBind != null)
            {
                column.MergeAttribute(":control-type", ctBind.Path /*!without context!*/);
            }
            else if (ControlType != ColumnControlType.Default)
            {
                column.MergeAttribute("control-type", ControlType.ToString().ToLowerInvariant());
            }

            var alignProp = GetBinding(nameof(Align));

            if (alignProp != null)
            {
                column.MergeAttribute(":align", alignProp.Path /*!without context!*/, true);
            }
            else if (Align != TextAlign.Default)
            {
                column.MergeAttribute("align", Align.ToString().ToLowerInvariant(), true);
            }

            if (isTemplate)
            {
                tmlId = $"col{colIndex}";
                column.MergeAttribute("id", tmlId);
            }

            var cmdBind = GetBindingCommand(nameof(Command));

            if (cmdBind != null)
            {
                column.MergeAttribute(":command", cmdBind.GetCommand(context, indirect: true));
            }
            column.RenderStart(context);
            column.RenderEnd(context);
            if (isTemplate)
            {
                var templ = new TagBuilder("template");
                templ.MergeAttribute("slot", tmlId);
                templ.MergeAttribute("slot-scope", "cell");
                templ.RenderStart(context);
                using (var ctx = new ScopeContext(context, "cell.row", null))
                {
                    (Content as UIElementBase).RenderElement(context);
                }
                templ.RenderEnd(context);
            }
        }
Exemplo n.º 22
0
        public void Save(MOG_Ini pIni, string section)
        {
            // Write the type out to the INI
            pIni.PutString(section, Type_Key, ControlType.ToString());

            // Write our location out to the INI
            pIni.PutString(section, Location_Key, Location.ToString());

            // Write the name of the control out to our INI
            pIni.PutString(section, ControlName_Key, ControlName);
            // Write our TagName
            pIni.PutString(section, TagName_Key, TagName);

            // Write our Command
            pIni.PutString(section, Command_Key, Command);
            // Write whether or not we will be hiding output window
            pIni.PutBool(section, HideWindow_Key, HideOutput);

            // (ADD_HERE):  Any new Controls must be added here...

            pIni.PutString(section, VisisbleIndex_Key, VisibleIndex.ToString());

            // Write our arguments
            pIni.PutString(section, Arguments_Key, Arguments);
            pIni.PutString(section, ArgumentsTrue_Key, ArgumentTrue);
            pIni.PutString(section, ArgumentsFalse_Key, ArgumentFalse);

            // Write our ToolTipString
            pIni.PutString(section, ToolTip_Key, ToolTipString);

            // Write the folder path we will start at for dialogs
            pIni.PutString(section, FolderName_Key, FolderName);

            // Write out the depth we will support for this def's ComboBox
            pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString());

            // Write out the show full paths bool
            pIni.PutString(section, ShowFullPaths_Key, ShowFullPaths.ToString());
            pIni.PutString(section, ShowWorkspaceRelativePaths_Key, ShowWorkspaceRelativePaths.ToString());
            pIni.PutString(section, ShowFolderRelativePaths_Key, ShowFolderRelativePaths.ToString());
            pIni.PutString(section, ShowBasePaths_Key, ShowBasePaths.ToString());

            // Write out the relative paths bool
            pIni.PutString(section, FullPaths_Key, TagFullPaths.ToString());
            pIni.PutString(section, WorkspaceRelativePaths_Key, TagWorkspaceRelativePaths.ToString());
            pIni.PutString(section, FolderRelativePaths_Key, TagFolderRelativePaths.ToString());
            pIni.PutString(section, BasePaths_Key, TagBasePaths.ToString());

            pIni.PutString(section, RecurseFolders_Key, RecurseFolders.ToString());

            // Write our IniSectionName
            pIni.PutString(section, IniSection_Key, IniSectionName);
            // Write out our IniFilename
            pIni.PutString(section, IniFilename_Key, IniFilename);
            // Write out our GUID
            pIni.PutString(section, GUID_Key, section);

            // Write out our ComboBoxDepth
            pIni.PutString(section, ComboBoxDepth_Key, ComboBoxDepth.ToString());

            // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
            string usersLastIndex_Key = MOG_ControllerProject.IsUser() ? LastIndex_Key + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): LastIndex_Key;

            pIni.PutString(section, usersLastIndex_Key, LastSelectedIndex.ToString());

            // If we are a fileComboBox write out our items
            if (ControlType == ToolBoxControlType.FileCombo)
            {
                // By adding the scope of the user's name to the section key we can retain a user's own settings seperatly from the rest of the team
                string usersSection = MOG_ControllerProject.IsUser() ? section + ComboItems_Section + SubSectionIndicator_Text + MOG_ControllerProject.GetUserName(): section + ComboItems_Section;

                int count = 0;
                foreach (MogTaggedString item in DefComboBox.Items)
                {
                    pIni.PutString(usersSection, ComboItems_Key + count++, (string)item.AttachedItem);
                }
            }

            // Write out the fileComboBox patterns
            pIni.PutString(section, Pattern_Key, Pattern);

            // If we are a ToolBoxGroupBox, write out our radio buttons
            if (ControlType == ToolBoxControlType.RadioButton)
            {
                foreach (DictionaryEntry button in RadioButtons)
                {
                    pIni.PutString(section + RadioButton_Section, (string)button.Key, (string)button.Value);
                }
            }
        }
Exemplo n.º 23
0
        IControlData m_controlData;                     // 컨트롤 데이터


        //-------------------------------------------------------------------------------------

        /// <summary>
        /// 타입 체크 후 지정된 형식의 OptionalData 할당
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="typeCheck"></param>
        private T CheckOptionData <T>(ControlType typeCheck)
            where T : class, IControlData, new()
        {
            if (controlType != typeCheck)                                                               // 타입체크
            {
                Debug.LogError(string.Format("cannot call {0} without {1} controlType", typeof(T).Name, typeCheck.ToString()));
            }

            T data = m_controlData as T;

            if (data == null)                                                                                           // 생성 안된 경우에는 새로 생성
            {
                data          = new T();
                m_controlData = data;
            }

            return(data);
        }
Exemplo n.º 24
0
 public override string ToString()
 {
     return($"{Type.ToString()}");
 }
Exemplo n.º 25
0
 UITestControl getControl(ControlType controlType, BrowserWindow browser, string buttonId)
 {
     UITestControl button = new UITestControl(browser);
        button.TechnologyName = "Web";
        var controlTypeString = controlType.ToString();
        button.SearchProperties.Add("ControlType", controlTypeString);
        button.SearchProperties.Add("Id", buttonId);
        var buttons = button.FindMatchingControls();
        button.Find();
        return button;
 }
Exemplo n.º 26
0
        /// <summary>
        /// 重写下拉选择框的输出
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOut(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-inline");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "75%");
            writer.AddStyleAttribute("max-width", ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            writer.AddAttribute(HtmlTextWriterAttribute.Class, (this.ReadOnly ? "" : "layui-input ") + "tableInput" + (this.ReadOnly ? " layui-input-readonly" : ""));
            writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            if (!string.IsNullOrEmpty(this.FieldName))
            {
                writer.AddAttribute("FieldName", this.FieldName);
            }
            if (!string.IsNullOrEmpty(this.FieldAlias))
            {
                writer.AddAttribute("FieldAlias", this.FieldAlias);
            }
            if (this.IsForSave)
            {
                writer.AddAttribute("IsForSave", this.IsForSave ? "true" : "false");
            }
            writer.AddAttribute("required", this.IsRequired ? "true" : "false");
            if (!string.IsNullOrEmpty(this.VerifyType) || this.IsRequired)
            {
                writer.AddAttribute("lay-verify", "required");
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Type, "text");
            //writer.AddStyleAttribute(HtmlTextWriterStyle.Width, ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "30px");
            if (!this.ReadOnly)
            {
                writer.AddAttribute("onfocus", "JointDynaminCombox.Init('" + this.ClientID + "');");
                writer.AddAttribute("onkeyup", "JointDynaminCombox.OnKeyUp('" + this.ClientID + "');");
                writer.AddAttribute("placeholder", string.IsNullOrEmpty(this.PlaceHolder) ? "请输入" + this.LabelText : this.PlaceHolder);
            }
            if (!string.IsNullOrEmpty(this.HiddenTrueValue))
            {
                writer.AddAttribute("lay-value", this.HiddenTrueValue);
            }
            if (!string.IsNullOrEmpty(this.DefaultValue))
            {
                if (!string.IsNullOrEmpty(this.RefDataEntityColID))
                {
                    writer.AddAttribute("value", this.GetRefDataEntityColValue(this.RefDataEntityColID, this.DefaultValue));
                }
                else
                {
                    writer.AddAttribute("value", this.DefaultValue);
                }
            }
            writer.AddAttribute("clstype", ControlType.ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-icon layui-icon-triangle-d");
            writer.AddAttribute(HtmlTextWriterAttribute.Style, "top:20%;right:7px;position:absolute;color:#c2c2c2;cursor:pointer;");
            writer.AddAttribute("onclick", "JointDynaminCombox.Show('" + this.ClientID + "', true);$('#" + this.ClientID + "').focus();");
            writer.RenderBeginTag(HtmlTextWriterTag.I);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.Write("<script type='text/javascript' language='javascript'>" + this.ClientInitScript + "</script>");
        }
Exemplo n.º 27
0
        /// <summary>
        /// Add method for Button, Checkbox, Radio Button, ComboBox, ProgressBar, Spin Button, and Tab Control
        /// </summary>
        /// <param name="ct">Control type</param>
        /// <param name="skin">Control image</param>
        public void Add(ControlType ct, Bitmap skin)
        {
            if (skin == null)
                throw new Exception("Required image is either missing or invalid.");

            List<IntPtr> list = GetChildWindows(_hParentWnd);
            StringBuilder nameBldr = new StringBuilder(100);
            string ctlname = ct.ToString().ToLower();

            if ((ctlname == "button") || (ctlname == "checkbox") || (ctlname == "radiobutton"))
            {
                if (_cButtonSkin == null)
                    _cButtonSkin = new cButton(_hParentWnd);
                if (ctlname == "checkbox")
                    _cButtonSkin.CheckboxGraphic = skin;
                else if (ctlname == "radiobutton")
                    _cButtonSkin.RadiobuttonGraphic = skin;
                else if (ctlname == "button")
                {

                    if (TransitionGraphic != null)
                        _cButtonSkin.TransitionGraphic = TransitionGraphic;
                    _cButtonSkin.PushbuttonGraphic = skin;
                }
            }
            else if (ctlname == "combobox")
            {
                if (_oComboSkin == null)
                    _oComboSkin = new Dictionary<IntPtr, cComboBox>();
            }
            else if (ctlname == "numericupdown")
            {
                if (_oNumericUpDownSkin == null)
                    _oNumericUpDownSkin = new Dictionary<IntPtr, cNumericUpDown>();
            }
            else if (ctlname == "progressbar")
            {
                if (_oProgressBarSkin == null)
                    _oProgressBarSkin = new Dictionary<IntPtr, cProgressBar>();
            }
            else if (ctlname == "tabcontrol")
            {
                if (_oTabControlSkin == null)
                    _oTabControlSkin = new Dictionary<IntPtr, cTabControl>();
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] != IntPtr.Zero)
                {
                    Control ctl = Control.FromHandle(list[i]);
                    if (ctl != null)
                    {
                        Type t = ctl.GetType();
                        string name = t.Name.ToLower();
                        if (name == ctlname)
                        {
                            AddControl(ctlname, list[i], skin);
                            if (ctlname == "tabcontrol")
                            {
                                _oTabControlSkin.Add(list[i], new cTabControl(list[i], skin));
                                TabControl tb = (TabControl)Control.FromHandle(list[i]);
                                if (UseCustomTips)
                                {
                                    _oTabControlSkin[list[i]].UseCustomToolTips(tb);
                                    _oTabControlSkin[list[i]].ToolTipEnable = true;
                                }
                                if (SkinChildControls)
                                {
                                    foreach (TabPage page in tb.Controls)
                                    {
                                        foreach (Control tabElement in page.Controls)
                                        {
                                            Type elementType = tabElement.GetType();
                                            AddControl(elementType.Name.ToLower(), tabElement.Handle, skin);
                                        }
                                    }
                                }
                            }
                            ctl.Refresh();
                        }
                    }
                }
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Add method for ListView control.
        /// </summary>
        /// <param name="ct">Control type [ListView]</param>
        /// <param name="header">Header image</param>
        /// <param name="hztrack">Horizontal track image</param>
        /// <param name="hzarrow">Horizontal arrow image</param>
        /// <param name="hzthumb">Horizontal thumb image</param>
        /// <param name="vttrack">Vertical track image</param>
        /// <param name="vtarrow">Vertical arrow image</param>
        /// <param name="vtthumb">Vertical thumb image</param>
        public void Add(ControlType ct, Bitmap header, Bitmap hztrack, Bitmap hzarrow, Bitmap hzthumb, Bitmap vttrack, Bitmap vtarrow, Bitmap vtthumb)
        {
            List<IntPtr> list = GetChildWindows(_hParentWnd);
            StringBuilder nameBldr = new StringBuilder(100);
            string ctlname = ct.ToString().ToLower();
            if (ctlname == "listview")
            {
                if (_oListviewSkin == null)
                    _oListviewSkin = new Dictionary<IntPtr, cListView>();

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] != IntPtr.Zero)
                    {
                        Control ctl = Control.FromHandle(list[i]);
                        if (ctl != null)
                        {
                            Type t = ctl.GetType();
                            string name = t.Name.ToLower();
                            if (name == ctlname)
                            {
                                _oListviewSkin.Add(ctl.Handle, new cListView(ctl.Handle, header, hztrack, hzarrow, hzthumb, vttrack, vtarrow, vtthumb, TransitionGraphic));
                                ctl.Refresh();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// Add method for Trackbar control
        /// </summary>
        /// <param name="ct">Control type [TrackBar]</param>
        /// <param name="thumb">Thumb image</param>
        /// <param name="track">Track image</param>
        public void Add(ControlType ct, Bitmap thumb, Bitmap track)
        {
            if (thumb == null)
                throw new Exception("Required image is either missing or invalid.");
            if (track == null)
                throw new Exception("Required image is either missing or invalid.");

            List<IntPtr> list = GetChildWindows(_hParentWnd);
            StringBuilder nameBldr = new StringBuilder(100);
            string ctlname = ct.ToString().ToLower();
            if (ctlname == "trackbar")
            {
                if (_oTrackBarSkin == null)
                    _oTrackBarSkin = new Dictionary<IntPtr, cTrackBar>();

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] != IntPtr.Zero)
                    {
                        Control ctl = Control.FromHandle(list[i]);
                        if (ctl != null)
                        {
                            Type t = ctl.GetType();
                            string name = t.Name.ToLower();
                            if (name == ctlname)
                            {
                                _oTrackBarSkin.Add(ctl.Handle, new cTrackBar(ctl.Handle, thumb, track));
                                ctl.Refresh();
                            }
                        }
                    }
                }
            }
        }
        public XmlNode exportXMLnode()
        {
            XmlDocument   xmlDoc        = new XmlDocument();
            StringWriter  stringWriter  = new StringWriter();
            XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter);
            XmlNode       rootNode      = null;

            if (isNodeComment)
            {
                rootNode = xmlDoc.CreateComment(comment);
                xmlDoc.AppendChild(rootNode);
                return(rootNode);
            }
            rootNode = xmlDoc.CreateElement(donType.ToString());
            xmlDoc.AppendChild(rootNode);

            if (masterType == MasterTypes.IEC61850Client)
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    rootNode.Attributes.Append(attrName);
                }

                XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType");
                attr1.Value = Iec61850DOResponseType.ToString();
                rootNode.Attributes.Append(attr1);

                XmlAttribute attr2 = xmlDoc.CreateAttribute("Index");
                attr2.Value = Iec61850DOIndex.ToString();
                rootNode.Attributes.Append(attr2);

                XmlAttribute attrfc = xmlDoc.CreateAttribute("FC");
                attrfc.Value = FC.ToString();
                rootNode.Attributes.Append(attrfc);

                XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex");
                attr3.Value = SubIndex.ToString();
                rootNode.Attributes.Append(attr3);

                XmlAttribute attr4 = xmlDoc.CreateAttribute("ControlType");
                attr4.Value = ControlType.ToString();
                rootNode.Attributes.Append(attr4);

                XmlAttribute attr7 = xmlDoc.CreateAttribute("PulseDurationMS");
                attr7.Value = PulseDurationMS.ToString();
                rootNode.Attributes.Append(attr7);

                XmlAttribute attr9 = xmlDoc.CreateAttribute("EnableDI");
                attr9.Value = EnableDI.ToString();
                rootNode.Attributes.Append(attr9);

                XmlAttribute attr8 = xmlDoc.CreateAttribute("Description");
                attr8.Value = Description.ToString();
                rootNode.Attributes.Append(attr8);
            }
            else
            {
                foreach (string attr in arrAttributes)
                {
                    XmlAttribute attrName = xmlDoc.CreateAttribute(attr);
                    attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this);
                    if (attrName.Name == "EnableDI")
                    {
                        if (attrName.Value == "")
                        {
                            attrName.Value = "0";
                        }
                    }
                    rootNode.Attributes.Append(attrName);
                }
            }
            return(rootNode);
        }
Exemplo n.º 31
0
        /// <summary>
        /// 重写文本输入框的输出(简单模式,用于表格里编辑使用)
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOutSimple(HtmlTextWriter writer)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "99999");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "none");
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-unselect layui-form-select");
            writer.AddAttribute("clstype", ControlType.ToString());
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, ((Unit)this.Width.Value).ToString());
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-unselect layui-form-select");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-select-title");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            if ((!string.IsNullOrEmpty(this.ValueList) && this.ValueList.Split('^').Length > 0) || !(string.IsNullOrEmpty(this.QueryFFuncID)))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input layui-unselect" + (this.ReadOnly ? " layui-input-readonly" : ""));
                if (!string.IsNullOrEmpty(this.FieldName))
                {
                    writer.AddAttribute("FieldName", this.FieldName);
                }
                if (!string.IsNullOrEmpty(this.FieldAlias))
                {
                    writer.AddAttribute("FieldAlias", this.FieldAlias);
                }
                if (this.IsForSave)
                {
                    writer.AddAttribute("IsForSave", this.IsForSave ? "true" : "false");
                }
                if (this.IsAsynDataLoad)
                {
                    writer.AddAttribute("AsynDataLoad", "true");
                }
                if (this.IsOnlyAsynOnce)
                {
                    writer.AddAttribute("OnlyAsynOnce", "true");
                }
                writer.AddAttribute("type", "text");
                if (!this.ReadOnly)
                {
                    //writer.AddAttribute("onfocus", "JointCombobox.Show(this);");
                    writer.AddAttribute("onblur", "JointCombobox.Blur(this);");
                    //writer.AddAttribute("onclick", "JointCombobox.Show(this);");
                    writer.AddAttribute("onkeyup", "JointCombobox.KeyUp(event, this);");
                }
                else
                {
                    writer.AddAttribute("readonly", "readonly");
                }
                if (!string.IsNullOrEmpty(this.HiddenTrueValue))
                {
                    writer.AddAttribute("lay-value", this.HiddenTrueValue);
                }
                if (!string.IsNullOrEmpty(this.TargetConrtrolID))
                {
                    writer.AddAttribute("target-control", this.TargetConrtrolID);
                }
                else
                {
                    writer.AddAttribute("target-control", this.ClientID + "_D");
                }
                writer.AddAttribute("layid", this.ClientID + "_D");
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_D");
                if (!string.IsNullOrEmpty(this.DefaultValue))
                {
                    writer.AddAttribute("value", this.DefaultValue);
                }
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-edge");
                writer.AddAttribute("onclick", "JointCombobox.Show(this.parentElement.children[0], true);$('#" + this.ClientID + "_D" + "').focus();");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
            }
            else
            {
                throw new Exception("JointCombobox控件的ValueList属性值不能为空!");
            }
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-anim layui-anim-upbit");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_dl");
            writer.RenderBeginTag(HtmlTextWriterTag.Dl);
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.Write("<script type='text/javascript' language='javascript'>" + this.ClientInitScript + "</script>");
        }
Exemplo n.º 32
0
        /// <summary>
        /// 重写下拉选择框的输出
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOut(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-inline");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "75%");
            writer.AddStyleAttribute("max-width", ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-unselect layui-form-select");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-select-title");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            if ((!string.IsNullOrEmpty(this.ValueList) && this.ValueList.Split('^').Length > 0) || !(string.IsNullOrEmpty(this.QueryFFuncID)))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.ReadOnly ? "layui-input-readonly" : "layui-input layui-unselect");
                //writer.AddStyleAttribute(HtmlTextWriterStyle.Width, ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
                writer.AddAttribute(HtmlTextWriterAttribute.Name, this.ClientID);
                writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
                if (!string.IsNullOrEmpty(this.FieldName))
                {
                    writer.AddAttribute("FieldName", this.FieldName);
                }
                if (this.IsForSave)
                {
                    writer.AddAttribute("IsForSave", this.IsForSave ? "true" : "false");
                }
                writer.AddAttribute("required", this.IsRequired ? "true" : "false");
                if (!string.IsNullOrEmpty(this.VerifyType) || this.IsRequired)
                {
                    writer.AddAttribute("lay-verify", "required");
                }
                if (this.IsAsynDataLoad)
                {
                    writer.AddAttribute("AsynDataLoad", "true");
                }
                if (this.IsOnlyAsynOnce)
                {
                    writer.AddAttribute("OnlyAsynOnce", "true");
                }
                writer.AddAttribute("type", "text");
                if (!this.ReadOnly)
                {
                    writer.AddAttribute("onfocus", "JointCombobox.Show(this);");
                    writer.AddAttribute("onblur", "JointCombobox.Blur(this);");
                    writer.AddAttribute("onclick", "JointCombobox.Show(this);");
                    writer.AddAttribute("onkeyup", "JointCombobox.KeyUp(event, this);");
                    writer.AddAttribute("placeholder", string.IsNullOrEmpty(this.PlaceHolder) ? "请输入" + this.LabelText : this.PlaceHolder);
                }
                if (!this.IsQuickFilter)
                {
                    writer.AddAttribute("readonly", "readonly");
                }
                if (!string.IsNullOrEmpty(this.HiddenTrueValue))
                {
                    writer.AddAttribute("lay-value", this.HiddenTrueValue);
                }
                if (!string.IsNullOrEmpty(this.TargetConrtrolID))
                {
                    writer.AddAttribute("target-control", this.TargetConrtrolID);
                }
                else
                {
                    writer.AddAttribute("target-control", this.ClientID);
                }
                writer.AddAttribute("layid", this.ClientID);

                if (!string.IsNullOrEmpty(this.DefaultValue))
                {
                    if (!string.IsNullOrEmpty(this.RefDataEntityColID))
                    {
                        writer.AddAttribute("value", this.GetRefDataEntityColValue(this.RefDataEntityColID, this.DefaultValue));
                    }
                    else
                    {
                        writer.AddAttribute("value", this.DefaultValue);
                    }
                }
                writer.AddAttribute("clstype", ControlType.ToString());
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-edge");
                writer.RenderBeginTag(HtmlTextWriterTag.I);
                writer.RenderEndTag();
            }
            else
            {
                throw new Exception("JointCombobox控件的ValueList属性值不能为空!");
            }
            writer.RenderEndTag();
            writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-anim layui-anim-upbit");
            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_dl");
            writer.RenderBeginTag(HtmlTextWriterTag.Dl);
            writer.RenderEndTag();
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.Write("<script type='text/javascript' language='javascript'>" + this.ClientInitScript + "</script>");
        }
Exemplo n.º 33
0
        /// <summary>
        /// Add method for the ScrollBar control
        /// </summary>
        /// <param name="ct">Control type [ScrollBar]</param>
        /// <param name="track">Track image</param>
        /// <param name="arrow">Arrow image</param>
        /// <param name="thumb">Thumb image</param>
        /// <param name="orientation">ScrollbBar orientation</param>
        public void Add(ControlType ct, Bitmap track, Bitmap arrow, Bitmap thumb, Orientation orientation)
        {
            List<IntPtr> list = GetChildWindows(_hParentWnd);
            StringBuilder nameBldr = new StringBuilder(100);
            string ctlname = ct.ToString().ToLower();
            if (ctlname == "scrollbar")
            {
                if (_oScrollbarSkin == null)
                    _oScrollbarSkin = new Dictionary<IntPtr, cScrollBar>();

                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] != IntPtr.Zero)
                    {
                        Control ctl = Control.FromHandle(list[i]);
                        if (ctl != null)
                        {
                            Type t = ctl.GetType();
                            string name = t.Name.ToLower();
                            //Debug.Print(name);
                            if (orientation == Orientation.Horizontal)
                            {
                                if (name == "hscrollbar")
                                {
                                    _oScrollbarSkin.Add(ctl.Handle, new cScrollBar(ctl.Handle, Orientation.Horizontal, thumb, track, arrow, TransitionGraphic));
                                    ctl.Refresh();
                                }
                            }
                            else
                            {
                                if (name == "vscrollbar")
                                {
                                    _oScrollbarSkin.Add(ctl.Handle, new cScrollBar(ctl.Handle, Orientation.Vertical, thumb, track, arrow, TransitionGraphic));
                                    ctl.Refresh();
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 34
0
        /// <summary>
        /// 重写文本输入框的输出
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderTextBoxOut(HtmlTextWriter writer)
        {
            if (this.IsEnableSmartHint && !string.IsNullOrEmpty(this.SmartHintContent))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-inline");
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "75%");
                writer.AddStyleAttribute("max-width", ((Unit)(this.Width.Value - this.LabelWidth.Value)).ToString());
            }
            else
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "75%");
                writer.AddStyleAttribute("max-width", ((Unit)(this.Width.Value - this.LabelWidth.Value - 35)).ToString());
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-inline");
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            //添加CSS样式属性
            this.LoadControlCssStyle(writer);

            #region 添加属性

            if (this.ReadOnly)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-input-readonly");
            }
            else
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Type, this.PassWord ? "password" : "text");
            if (!string.IsNullOrEmpty(this.Title))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, this.Title);
            }

            //公共属性输出(和简单模式共用)
            this.LoadCommonAttribute(writer);

            if (this.IsRequired)
            {
                writer.AddAttribute("required", "true");
            }

            if (!string.IsNullOrEmpty(this.VerifyType) || this.IsRequired)
            {
                writer.AddAttribute("lay-verify", !string.IsNullOrEmpty(this.VerifyType) ? this.VerifyType : "required");
            }

            if (!this.ReadOnly)
            {
                if (!string.IsNullOrEmpty(this.PlaceHolder))
                {
                    writer.AddAttribute("placeholder", this.PlaceHolder);
                }
                else if (this.IsRequired)
                {
                    writer.AddAttribute("placeholder", "请输入" + this.LabelText);
                }
            }

            //AutoSwithIME 尚未实现
            //if (this.AutoSwithIME)
            //{
            //    this.OnFocus += "SuccTextField.AutoSwithIME('" + this.ClientID + "',true);";
            //}

            if (this.ReadOnly)
            {
                writer.AddAttribute("readonly", "readonly");
            }

            writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID);
            if (!string.IsNullOrEmpty(this.DefaultValue))
            {
                if (!string.IsNullOrEmpty(this.RefDataEntityColID))
                {
                    writer.AddAttribute("value", this.GetRefDataEntityColValue(this.RefDataEntityColID, this.DefaultValue));
                }
                else
                {
                    writer.AddAttribute("value", this.DefaultValue);
                }
            }
            if (this.Radius)
            {
                writer.AddAttribute("style", "border-radius: 3px;");
            }

            this.AddAttributeToText(writer);

            #endregion
            writer.AddAttribute("clstype", ControlType.ToString());
            if (this.MultiLine)
            {
                if (!string.IsNullOrEmpty(this.Height.ToString()))
                {
                    writer.AddStyleAttribute(HtmlTextWriterStyle.Height, this.Height.ToString());
                }
                // 去掉IE内核浏览器后侧的树向滚动条
                writer.AddStyleAttribute(HtmlTextWriterStyle.Overflow, "auto");
                writer.RenderBeginTag(HtmlTextWriterTag.Textarea);
                writer.Write(this.DefaultValue);
            }
            else
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
            }
            writer.RenderEndTag();
            this.AddControlToInput(writer);
            writer.RenderEndTag();
            if (this.IsEnableSmartHint && !string.IsNullOrEmpty(this.SmartHintContent))
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "layui-form-mid layui-word-aux");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                writer.Write(this.SmartHintContent);
                writer.RenderEndTag();
            }
        }
Exemplo n.º 35
0
 public string getType()
 {
     return(type.ToString());
 }
Exemplo n.º 36
0
        private static MvcHtmlString RenderControlList(this HtmlHelper htmlHelper, string name, IEnumerable <SelectListItem> selectList, ControlType controlType, RepeatDirection direction, IDictionary <string, object> htmlAttributes = null, bool createUsingID = true)
        {
            string     htmlItem;
            TagBuilder container;

            if (direction == RepeatDirection.GroupList)
            {
                container = new TagBuilder("ul");
            }
            else
            {
                container = new TagBuilder("div");
            }

            // container.MergeAttribute("style", "clear: both");
            container.MergeAttribute("id", "checkboxlist-container");

            foreach (var item in selectList)
            {
                TagBuilder lineContainer;
                TagBuilder input     = new TagBuilder("input");
                TagBuilder span      = new TagBuilder("label");
                var        controlID = "";
                if (direction == RepeatDirection.GroupList)
                {
                    lineContainer = new TagBuilder("li");
                }
                else
                {
                    lineContainer = new TagBuilder("div");
                }

                if (createUsingID)
                {
                    controlID = String.Format("{0}_{1}", name, item.Value);
                }
                else
                {
                    controlID = name;
                }

                span.InnerHtml = item.Text;
                span.MergeAttribute("for", controlID);

                input.MergeAttribute("type", controlType.ToString().ToLower());
                input.MergeAttribute("name", name);
                input.MergeAttribute("id", controlID);
                input.MergeAttribute("value", item.Value);
                if (htmlAttributes != null)
                {
                    input.MergeAttributes(new RouteValueDictionary(htmlAttributes), true);
                }

                if (item.Selected)
                {
                    input.MergeAttribute("checked", "checked");
                }

                if (direction == RepeatDirection.GroupHorizontal)
                {
                    lineContainer.Attributes.Add("style", "float:left");
                }

                htmlItem = input.ToString() + span.ToString();
                if (direction != RepeatDirection.NoLineContainer)
                {
                    lineContainer.InnerHtml = htmlItem;
                    container.InnerHtml    += lineContainer.ToString();
                }
                else
                {
                    container.InnerHtml += htmlItem;
                }
            }
            return(MvcHtmlString.Create(container.ToString()));
        }
Exemplo n.º 37
0
 public override void AppendSubBuilder(ControlBuilder subBuilder)
 {
     throw new HttpException(SR.GetString(SR.Control_does_not_allow_children,
                                          ControlType.ToString()));
 }
Exemplo n.º 38
0
        /// <summary>
        /// Remove a control group from the skin engine
        /// </summary>
        /// <param name="ct">Control type</param>
        public void Remove(ControlType ct)
        {
            List<IntPtr> list = GetChildWindows(_hParentWnd);
            StringBuilder nameBldr = new StringBuilder(100);
            string ctlname = ct.ToString().ToLower();

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] != IntPtr.Zero)
                {
                    Control ctl = Control.FromHandle(list[i]);
                    if (ctl != null)
                    {
                        Type t = ctl.GetType();
                        string name = t.Name.ToLower();

                        if ((ctlname == "checkbox") || (ctlname == "radiobutton") || (ctlname == "button"))
                        {
                            if (name == ctlname)
                            {
                                _cButtonSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "combobox")
                        {
                            if (_oComboSkin.ContainsKey(list[i]))
                            {
                                _oComboSkin[list[i]].Dispose();
                                _oComboSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "listbox")
                        {
                            if (_oListboxSkin.ContainsKey(list[i]))
                            {
                                _oListboxSkin[list[i]].Dispose();
                                _oListboxSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "listview")
                        {
                            if (_oListviewSkin.ContainsKey(list[i]))
                            {
                                _oListviewSkin[list[i]].Dispose();
                                _oListviewSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "numericupdown")
                        {
                            if (_oNumericUpDownSkin.ContainsKey(list[i]))
                            {
                                _oNumericUpDownSkin[list[i]].Dispose();
                                _oNumericUpDownSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "progressbar")
                        {
                            if (_oProgressBarSkin.ContainsKey(list[i]))
                            {
                                _oProgressBarSkin[list[i]].Dispose();
                                _oProgressBarSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "tabcontrol")
                        {
                            if (_oTabControlSkin.ContainsKey(list[i]))
                            {
                                _oTabControlSkin[list[i]].Dispose();
                                _oTabControlSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "tracksbar")
                        {
                            if (_oTrackBarSkin.ContainsKey(list[i]))
                            {
                                _oTrackBarSkin[list[i]].Dispose();
                                _oTrackBarSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                        else if (ctlname == "treeview")
                        {
                            if (_oTreeviewSkin.ContainsKey(list[i]))
                            {
                                _oTreeviewSkin[list[i]].Dispose();
                                _oTreeviewSkin.Remove(list[i]);
                                ctl.Refresh();
                            }
                        }
                    }
                }
            }
        }