void AddButton(Training aTraining) { DateTime timeForTraining = DateTime.ParseExact(aTraining.Date, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); DateTime timeForTrainingEnd = DateTime.ParseExact(aTraining.EndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); string bgColor = "549fb3"; if (aTraining.isTeamTraining != null) { if (bool.Parse(aTraining.isTeamTraining) == true) { bgColor = "619e60"; } } string h = timeForTraining.Hour.ToString(); string m = timeForTraining.Minute.ToString(); string h2 = timeForTrainingEnd.Hour.ToString(); string m2 = timeForTrainingEnd.Minute.ToString(); if (timeForTraining.Hour < 10) { h = "0" + timeForTraining.Hour.ToString(); } if (timeForTraining.Minute < 10) { m = "0" + timeForTraining.Minute.ToString(); } if (timeForTraining.Hour < 10) { h2 = "0" + timeForTrainingEnd.Hour.ToString(); } if (timeForTraining.Minute < 10) { m2 = "0" + timeForTrainingEnd.Minute.ToString(); } Button button; Button button2; if (Device.OS == TargetPlatform.iOS) { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { TextColor = Color.FromHex("c7a07c"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex(button2color), Text = timeForTraining.Month.ToString() + "/" + timeForTraining.Day.ToString() + " " + aTraining.Name + evaluatedText, HeightRequest = 45, BorderRadius = 0, }; button = new TestLayoutProblem.MyButton { BorderRadius = 0, WidthRequest = 100, HeightRequest = 50, TextColor = Color.White, FontFamily = "Lato-Light", BackgroundColor = Color.FromHex(bgColor), FontSize = 13, Text = h + ":" + m + " - " + h2 + ":" + m2, }; } else { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton2 { TextColor = Color.FromHex("c7a07c"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex(button2color), Text = timeForTraining.Month.ToString() + "/" + timeForTraining.Day.ToString() + " " + aTraining.Name + evaluatedText, HeightRequest = 45, BorderRadius = 0, }; button = new TestLayoutProblem.MyButton2 { BorderRadius = 0, WidthRequest = 100, HeightRequest = 50, TextColor = Color.White, FontFamily = "Lato-Light", BackgroundColor = Color.FromHex(bgColor), FontSize = 13, Text = h + ":" + m + " - " + h2 + ":" + m2, }; } if (aTraining.HasBeenEvaluated == false) { button.Clicked += OnDoQuestionairClickedDiarySummary; button2.Clicked += OnDoQuestionairClickedDiarySummary; } else { button.Clicked += OnAlreadyEvaluated; button2.Clicked += OnAlreadyEvaluated; } allButtons.Add(button); //allButtons.Add(button2); StackLayout s1 = new StackLayout { BackgroundColor = Color.FromHex("2e2e2e"), Orientation = StackOrientation.Horizontal, Children = { button, button2 } }; if (aTraining.HasBeenEvaluated == true) { Button buttonDone = new Button { Image = "done.png", FontFamily = "Lato-Light", Text = "", WidthRequest = 32, HeightRequest = 32, MinimumHeightRequest = 32, MinimumWidthRequest = 32, BorderRadius = 0, Margin = 10, BackgroundColor = Color.FromHex("2e2e2e"), HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; buttonDone.Clicked += OnAlreadyEvaluated; s1.Children.Add(buttonDone); } ((StackLayout)ButtonStackLayout).Children.Add(s1); ButtonAndTraining bat = new ButtonAndTraining(); bat.TrainingButton = button; bat.TrainingButton2 = button2; bat.TrainingID = aTraining.PraticeID; bat.isTeamTraining = bool.Parse(aTraining.isTeamTraining); bat.HasBeenEvaluated = aTraining.HasBeenEvaluated; ButtonAndTrainingList.Add(bat); }
public void AddNewInjuryButton() { string bgColor = "2e2e2e"; Button button; Button button2; if (Device.OS == TargetPlatform.iOS) { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("4f514f"), Text = "Add Injury", HeightRequest = 50, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", WidthRequest = -35, BorderWidth = 0, BorderRadius = 0, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("FFFFFF"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("b08f70"), Text = "+", HeightRequest = 50, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } else { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("4f514f"), Text = "Add Injury", HeightRequest = 50, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", WidthRequest = -35, BorderWidth = 0, BorderRadius = 0, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("FFFFFF"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("b08f70"), Text = "+", HeightRequest = 50, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } button2.Clicked += OnAddInjurClicked; button.Clicked += OnAddInjurClicked; StackLayout s1 = new StackLayout { BackgroundColor = Color.FromHex("b08f70"), Orientation = StackOrientation.Horizontal, HeightRequest = 50, Margin = new Thickness(20, 0, 20, 0), Children = { button, button2 } }; StackLayoutForInjuryButotns = new StackLayout { }; ((StackLayout)MainStackLayoutQuestions).Children.Add(StackLayoutForInjuryButotns); ((StackLayout)MainStackLayoutQuestions).Children.Add(s1); Label l3 = new Label { }; Label l4 = new Label { }; ((StackLayout)MainStackLayoutQuestions).Children.Add(l3); ((StackLayout)MainStackLayoutQuestions).Children.Add(l4); }
void AddEntry2(string aQuestion, string questionID, string extraInfo) { string bgColor = "2e2e2e"; Button button; Button button2; if (Device.OS == TargetPlatform.iOS) { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aQuestion, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = "0", HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } else { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aQuestion, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = "0", HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } // button.Clicked += OnAlreadyEvaluated; // button2.Clicked += OnAlreadyEvaluated; // allButtons.Add(button); Slider slider1 = new Slider { Minimum = 0, Maximum = 10, BackgroundColor = Color.FromHex("4f514f"), Margin = new Thickness(40, 0, 40, 0) }; slider1.ValueChanged += HandleValueChanged; StackLayout s1 = new StackLayout { BackgroundColor = Color.FromHex("2e2e2e"), Orientation = StackOrientation.Horizontal, Margin = new Thickness(20, 10, 20, 10), Children = { button, button2 } }; Button buttonDone = new Button { Image = "infoButton.png", FontFamily = "Lato-Light", Text = "", WidthRequest = 32, HeightRequest = 32, MinimumHeightRequest = 32, MinimumWidthRequest = 32, BorderRadius = 0, Margin = 10, BackgroundColor = Color.FromHex("2e2e2e"), HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; buttonDone.Clicked += ClickedMoreInfo; s1.Children.Add(buttonDone); StackLayout sTotal = new StackLayout { BackgroundColor = Color.FromHex("4f514f"), Children = { s1, slider1 } }; ((StackLayout)MainStackLayoutQuestions).Children.Add(sTotal); Label l3 = new Label { }; Label l4 = new Label { }; ((StackLayout)MainStackLayoutQuestions).Children.Add(l3); ((StackLayout)MainStackLayoutQuestions).Children.Add(l4); //ButtonAndTraining bat = new ButtonAndTraining(); //bat.TrainingButton = button; //bat.TrainingButton2 = button2; //bat.TrainingID = aTraining.PraticeID; //bat.isTeamTraining = bool.Parse(aTraining.isTeamTraining); //bat.HasBeenEvaluated = aTraining.HasBeenEvaluated; //ButtonAndTrainingList.Add(bat); SliderListConnected.Add(slider1); LabelListConnected.Add(button); if (LabelListValue.Count < LabelListConnected.Count) { LabelListValue.Add(0); } else { button.Text = LabelListValue[LabelListConnected.Count - 1].ToString(); SliderListConnected[LabelListConnected.Count - 1].Value = (double)LabelListValue[LabelListConnected.Count - 1]; } QuestionIdListConnected.Add(questionID); DescriptionListConnected.Add(buttonDone); }
void AddInjuryButton(string aQuestion, string questionID, int aValue) { string bgColor = "2e2e2e"; Button button; Button button2; if (Device.OS == TargetPlatform.iOS) { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aQuestion, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aValue.ToString(), HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } else { string button2color = "FFFFFF"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { //TextColor = Color.Black, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(button2color), //Text = aQuestion, //HeightRequest = 45, //BorderRadius = 0, BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aQuestion, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { //BorderRadius = 0, //WidthRequest = 100, //HeightRequest = 50, //TextColor = Color.White, //FontFamily = "Lato-Light", //BackgroundColor = Color.FromHex(bgColor), //FontSize = 13, //Text = "0", BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = aValue.ToString(), HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; } button2.Clicked += OnRemoveInjurClicked; button.Clicked += OnRemoveInjurClicked; Slider slider1 = new Slider { Minimum = 0, Maximum = 10, BackgroundColor = Color.FromHex("4f514f"), Margin = new Thickness(40, 0, 40, 0) }; slider1.ValueChanged += HandleValueChangedInjurySlider; StackLayout s1 = new StackLayout { BackgroundColor = Color.FromHex("2e2e2e"), Orientation = StackOrientation.Horizontal, Margin = new Thickness(20, 10, 20, 10), Children = { button, button2 } }; StackLayout sTotal = new StackLayout { BackgroundColor = Color.FromHex("4f514f"), Children = { s1, slider1 } }; ((StackLayout)StackLayoutForInjuryButotns).Children.Add(sTotal); Label l3 = new Label { }; Label l4 = new Label { }; ((StackLayout)StackLayoutForInjuryButotns).Children.Add(l3); ((StackLayout)StackLayoutForInjuryButotns).Children.Add(l4); }
public void AddPraticeDuration2() { int h = 0; int m = 0; for (int i = 0; i < Database.DatabaseTraining.Count; i++) { if (QuestionPage.trainingID == Database.DatabaseTraining[i].PraticeID) { DateTime d1 = DateTime.ParseExact(Database.DatabaseTraining[i].Date, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); DateTime d2 = DateTime.ParseExact(Database.DatabaseTraining[i].EndDate, "yyyyMMddHHmmss", CultureInfo.InvariantCulture); h = d2.Hour - d1.Hour; m = d2.Minute - d1.Minute; } } if (Duration != 0) { minutesDuration = Duration.ToString(); } else { minutesDuration = (((float)h * 60f) + (float)m).ToString(); Duration = int.Parse(minutesDuration); } string bgColor = "2e2e2e"; Button button; Button button2; if (Device.OS == TargetPlatform.iOS) { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = "Duration", HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = minutesDuration, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, //Margin = new Thickness(2, 2, 2, 2), }; } else { string button2color = "2e2e2e"; string evaluatedText = ""; button2 = new TestLayoutProblem.MyButton { BorderColor = Color.FromHex("2e2e2e"), TextColor = Color.FromHex("b59272"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = "Duration", HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, }; button = new TestLayoutProblem.MyButton { BorderWidth = 1, BorderRadius = 1, BorderColor = Color.FromHex("b08f70"), TextColor = Color.FromHex("b08f70"), FontFamily = "Lato-Light", BackgroundColor = Color.FromHex("2e2e2e"), Text = minutesDuration, HeightRequest = 40, FontSize = 22, HorizontalOptions = LayoutOptions.FillAndExpand, //Margin = new Thickness(2, 2, 2, 2), }; } // button.Clicked += OnAlreadyEvaluated; // button2.Clicked += OnAlreadyEvaluated; // allButtons.Add(button); Slider slider1 = new Slider { Minimum = 0, Maximum = 10, BackgroundColor = Color.FromHex("4f514f"), Margin = new Thickness(40, 0, 40, 0) }; slider1.ValueChanged += HandleValueDuration; StackLayout s1 = new StackLayout { BackgroundColor = Color.FromHex("2e2e2e"), Orientation = StackOrientation.Horizontal, Margin = new Thickness(20, 10, 20, 10), Children = { button, button2 } }; Button buttonDone = new Button { Image = "infoButton.png", FontFamily = "Lato-Light", Text = "", WidthRequest = 32, HeightRequest = 32, MinimumHeightRequest = 32, MinimumWidthRequest = 32, BorderRadius = 0, Margin = 10, BackgroundColor = Color.FromHex("2e2e2e"), HorizontalOptions = LayoutOptions.EndAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; buttonDone.Clicked += ClickedMoreInfo; s1.Children.Add(buttonDone); StackLayout sTotal = new StackLayout { BackgroundColor = Color.FromHex("4f514f"), Children = { s1, slider1 } }; ((StackLayout)MainStackLayoutQuestions).Children.Add(sTotal); Label l3 = new Label { }; Label l4 = new Label { }; ((StackLayout)MainStackLayoutQuestions).Children.Add(l3); ((StackLayout)MainStackLayoutQuestions).Children.Add(l4); //ButtonAndTraining bat = new ButtonAndTraining(); //bat.TrainingButton = button; //bat.TrainingButton2 = button2; //bat.TrainingID = aTraining.PraticeID; //bat.isTeamTraining = bool.Parse(aTraining.isTeamTraining); //bat.HasBeenEvaluated = aTraining.HasBeenEvaluated; //ButtonAndTrainingList.Add(bat); //LabelListDurationConnected.Add(l2); //SliderListDurationConnected.Add(s1); LabelListDurationConnected.Add(button); SliderListDurationConnected.Add(slider1); //DescriptionListConnected.Add(buttonDone); }