Пример #1
0
 protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DropDownList ddlRole = (e.Row.FindControl("ddlRole") as DropDownList);
         if (ddlRole != null)
         {
             ddlRole.Bind(DBReadManager.GetSecureRoles(), "Description", "RoleId");
         }
         string roleId = (e.Row.FindControl("lblRoleId") as Label).Text;
         ddlRole.Items.FindByValue(roleId).Selected = true;
         e.Row.Cells[6].Enabled = false;
     }
 }
Пример #2
0
        protected override void Build()
        {
            base.Build();

            _shader = this.AddStringList(100, "Shader", Plugins.GetKeys<ShaderDefinition>());
            _shader.Bind(this.GameObject, "Shader");

            _details = this.AddFrame(0, 0, DockStyle.Top);

            _shader.SelectedItemChanged += (s, e) =>
                {
                    BuildDetails();
                };

            BuildDetails();
        }
Пример #3
0
    protected void gvCBC_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            CheckBox     chkEnableCountry = (e.Row.FindControl("chkEnableCountry") as CheckBox);
            DropDownList ddlStatus        = (e.Row.FindControl("ddlStatus") as DropDownList);
            Button       btnSave          = (e.Row.FindControl("btnSave") as Button);
            Button       btnGenerate      = (e.Row.FindControl("btnGenerate") as Button);
            Button       btnVerify        = (e.Row.FindControl("btnVerify") as Button);
            if (chkEnableCountry != null)
            {
                bool ItemChecked = Convert.ToBoolean((e.Row.FindControl("lblEnableCountry") as Label).Text);
                chkEnableCountry.Checked = ItemChecked;
            }

            if (ddlStatus != null)
            {
                ddlStatus.Bind(DBReadManager.ValidationStatuses(), "StatusDescription", "id");
                string statusId = (e.Row.FindControl("lblStatus") as Label).Text;
                int    status   = int.Parse(statusId);

                if (status > 0)
                {
                    ddlStatus.Items.FindByValue(statusId).Selected = true;
                    ddlStatus.Enabled        = false;
                    btnSave.Enabled          = false;
                    chkEnableCountry.Enabled = false;
                    btnVerify.Enabled        = false;
                }
                else
                {
                    ddlStatus.Visible = false;
                }
                if (status >= 2)
                {
                    btnGenerate.Enabled = false;
                    btnSave.Enabled     = false;
                    btnVerify.Enabled   = true;
                }
            }
        }
    }
Пример #4
0
        private void BuildDetails()
        {
            _details.UnBind();
            _details.Controls.Clear();

            var material = this.GameObject as PluginBase.GameObjects.Material;
            //var shader = Plugins.Container.ResolveNamed<TokED.ShaderDefinition>(material.Shader);

            _depthTest = _details.AddLabeledCheckBox(100, "Depth Test:");
            _depthTest.Bind(this.GameObject, "DepthTest");

            _alphaBlend = _details.AddLabeledCheckBox(100, "Alpha Blend:");
            _alphaBlend.Bind(this.GameObject, "AlphaBlend");

            _smoothLines = _details.AddLabeledCheckBox(100, "Smooth Lines:");
            _smoothLines.Bind(this.GameObject, "SmoothLines");

            _minFilter = _details.AddEnumList(100, "Min Filter:", typeof(TextureMinFilter));
            _minFilter.Bind(this.GameObject, "MinFilter");

            _magFilter = _details.AddEnumList(100, "Mag Filter:", typeof(TextureMagFilter));
            _magFilter.Bind(this.GameObject, "MagFilter");

            //Shader Parameters
            foreach (var p in material.Parameters)
            {
                switch (p.Type)
                {
                    case ShaderParamType.Int:
                        _details.AddLabeledTextBox(100, p.LongName + ":", 1.0f).Bind(p, "IntValue").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Float:
                        _details.AddLabeledTextBox(100, p.LongName + ":", 0.02f).Bind(p, "FloatValue").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Vec2:
                        _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Vec3:
                        _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " Z:", 0.02f).Bind(p, "Z").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Vec4:
                        _details.AddLabeledTextBox(100, p.LongName + " X:", 0.02f).Bind(p, "X").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " Y:", 0.02f).Bind(p, "Y").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " Z:", 0.02f).Bind(p, "Z").Bind(this.GameObject, "ApplyParameters");
                        _details.AddLabeledTextBox(100, p.LongName + " W:", 0.02f).Bind(p, "W").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Color:
                        _details.AddLabeledColorButton(100, p.LongName + ":").Bind(p, "Color").Bind(this.GameObject, "ApplyParameters");
                        break;

                    case ShaderParamType.Texture:
                        _details.AddLabeledFilename(100, p.LongName + ":", ".png", "Texture (.png)|*.png", "Load Texture from file:")
                            .Bind(p, "Filename")
                            .Bind(this.GameObject, "NotifyChange");
                        break;
                }
            }

            _details.Size = new Point(0, 20 * _details.Controls.Count);
        }