Exemplo n.º 1
0
        public ScrollView createTable(MyCalculatorPage pair)
        {
            mypair = pair;

            common = new ModeCommon(formulaList, editList, baseContentLayout, mypair);

            var baseContent = new ScrollView();

            var formula1layout = new StackLayout {
                Style = EditorStyles.stepContentLayoutStyle
            };
            var formula2layout = new StackLayout {
                Style = EditorStyles.stepContentLayoutStyle
            };


            baseContentLayout.Children.Add(common.createHelpContent());
            baseContentLayout.Children.Add(common.createNameContent(null));

            editList.Add(new EditorBaseModel());
            formula1layout.Children.Add(common.createFormulaTitleContent());
            formula1layout.Children.Add(common.createExplainContent(null));
            baseContentLayout.Children.Add(formula1layout);
            formulaList.Add(formula1layout);


            editList.Add(new EditorBaseModel());
            formulaList.Add(formula2layout);
            editList.Last().culculates = new List <CulcModel>();
            formula2layout.Children.Add(common.createFormulaTitleContent());
            formula2layout.Children.Add(common.createExplainContent(null));
            formula2layout.Children.Add(common.createLastContent(null));
            formula2layout.Children.Add(common.createEditButtonContent(true));
            baseContentLayout.Children.Add(formula2layout);


            var layout = new StackLayout {
                Style = EditorStyles.baseContentLayoutStyle
            };

            layout.Children.Add(baseContentLayout);
            layout.Children.Add(createSaveButton());

            baseContent = new ScrollView {
                Style = EditorStyles.baseContentStyle, Content = layout
            };

            return(baseContent);
        }
Exemplo n.º 2
0
        public ScrollView updateTable(MyCalculatorPage pair, UserCulculateModel target)
        {
            var culcModel = JsonConvert.DeserializeObject <CulculateJsonModel>(target.Culculate);

            mypair = pair;
            myUserCulculateModelTarget = target;

            common = new ModeCommon(formulaList, editList, baseContentLayout, mypair);

            var baseContent    = new ScrollView();
            var formula1layout = new StackLayout {
                Style = EditorStyles.stepContentLayoutStyle
            };


            baseContentLayout.Children.Add(common.createHelpContent());
            baseContentLayout.Children.Add(common.createNameContent(target.DisplayName));

            editList.Add(new EditorBaseModel());
            formula1layout.Children.Add(common.createFormulaTitleContent());
            formula1layout.Children.Add(common.createExplainContent(culcModel.formula[0]));
            baseContentLayout.Children.Add(formula1layout);
            formulaList.Add(formula1layout);

            var layout = new StackLayout {
                Style = EditorStyles.baseContentLayoutStyle
            };

            layout.Children.Add(baseContentLayout);
            layout.Children.Add(createUpdateButton());

            baseContent = new ScrollView {
                Style = EditorStyles.baseContentStyle, Content = layout
            };


            foreach (CulculateFormulaJsonModel model in culcModel.formula)
            {
                if (culcModel.formula[0].Equals(model))
                {
                    continue;
                }


                var nextsteplayout = new StackLayout {
                    Style = EditorStyles.stepContentLayoutStyle
                };

                formulaList.Add(nextsteplayout);

                editList.Add(new EditorBaseModel());

                editList.Last().culculates = new List <CulcModel>();

                formulaList.Last().Children.Add(common.createFormulaTitleContent());
                formulaList.Last().Children.Add(common.createExplainContent(model));
                formulaList.Last().Children.Add(common.createLastContent(model));

                baseContentLayout.Children.Add(nextsteplayout);

                foreach (ExecuteJsonModel exec in model.execute)
                {
                    formulaList.Last().Children.Add(
                        common.createCulculateContent(
                            exec, formulaList.IndexOf(formulaList.Last())
                            )
                        );
                }

                formulaList.Last().Children.Add(common.createEditButtonContent(false));
            }
            formulaList.Last().Children.Remove(formulaList.Last().Children.Last());
            formulaList.Last().Children.Add(common.createEditButtonContent(true));

            return(baseContent);
        }