public async void SchadsymptomHinzufügen(string parameter) { if (parameter == null) { await DialogService.ShowAlertAsync("Es muss ein Schadsymptom eingegeben werden, um es hinzuzufügen.", "Hinweis", "OK"); return; } if (SchadsymptomeSelected.Where(s => s.name == parameter).ToList().Count != 0) { if (!await DialogService.ShowConfirmAsync("Es wurde bereits ein Schadsymptom mit dem eingegebenen Namen ausgewählt, soll es nochmal hinzugefügt werden?", "Hinweis")) { return; } } Schadsymptom schadsymptom = DataService.GetSchadsymptom(parameter); if (schadsymptom == null) { schadsymptom = new Schadsymptom(); schadsymptom.name = parameter; if (await DialogService.ShowConfirmAsync("Soll das Schadsymptom \"" + parameter + "\" der Datenbank hinzugefügt werden, um später als Vorschlag angezeigt zu werden?", "Schadsymptom Hinzufügen")) { DataService.AddSchadsymptome(new List <Schadsymptom> { schadsymptom }); schadsymptom = DataService.GetSchadsymptom(parameter); AllSchadsymptome.Add(schadsymptom); } } SchadsymptomeSelected.Add(schadsymptom); Schadsymptom = ""; }
private async void SchadsymptomWasSelected(ItemTappedEventArgs arg) { Schadsymptom schadsymptom = arg.Item as Schadsymptom; if (!SchadsymptomeSelected.Contains(schadsymptom)) { SchadsymptomeSelected.Add(schadsymptom); } else { await DialogService.ShowAlertAsync("Das Schadsymptom wurde bereits hinzugefügt.", "Hinweis", "OK"); } }
//public async Task<string> ChooseProject() //{ // // Version that lets the user pick a file from storage // //FileData fileData = await CrossFilePicker.Current.PickFile(); // //await CrossFilePicker.Current.PickFile(); // //if (fileData == null) // //{ // // return ""; // //} // //else // //{ // // string name = fileData.FileName; // // try // // { // // database_connection = new SQLiteConnection(fileData.FilePath); // // } // // catch (Exception) // // { // // return ""; // // } // // return name; // //} // //string fileName = fileData.FileName; // //if (Device.RuntimePlatform == Device.Android && // // !await this.CheckPermissionsAsync()) // //{ // // return; // //} // //var pickedFile = await CrossFilePicker.Current.PickFile(); // //if (pickedFile!=null) // //{ // // string fileName = pickedFile.FileName; // //} // //string dbFilePath = await DependencyService.Get<IFileHelper>().PickFile(); //} public async void CreateTestProject() { //DependencyService.Get<IFileHelper>().DeleteFile("Test.db"); if (!await DependencyService.Get <IFileHelper>().CheckForFile("Test.db")) { CreateArbeitsDB("Test"); string db_filepath = await DependencyService.Get <IFileHelper>().GetLocalDatabasePath("Test.db"); database_connection = new SQLiteConnection(db_filepath); //Testdaten einfügen Straße straße = new Straße(); straße.name = "Teststraße"; database_connection.Insert(straße); straße.name = "Klausstraße"; database_connection.Insert(straße); Baumart baumart = new Baumart(); baumart.NameDeutsch = "Spitzahorn"; baumart.NameBotanisch = "Acer platanoides"; database_connection.Insert(baumart); baumart.NameDeutsch = "Säulenpappel"; baumart.NameBotanisch = "Populus nigra italica"; database_connection.Insert(baumart); // Create the tables Schadsymptom schadsymptom = new Schadsymptom(); schadsymptom.name = "Totholz"; database_connection.Insert(schadsymptom); } else { string db_filepath = await DependencyService.Get <IFileHelper>().GetLocalDatabasePath("Test.db"); database_connection = new SQLiteConnection(db_filepath); } }
private void DeleteSchadsymptomSelected(object obj) { Schadsymptom schadsymptom = obj as Schadsymptom; SchadsymptomeSelected.Remove(schadsymptom); }