Пример #1
0
        protected override void CreateBody()
        {
            CreateBody(Translator.GetString("Choose your locations"));

            WrapLabel footer = new WrapLabel
            {
                Markup = string.Format(Translator.GetString(
                                           "Locations are used for your physical locations where you store items, place orders, or make purchases from. To create the locations quickly use the form bellow. To edit your locations later go to:{0}{1}"),
                                       Environment.NewLine,
                                       new PangoStyle
                {
                    Italic = true,
                    Bold   = true,
                    Text   = Translator.GetString("Edit->Locations...")
                })
            };

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

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

            if (schemas.Count > 1)
            {
                nbkMain = new Notebook();
                foreach (LocationsSetup schema in schemas)
                {
                    Label lblTab = new Label(schema.Label)
                    {
                        Xpad = 4
                    };
                    Widget page = schema.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);
            }
            else if (schemas.Count == 1)
            {
                Widget page = schemas [0].GetPageWidget();
                page.Show();

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

                vboBody.PackStart(alg, true, true, 10);
            }
        }
Пример #2
0
        public override bool Complete(Assistant assistant)
        {
            LocationsSetup schema = schemas.Count == 1 ? schemas [0] : schemas [nbkMain.CurrentPage];

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