コード例 #1
0
        private void MenuItem_OnClicked(object sender, EventArgs e)
        {
            var addReasonPage = new ReasonAddPage();

            (addReasonPage.BindingContext as ReasonViewModel).SaveComplete += ReasonsPage_SaveComplete;
            Device.BeginInvokeOnMainThread(async() =>
            {
                await Navigation.PushAsync(addReasonPage);
            });
        }
コード例 #2
0
        private void ReasonSelectionPage_NoReasons(object sender, EventArgs e)
        {
            Device.BeginInvokeOnMainThread(async() =>
            {
                var choice =
                    await DisplayAlert("No Reasons Saved", "Would you like to add a new reason now?", "Yes", "No");

                if (choice)
                {
                    var addReasonPage = new ReasonAddPage();
                    (addReasonPage.BindingContext as ReasonViewModel).SaveComplete += ReasonSelectionPage_SaveComplete;
                    ;
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        await Navigation.PushAsync(addReasonPage);
                    });
                }
                else
                {
                    await Navigation.PopAsync();
                }
            });
        }