Пример #1
0
        private async void btnEditMultipurpose_Click(object sender, RoutedEventArgs e)
        {
            addOrEdit = 2;

            //Item selectedItem = (Item)lstPreMadeQuestions.SelectedItem;
            selectedItem = (Item)gvAvailableQuestions.SelectedItem;
            string warning = "Please exercise caution when editing this question. This question may " +
                             "have been used in events and may have saved results.  Thus, changing the question and " +
                             "datatypes may cause the program to become unstable and make previously collected data useless. " +
                             "Do you wish to continue?";

            if (selectedItem != null)
            {
                var result = await Jeeves.ConfirmDialog("Warning", warning);

                if (result == ContentDialogResult.Secondary && btnEditQuestion.Content.ToString() == "Edit Question")
                {
                    tbkEnterQuestion.Visibility     = Visibility.Visible;
                    txtNewSurveyQuestion.Visibility = Visibility.Visible;
                    tbkDataType.Visibility          = Visibility.Visible;
                    cboDataType.Visibility          = Visibility.Visible;
                    rpSaveAndCancel.Visibility      = Visibility.Visible;
                    BeginUpdate(selectedItem);
                }
                else if (result == ContentDialogResult.Secondary)
                {
                    SaveQuestion(selectedItem);
                }
            }
        }
        private async void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            var result = await Jeeves.ConfirmDialog("Stop Game", "Do you wish to stop the game?");

            if (result == ContentDialogResult.Secondary)
            {
                Frame.Navigate(typeof(EventAttendanceTracking), (Models.Event)thisEvent);
            }
        }
Пример #3
0
        private async void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            string strTitle            = "Confirm Delete";
            string strMsg              = "Are you certain that you want to delete " + view.Name + "?";
            ContentDialogResult result = await Jeeves.ConfirmDialog(strTitle, strMsg);

            if (result == ContentDialogResult.Secondary)
            {
                try
                {
                    view.ArtType = null;
                    ArtWorkRepository er = new ArtWorkRepository();
                    await er.DeleteArtWork(view);

                    Frame.GoBack();
                }
                catch (AggregateException ex)
                {
                    string errMsg = "";
                    foreach (var exception in ex.InnerExceptions)
                    {
                        errMsg += Environment.NewLine + exception.Message;
                    }
                    Jeeves.ShowMessage("One or more exceptions has occurred:", errMsg);
                }
                catch (ApiException apiEx)
                {
                    var sb = new StringBuilder();
                    sb.AppendLine("Errors:");
                    foreach (var error in apiEx.Errors)
                    {
                        sb.AppendLine("-" + error);
                    }
                    Jeeves.ShowMessage("Problem Deleting the Patient:", sb.ToString());
                }
                catch (Exception)
                {
                    Jeeves.ShowMessage("Error", "Error Deleting Patient");
                }
            }
        }
        private async void btnEditMultipurpose_Click(object sender, RoutedEventArgs e)
        {
            addOrEdit = 2;

            string selected = Convert.ToString(((Button)sender).DataContext);

            selectedItem = itemRespository.GetItem(selected.ToString());
            string warning = "Please exercise caution when editing this question. Do you wish to continue?";

            if (selectedItem != null)
            {
                var result = await Jeeves.ConfirmDialog("Warning", warning);

                if (result == ContentDialogResult.Secondary) //&& btnEditSurvey.Content.ToString() == "#xE74D;"
                {
                    ScreenLockDown();
                    BeginUpdate(selectedItem);
                }
                else if (result == ContentDialogResult.Secondary)
                {
                    SaveQuestion(selectedItem);
                }
            }
        }