Exemplo n.º 1
0
    protected override void CreateChildControls()
    {
        Controls.Clear();
        PropertyPanel pp;
        if (currentDef != null) {
            // Buttons
            WAFPanel pnlButtons = new WAFPanel();
            pnlButtons.Height = Unit.Pixel(25);
            pnlButtons.Border = false;
            Controls.Add(pnlButtons);

            MainButton btnSave = new MainButton();
            btnSave.Text = "Save";
            btnSave.Click += new EventHandler(btnSave_Click);
            pnlButtons.Controls.Add(btnSave);

            MainButton btnChange = new MainButton();
            btnChange.Text = "Change LCID...";
            pnlButtons.Controls.Add(btnChange);
            btnChange.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(btnChange_WorkflowMethodCompleted);
            btnChange.SetWorkflowMethod<changeLCID>(this.LCID, null, true, false, true, null);

            MainButton btnChangeFlag = new MainButton();
            btnChangeFlag.Text = "Change icon...";
            pnlButtons.Controls.Add(btnChangeFlag);
            btnChangeFlag.SetWorkflowMethod<changeIcon>(new object[] { this.LCID, WAFContext.PathFromRootToFolderSkins + "Default\\Flags\\" });

            MainButton btnDelete = new MainButton();
            btnDelete.Text = "Delete...";
            btnDelete.Click += new EventHandler(btnDelete_Click);
            btnDelete.Confirm = true;
            btnDelete.ConfirmQuestion = "Permanently delete all \"" + currentDef.Name + "\" content?";
            pnlButtons.Controls.Add(btnDelete);

            // Name
            txtName = new TextBox();
            txtName.Width = Unit.Percentage(100);
            txtName.Font.Size = new FontUnit(14, UnitType.Pixel);
            txtName.Text = currentDef.Name;

            StringBuilder htmlIcon = new StringBuilder();
            htmlIcon.Append("<img style=\"float:left; margin:5px 2px; 0px 0px;\" src=\"");
            htmlIcon.Append(WAFContext.GetUrlFromHostToCultureFlag(LCID));
            htmlIcon.Append("\" height=\"11\" width=\"16\" />");
            PropertyPanel ppCodeName = new PropertyPanel(txtName, PropertyLayout.TwoColumns, htmlIcon.ToString(), null);
            ppCodeName.TitleWidth = Unit.Pixel(50);
            ppCodeName.Height = Unit.Pixel(45);
            ppCodeName.ShowAdvancedFunctions = false;
            Controls.Add(ppCodeName);
            ppCodeName.Border = true;
            ppCodeName.MarginTop = true;

            TabbedView tab = new TabbedView();
            this.Controls.Add(tab);
            tab.PostOnViewChange = false;
            tab.MarginTop = true;
            tab.Height = Unit.Percentage(100);
            tab.Width = Unit.Percentage(100);
            TabView general = tab.CreateAndAddView("General", "General");
            general.Height = Unit.Percentage(100);
            general.Width = Unit.Percentage(100);

            // LCID
            txtLCID = new TextBox();
            txtLCID.Enabled = false;
            txtLCID.Width = Unit.Pixel(100);
            txtLCID.Text = currentDef.LCID.ToString();
            txtLCID.EnableViewState = false;
            pp = new PropertyPanel(txtLCID, PropertyLayout.TwoColumns, "LCID", null);
            pp.ShowAdvancedFunctions = false;
            pp.Controls.Add(txtLCID);
            general.Controls.Add(pp);

            CultureInfo ci = null;
            try { ci = CultureInfo.GetCultureInfo(currentDef.LCID); } catch { }

            // LCID Name
            TextBox txtLCIDName = new TextBox();
            txtLCIDName.Enabled = false;
            txtLCIDName.Width = Unit.Pixel(200);
            txtLCIDName.Text = ci == null ? "(Unknown)" : ci.Name;
            txtLCIDName.EnableViewState = false;
            pp = new PropertyPanel(txtLCIDName, PropertyLayout.TwoColumns, "LCID Name", null);
            pp.ShowAdvancedFunctions = false;
            pp.Controls.Add(txtLCIDName);
            general.Controls.Add(pp);

            // LCID Native name
            TextBox txtLCIDNativeName = new TextBox();
            txtLCIDNativeName.Enabled = false;
            txtLCIDNativeName.Width = Unit.Pixel(200);
            txtLCIDNativeName.Text = ci == null ? "(Unknown)" : ci.NativeName;
            txtLCIDNativeName.EnableViewState = false;
            pp = new PropertyPanel(txtLCIDNativeName, PropertyLayout.TwoColumns, "LCID Native Name", null);
            pp.ShowAdvancedFunctions = false;
            pp.Controls.Add(txtLCIDNativeName);
            general.Controls.Add(pp);

            //// Access group ID
            //chkAccessGroupId = new TextBox();
            //chkAccessGroupId.Text = currentDef.Settings.AccessGroupId.ToString();
            //pp = new PropertyPanel(chkAccessGroupId, PropertyLayout.TwoColumns, "Access group id", null);
            //pp.ShowAdvancedFunctions = false;
            //pp.Controls.Add(chkAccessGroupId);
            //general.Controls.Add(pp);

            TabView tNames = tab.CreateAndAddView("Names", "Names");
            //// Language versions
            //langVersions = new LanguageVersions();
            //langVersions.SetData(currentDef.NameByLCID, currentDef.DescriptionByLCID);
            //PropertyPanel ppLangVersion = new PropertyPanel(langVersions, PropertyLayout.NoTitle, "Friendly names and descriptions:", null);
            //langVersions.Enabled = writeAccess;
            //ppLangVersion.Layout = PropertyLayout.NoTitle;
            //tNames.Controls.Add(ppLangVersion);

            base.CreateChildControls();

        }
    }