async void MainInfoSaveButton_Clicked(object sender, EventArgs e) { int CurrentAdId = CrossSettings.Current.GetValueOrDefault("CurrentAdId", 0); if (CurrentAdId.Equals(0)) { await Navigation.PushModalAsync(new NavigationPage(new MainPage())); } var AdVM = AdSQLiteH.GetById(CurrentAdId); AdVM.VIN = VINEntry.Text; AdVM.Mark = MarkPicker.Items[MarkPicker.SelectedIndex]; AdVM.Model = ModelPicker.Items[ModelPicker.SelectedIndex]; AdVM.Year = YearPicker.Items[YearPicker.SelectedIndex]; AdVM.Mileage = Convert.ToDouble(MileageEntry.Text); AdVM.Kuzov = KuzovPicker.Items[KuzovPicker.SelectedIndex]; AdVM.Color = ColorPicker.Items[ColorPicker.SelectedIndex]; AdVM.SteeringWheel = GetterRB(SteeringWheelRB); AdSQLiteH.SaveItem(AdVM); await DisplayAlert("", "Общая информация успешно сохранена", "OK"); await Navigation.PushModalAsync(new NavigationPage(new AdPage())); return; }
public DvigTransEditPage() { InitializeComponent(); int CurrentAdId = CrossSettings.Current.GetValueOrDefault("CurrentAdId", 0); if (CurrentAdId.Equals(0)) { Navigation.PushModalAsync(new NavigationPage(new MainPage())); } var AdVM = AdSQLiteH.GetById(CurrentAdId); VolumeEntry.Text = AdVM.Volume.ToString(); PowerEntry.Text = AdVM.Power.ToString(); foreach (var DvigType in DvigTypeSQLiteH.GetItems()) { DvigTypePicker.Items.Add(DvigType.Value); } DvigTypePicker.SelectedIndex = DvigTypePicker.Items.IndexOf(AdVM.DvigType); foreach (var KPP in KPPSQLiteH.GetItems()) { KPPPicker.Items.Add(KPP.Value); } KPPPicker.SelectedIndex = KPPPicker.Items.IndexOf(AdVM.KPP); foreach (var DriveUnit in DriveUnitSQLiteH.GetItems()) { DriveUnitPicker.Items.Add(DriveUnit.Value); } DriveUnitPicker.SelectedIndex = DriveUnitPicker.Items.IndexOf(AdVM.DriveUnit); }
public MainInfoEditPage() { InitializeComponent(); int CurrentAdId = CrossSettings.Current.GetValueOrDefault("CurrentAdId", 0); if (CurrentAdId.Equals(0)) { Navigation.PushModalAsync(new NavigationPage(new MainPage())); } var AdVM = AdSQLiteH.GetById(CurrentAdId); VINEntry.Text = AdVM.VIN; MileageEntry.Text = AdVM.Mileage.ToString(); SetterRB(SteeringWheelRB, AdVM.SteeringWheel); foreach (var Mark in MarkSQLiteH.GetItems()) { MarkPicker.Items.Add(Mark.Value); } MarkPicker.SelectedIndex = MarkPicker.Items.IndexOf(AdVM.Mark); foreach (var Model in ModelSQLiteH.GetItems()) { ModelPicker.Items.Add(Model.Value); } ModelPicker.SelectedIndex = ModelPicker.Items.IndexOf(AdVM.Model); foreach (var Kuzov in KuzovSQLiteH.GetItems()) { KuzovPicker.Items.Add(Kuzov.Value); } KuzovPicker.SelectedIndex = KuzovPicker.Items.IndexOf(AdVM.Kuzov); foreach (var Year in YearSQLiteH.GetItems()) { YearPicker.Items.Add(Year.Value); } YearPicker.SelectedIndex = YearPicker.Items.IndexOf(AdVM.Year); foreach (var Color in ColorSQLiteH.GetItems()) { ColorPicker.Items.Add(Color.Value); } ColorPicker.SelectedIndex = ColorPicker.Items.IndexOf(AdVM.Color); }
async void DvigTransSaveButton_Clicked(object sender, EventArgs e) { int CurrentAdId = CrossSettings.Current.GetValueOrDefault("CurrentAdId", 0); if (CurrentAdId.Equals(0)) { await Navigation.PushModalAsync(new NavigationPage(new MainPage())); } var AdVM = AdSQLiteH.GetById(CurrentAdId); AdVM.DvigType = DvigTypePicker.Items[DvigTypePicker.SelectedIndex]; AdVM.KPP = KPPPicker.Items[KPPPicker.SelectedIndex]; AdVM.DriveUnit = DriveUnitPicker.Items[DriveUnitPicker.SelectedIndex]; AdVM.Volume = Convert.ToDouble(VolumeEntry.Text); AdVM.Power = Convert.ToDouble(PowerEntry.Text); AdSQLiteH.SaveItem(AdVM); await DisplayAlert("", "Двигатель и трансмиссия успешно сохранена", "OK"); await Navigation.PushModalAsync(new NavigationPage(new AdPage())); return; }