public App(string displayText) { S.dbPath = displayText; InitializeComponent(); MainPage = new MyCalculatorPage(); }
public ModeCommon(List <StackLayout> formulaList, List <EditorBaseModel> editList, StackLayout baseContentLayout, MyCalculatorPage mypair ) { this.formulaList = formulaList; this.editList = editList; this.baseContentLayout = baseContentLayout; this.mypair = mypair; }
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); }
public TableSource(string[] items, MyCalculatorPage owner) { tableItems = items; this.owner = owner; }
public TableView createTable(MyCalculatorPage pair) { myPair = pair; var table = new TableView() { RowHeight = 70 }; table.BackgroundColor = Color.FromHex("#F8F8F8"); table.Intent = TableIntent.Settings; var lists = new List <ViewCell>(); List <UserCulculateModel> ul = UserCulculateUtil.getAllUserCulculate(); foreach (UserCulculateModel u in ul) { var layout = new StackLayout { Style = CreateListStyles.cellLayoutStyle }; layout.Children.Add(new Label { Text = u.DisplayName, Style = CreateListStyles.cellLabelStyle }); var deleteBtn = new Button { Style = CreateListStyles.deleteButtonStyle, AutomationId = u.Id.ToString() }; deleteBtn.Clicked += async(sender, args) => { var result = await myPair.DisplayAlert("確認", "選択した計算を削除しますか?", "OK", "キャンセル"); if (result) { UserCulculateUtil.deleteCulculateById(u.Id); myPair.refreshEditList(); } }; var updateBtn = new Button { Style = CreateListStyles.editButtonStyle, AutomationId = u.Id.ToString() }; updateBtn.Clicked += (sender, args) => { myPair.updateCulculate(u.Id); }; layout.Children.Add(updateBtn); layout.Children.Add(deleteBtn); var cell = new ViewCell { View = layout, AutomationId = u.Id.ToString() }; cell.Tapped += (sender, args) => { S.InitParameter(); S.selectUserModel = UserCulculateUtil.getUserCulculateById(u.Id); myPair.OnSpecial(new Button { Text = u.Name }, args); }; lists.Add(cell); } table.Root.Add(new TableRoot { new TableSection("マイ計算リスト") { lists } }); return(table); }
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); }