//  CreateInvasiveCommand => new Command<Project>(async (Project project) => await CreateInvasive(project));
        private async Task CreateInvasive(Project project)
        {
            //var result = await Shell.Current.DisplayAlert(
            //    "Alert",
            //    "Are you sure you want to remove?",
            //    "Yes", "No");

            //if (result)
            //{
            IsBusyProgress = true;
            var response = await Task.Run(() =>
                                          ProjectDataStore.CreateInvasiveReport(project)
                                          );

            if (response.Status == ApiResult.Success)
            {
                App.IsInvasive = true;
                IsBusyProgress = false;
                await Shell.Current.Navigation.PushAsync(new ProjectDetail()
                {
                    BindingContext = new ProjectDetailViewModel()
                    {
                        Project = project
                    }
                });
            }


            //}
        }
示例#2
0
        async Task CreateInvasive()
        {
            IsBusyProgress = true;

            if (App.IsInvasive == true)
            {
                Project.IsInvasive = true;
                Project.Id         = Project.InvasiveProjectID;
                var response = await Task.Run(() =>
                                              ProjectDataStore.CreateInvasiveReport(Project)
                                              );

                if (response.Status == ApiResult.Success)
                {
                    App.IsInvasive = true;
                    Project.Id     = response.ID.ToString();

                    //if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(ProjectDetail))
                    //{
                    await Shell.Current.Navigation.PushAsync(new ProjectDetail()
                    {
                        BindingContext = new ProjectDetailViewModel()
                        {
                            Project = Project
                        }
                    });

                    //}
                    IsBusyProgress = false;
                    //  await Shell.Current.Navigation.PopAsync();
                }
            }
            else
            {
                Project.IsInvasive = false;
                // Project.Id = Project.InvasiveProjectID;
                var response = await Task.Run(() =>
                                              ProjectDataStore.CreateInvasiveReport(Project)
                                              );

                if (response.Status == ApiResult.Success)
                {
                    App.IsInvasive = true;
                    Project.Id     = response.ID.ToString();
                    await Shell.Current.Navigation.PushAsync(new ProjectDetail()
                    {
                        BindingContext = new ProjectDetailViewModel()
                        {
                            Project = Project
                        }
                    });

                    IsBusyProgress = false;
                    //  await Shell.Current.Navigation.PopAsync();
                }
            }
        }