コード例 #1
0
        public void RebuildDetailViews(ToDoProduct todoProduct)
        {
            this.todoProduct = todoProduct;

            detailViews.Clear();

            productViews.Hide();

            CreateDetailView(todoProduct, true).AddTo(detailViews);
            detailViews.Show();
        }
コード例 #2
0
        public void RebuildProductViews()
        {
            productViews.Clear();

            detailViews.Hide();
            todoProduct = null;

            new ButtonView("创建产品", () => OpenProductEditorWindow(null), true).Height(40).AddTo(productViews);

            new SpaceView(10f).AddTo(productViews);

            var data = ToDoDataManager.Data.productList;

            for (int i = data.Count - 1; i >= 0; i--)
            {
                var product = data[i];

                var title = new HorizontalLayout();

                new FlexibleSpaceView().AddTo(title);

                new ImageButtonView(ImageButtonIcon.openIcon, () => EnqueueCmd(() => RebuildDetailViews(product)))
                .Width(40).Height(25).BackgroundColor(Color.black).AddTo(title);

                new ImageButtonView(ImageButtonIcon.editorIcon, () => OpenProductEditorWindow(product))
                .Width(40).Height(25).BackgroundColor(Color.black).AddTo(title);

                new ImageButtonView(ImageButtonIcon.deleteIcon, () => RemoveProduct(product)).Width(25).Height(25)
                .BackgroundColor(Color.red).AddTo(title);

                var foldout = new FoldoutView(false, product.name, title).FontSize(25)
                              .FontBold().AddTo(productViews);

                new SpaceView(10f).AddTo(productViews);

                foldout.AddFoldoutView(CreateDetailView(product, false).AddTo(detailViews));

                foldout.AddFoldoutView(new SpaceView(15f));
            }

            productViews.Show();
        }