Пример #1
0
        public AppearancePanelForm(AppearanceClass app)
        {
            this.Icon = LayoutDetails.Instance.MainFormIcon;
            FormUtils.SizeFormsForAccessibility(this, LayoutDetails.Instance.MainFormFontSize);

            Panel bottom = new Panel();

            bottom.Dock   = DockStyle.Bottom;
            bottom.Height = LayoutDetails.ButtonHeight;
            ok            = new Button();



            ok.Text         = Loc.Instance.GetString("OK");
            ok.DialogResult = DialogResult.OK;
            ok.Dock         = DockStyle.Left;


            Button Cancel = new Button();

            Cancel.Text         = Loc.Instance.GetString("Cancel");
            Cancel.Dock         = DockStyle.Right;
            Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            bottom.Controls.Add(ok);
            bottom.Controls.Add(Cancel);


            if (app == null)
            {
                // we are in build mode. So we create a classic note
                app = AppearanceClass.SetAsClassic();

                app.Name   = "Choose A Unique Name For Your New Appearance";
                ok.Enabled = false;
            }



            appearancePanel = new AppearancePanel(false, app, null, ValidData, true);

            appearancePanel.Dock = DockStyle.Fill;
            this.Controls.Add(bottom);
            this.Controls.Add(appearancePanel);
            appearancePanel.BringToFront();
        }
        public AppearancePanelForm(AppearanceClass app)
        {
            this.Icon = LayoutDetails.Instance.MainFormIcon;
            FormUtils.SizeFormsForAccessibility(this, LayoutDetails.Instance.MainFormFontSize);

            Panel bottom = new Panel();
            bottom.Dock = DockStyle.Bottom;
            bottom.Height = LayoutDetails.ButtonHeight;
             ok = new Button();

            ok.Text = Loc.Instance.GetString ("OK");
            ok.DialogResult = DialogResult.OK;
            ok.Dock = DockStyle.Left;

            Button Cancel = new Button();
            Cancel.Text = Loc.Instance.GetString ("Cancel");
            Cancel.Dock = DockStyle.Right;
            Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;

            bottom.Controls.Add (ok);
            bottom.Controls.Add(Cancel);

            if (app == null) {
                // we are in build mode. So we create a classic note
                app = AppearanceClass.SetAsClassic();

                app.Name = "Choose A Unique Name For Your New Appearance";
                ok.Enabled = false;

            }

            appearancePanel = new AppearancePanel(false, app, null, ValidData, true);

            appearancePanel.Dock = DockStyle.Fill		;
                this.Controls.Add(bottom);
            this.Controls.Add (appearancePanel);
            appearancePanel.BringToFront();
        }
        void HandleAppearanceSelectedIndexChanged(object sender, EventArgs e)
        {
            // we always get rid of the control, when deselecting the list item too.

            if (null != lastAppPanel) {
                AppearanceGroup.Controls.Remove (lastAppPanel);
            }

            if ((sender as ListBox).SelectedItem != null) {
                //GetRidOfMe should be picked from the list we fill instead
                Layout.AppearanceClass App = GetAppearanceByKey ((sender as ListBox).SelectedItem.ToString ());
                if (App != null) {

                    AppearancePanel appPanel = new AppearancePanel (true, App, SaveAppearance, null, false);

                    appPanel.Dock = DockStyle.Fill;
                    AppearanceGroup.Controls.Add (appPanel);
                    appPanel.BringToFront ();

                    // store this so we can delete it next time
                    lastAppPanel = appPanel;
                }
            }
        }