コード例 #1
0
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Choose your items"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "Items are used to describe the goods and services that you purchase and sell. To modify your items later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Items...")
                })
            };

            footer.Show();
            vboBody.PackStart(footer, false, true, 0);

            if (setups.Count == 0)
            {
                foreach (TypeExtensionNode node in AddinManager.GetExtensionNodes("/Warehouse/Presentation/SetupAssistant/ItemsSetup"))
                {
                    object     instance = node.CreateInstance();
                    ItemsSetup setup    = instance as ItemsSetup;
                    if (setup != null)
                    {
                        setups.Add(setup);
                    }
                }
                setups.Sort((p1, p2) => Math.Max(-1, Math.Min(1, p1.Ordinal - p2.Ordinal)));
            }

            nbkMain = new Notebook();
            if (setups.Count > 0)
            {
                foreach (ItemsSetup setup in setups)
                {
                    Label lblTab = new Label(setup.Label)
                    {
                        Xpad = 4
                    };
                    Widget page = setup.GetPageWidget();
                    page.Show();

                    Alignment alg = new Alignment(.5f, .5f, 1f, 1f)
                    {
                        LeftPadding = 4, RightPadding = 4, TopPadding = 4, BottomPadding = 4
                    };
                    alg.Add(page);
                    alg.Show();

                    EventBox evb = new EventBox {
                        alg
                    };
                    evb.Show();

                    nbkMain.AppendPage(evb, lblTab);
                }
                nbkMain.Show();
            }
            vboBody.PackStart(nbkMain, true, true, 10);

            wlbError = new WrapLabel();
            vboBody.PackStart(wlbError, false, true, 0);

            pgbProgress = new ProgressBar {
                Fraction = 0.00
            };
            vboBody.PackEnd(pgbProgress, false, true, 2);

            lblProgress = new Label();
            vboBody.PackEnd(lblProgress, false, true, 4);
        }
コード例 #2
0
        public override bool Complete(Assistant assistant)
        {
            ItemsSetup setup = setups [nbkMain.CurrentPage];

            return(setup.Validate() && setup.CommitChanges(this, assistant));
        }