private Ukol Modify(EventUkolUpdated evt, Ukol item) { item.EventGuid = evt.EventId; item.Value1 = evt.UkolValue1; item.Value2 = evt.UkolValue2; return(item); }
public ABCTextPage() { InitializeComponent(); if (Test.current.probiha) { Uspesnost = Test.current.procentHotovo; } else { Uspesnost = "Správně : " + Statistika.Current.Procent_uspesnost.ToString() + "%"; Pokracovat_butt.IsEnabled = true; } Otazka otzk = NactiOtazku(); BodyInt = otzk.Bodu; Body = otzk.Bodu.ToString(); if (otzk.Bodu == 1) { Body += " bod"; } else if (otzk.Bodu < 5) { Body += " body"; } else { Body += " bodů"; } Ukol = otzk.Ukol.Replace("\n", "").Trim(); while (Ukol.Contains(" ")) { Ukol = Ukol.Replace(" ", " "); } NeupravenyText = otzk.Text; Text = FormatovacTextu.Uprav(otzk.Text); int index = 1; foreach (String moznost in otzk.Moznosti.Moznost) { kontrolaDelegates.Add(delegate { KontrolaOdpovedi(moznost.Trim()[0], otzk.Spravna[0]); }); Button button = new Button { Text = Regex.Replace(moznost, @"\s+", " "), VerticalOptions = Xamarin.Forms.LayoutOptions.Center, StyleClass = new List <string>() { "Tlacitko_odpoved" } }; myStackLayout.Children.Insert(index + 3, button); button.Clicked += kontrolaDelegates[index - 1]; index++; } BindingContext = this; }
public Task <int> SaveNoteAsync(Ukol note) { if (note.ID != 0) { return(_database.UpdateAsync(note)); } else { return(_database.InsertAsync(note)); } }
private Ukol Create(EventUkolCreated evt) { var model = new Ukol() { Generation = evt.Generation, EventGuid = evt.EventId, UkolId = evt.UkolId, Value1 = evt.UkolValue1, Value2 = evt.UkolValue2 }; return(model); }
public OtevrenaTextPage() { InitializeComponent(); if (Test.current.probiha) { Uspesnost = Test.current.procentHotovo; } else { Uspesnost = "Správně : " + Statistika.Current.Procent_uspesnost.ToString() + "%"; Pokracovat_butt.IsEnabled = true; } Otazka otzk = NactiOtazku(); Body = otzk.Bodu.ToString(); BodyInt = otzk.Bodu; Spravna = otzk.Spravna.Trim().ToLower(); if (otzk.Bodu == 1) { Body += " bod"; } else if (otzk.Bodu < 5) { Body += " body"; } else { Body += " bodů"; } Ukol = otzk.Ukol.Replace("\n", " ").Trim(); while (Ukol.Contains(" ")) { Ukol = Ukol.Replace(" ", " "); } NeupravenyText = otzk.Text; Text = FormatovacTextu.Uprav(otzk.Text); BindingContext = this; }
public AnoNePage() { InitializeComponent(); if (Test.current.probiha) { Uspesnost = Test.current.procentHotovo; } else { Uspesnost = "Správně : " + Statistika.Current.Procent_uspesnost.ToString() + "%"; Pokracovat_butt.IsEnabled = true; } Otazka otzk = NactiOtazku(); Body = otzk.Bodu.ToString(); Spravne = otzk.Spravna; if (otzk.Bodu == 1) { Body += " bod"; } else if (otzk.Bodu < 5) { Body += " body"; } else { Body += " bodů"; } Ukol = otzk.Ukol.Replace("\n", " ").Replace(" ", " ").Trim(); while (Ukol.Contains(" ")) { Ukol = Ukol.Replace(" ", " "); } moznosti = new List <string>(); foreach (string m in otzk.Moznosti.Moznost) { string moznost = m.Replace("\n", " "); while (moznost.Contains(" ") || moznost.Contains(" ")) { moznost = moznost.Replace(" ", " ").Replace(" ", " "); } moznosti.Add(moznost); } int index = 0; foreach (String moznost in moznosti) { StackLayout layout = new StackLayout { Orientation = StackOrientation.Horizontal }; FontSizeConverter fontSizeConverter = new FontSizeConverter(); Label label = new Label { Text = moznost.Replace("\n", " ").Replace(" ", " ").Trim(), TextColor = Color.Black, FontSize = (Double)fontSizeConverter.ConvertFromInvariantString("Small"), VerticalOptions = Xamarin.Forms.LayoutOptions.Center, Margin = new Thickness(15, 0, 0, 0), HorizontalOptions = LayoutOptions.StartAndExpand }; layout.Children.Add(label); Switch switchA = new Switch(); layout.Children.Add(switchA); HlavniStackLayout.Children.Insert(index + 3, layout); index++; } BindingContext = this; }
public Task <int> DeleteNoteAsync(Ukol note) { return(_database.DeleteAsync(note)); }
public PrirazeniPage() { InitializeComponent(); Otazka otzk = NactiOtazku(); Spravna = otzk.Spravna; BodyInt = otzk.Bodu; Body = otzk.Bodu.ToString(); if (otzk.Bodu == 1) { Body += " bod"; } else if (otzk.Bodu < 5) { Body += " body"; } else { Body += " bodů"; } Ukol = otzk.Ukol.Replace("\n", "").Trim(); while (Ukol.Contains(" ")) { Ukol = Ukol.Replace(" ", " "); } if (Test.current.probiha) { Uspesnost = Test.current.procentHotovo; } else { Uspesnost = "Správně : " + Statistika.Current.Procent_uspesnost.ToString() + "%"; Pokracovat_butt.IsEnabled = true; } //Picker for (int i = 0; i < otzk.Moznosti.Moznost.Count; i++) { otzk.Moznosti.Moznost[i] = otzk.Moznosti.Moznost[i].Replace("\n", "").Trim(); MoznostiView.Add(otzk.Moznosti.Moznost[i]); } Grid ContentGrid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; for (int i = 0; i < otzk.PodUkoly.Podukol.Count; i++) { ContentGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); while (otzk.PodUkoly.Podukol[i].Contains(" ")) { otzk.PodUkoly.Podukol[i] = otzk.PodUkoly.Podukol[i].Replace("\n", " ").Replace(" ", " "); } PodukolyView.Add(otzk.PodUkoly.Podukol[i]); StackLayout stackLayout = new StackLayout { Orientation = StackOrientation.Horizontal }; Label label = new Label { Text = otzk.PodUkoly.Podukol[i].Replace("\n", " "), TextColor = Color.Black }; Picker picker = new Picker(); picker.ItemsSource = MoznostiView; pickers.Add(picker); ContentGrid.Children.Add(label, 0, i); ContentGrid.Children.Add(picker, 1, i); } ContentScroll.Content = ContentGrid; BindingContext = this; }