private void ShowCreateProjectView(object sender, EventArgs e) { var createDialog = new CreateProjectView(); createDialog.CancelClicked += (s, args) => { contentPageArea.Children.Remove(createDialog); }; createDialog.CreateClicked += async(s, args) => { var eventArgs = args as ActionSheetEventArgs; if (eventArgs != null) { if (eventArgs.ProjectName != null && !String.IsNullOrEmpty(eventArgs.ProjectName.Trim())) { App.DataBase.AddOrUpdateProject(new ProjectModel(eventArgs.ProjectName.Trim())); projectsList.ItemsSource = App.DataBase.GetAllProjects(); contentPageArea.Children.Remove(createDialog); } else { await DisplayAlert("Warning", "Please, enter new project name.", "OK"); } } }; contentPageArea.Children.Add(createDialog, new Rectangle(0f, 0f, 1f, 1f), AbsoluteLayoutFlags.All); }
private void ShowCreateProjectView(object sender, EventArgs e) { var createDialog = new CreateProjectView (); createDialog.CancelClicked += (s, args) => { contentPageArea.Children.Remove(createDialog); }; createDialog.CreateClicked += async (s, args) => { var eventArgs = args as ActionSheetEventArgs; if (eventArgs != null) { if (eventArgs.ProjectName != null && !String.IsNullOrEmpty(eventArgs.ProjectName.Trim())) { App.DataBase.AddOrUpdateProject(new ProjectModel(eventArgs.ProjectName.Trim())); projectsList.ItemsSource = App.DataBase.GetAllProjects (); contentPageArea.Children.Remove(createDialog); } else { await DisplayAlert("Warning", "Please, enter new project name.", "OK"); } } }; contentPageArea.Children.Add (createDialog, new Rectangle (0f, 0f, 1f, 1f), AbsoluteLayoutFlags.All); }