using ( var trans = vRealmDb.BeginWrite()).var vSelEmp = vRealmDb.All().First(b => b.EmpId = mSelEmployee.EmpId).bool accepted = await DisplayAlert( "Confirm", "Are you Sure ?", "Yes", "No" ).public async void OnDeleteClicked(object sender, EventArgs args).Navigation.PushAsync( new EditEmp(mSelEmployee)).public void OnEditClicked(object sender, EventArgs args).public partial class ShowEmp : ContentPage. #Xamarin ios simulator keeps delete my database codeThe UI code of the same can be taken from the Sample Github Repository’s ShowEmp.xaml.Īdd the following code to the code behind of this page. Just like code, we are first taking the instance of the Realm database from static Realm object and then adding the values entered by user by using Write method of the vRealmDb object.Īdd a new ContentPage named ShowEmp.xaml for showing the details of selected employee on tapping/clicking on Employee list of MainPage. In OnSaveClicked event handler of above code, we are writing the code to save the entered data in database. public void OnSaveClicked(object sender, EventArgs args).public partial class AddEmp : ContentPage.The UI code of the same can be taken from the Sample Github Repository’s AddEmp.xaml.Īdd the following code to the code behind of AddEmp.Xaml. OnSelection and OnNewClicked are the event handlers for listView’s ItemSelected and button’s Click events respectively.Īdd a new ContentPage named AddEmp.Xaml for adding the details of new employee. As seen in the OnAppearing event handler of the above code, we are using Realm object to get the instance of database and then calling All Method to load all the Employee objects available in the database. Realm saves the data as the objects which are available in static Realm object for manipulation.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |