public void CreateNewReport(string name) { var path = Path.Combine(DocumentsPath, name); if (!Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); DefaultReportForm defRepForm = new DefaultReportForm(); File.WriteAllLines(Path.Combine(path, "ReportForm.txt"), defRepForm.Lines); System.IO.File.Create(Path.Combine(path, "ReportParticipants.txt")); System.IO.File.Create(Path.Combine(path, "ReportNotes.txt")); //return true; } }
public FormEditorPage() { Title = "Form Editor"; selectQuestionType.IsVisible = false; Services.DefaultReportForm defaultForm = new Services.DefaultReportForm(); Services.Form form = new Services.Form(defaultForm.Lines); Button reset = new Button { Text = "Reset" }; reset.Clicked += (sender, args) => { defaultForm.resetForm(); }; Button save = new Button { Text = "Save" }; save.Clicked += (sender, args) => { defaultForm.NewCustomForm(form); }; StackLayout stack = new StackLayout(); foreach (Services.Section item in form.Sections) { BoxView seper = new BoxView() { Opacity = 0.5f, Color = Color.Gray, WidthRequest = 100, HeightRequest = 2 }; stack.Children.Add(seper); stack.Children.Add(getSectionView(item, form, seper)); } Button addSection = new Button { Text = "Add Section" }; addSection.Clicked += (sender, args) => { Services.Section newSec = new Services.Section(""); form.addSection(newSec); BoxView seper = new BoxView() { Opacity = 0.5f, Color = Color.Gray, WidthRequest = 100, HeightRequest = 2 }; stack.Children.Add(seper); stack.Children.Add(getSectionView(newSec, form, seper)); }; Grid grid = new Grid(); grid.Children.Add(save, 0, 0); grid.Children.Add(reset, 1, 0); ScrollView scrollView = new ScrollView { Content = new StackLayout { Children = { grid, stack, new BoxView() { Opacity = 0.5f,Color = Color.Gray, WidthRequest = 100, HeightRequest = 2 }, addSection, selectQuestionType } } }; Content = scrollView; }