Beispiel #1
0
 /// <summary>
 /// Standard WP7 method which is running always when user presses back key.
 /// </summary>
 /// <param name="e">NavigationService argument</param>
 protected override void OnBackKeyPress(CancelEventArgs e)
 {
     if (_viewModel.Survey.IsResultChanged)
     {
         _backPreesed = true;
         e.Cancel     = true;
         if (!_savingInProgress)
         {
             _savingInProgress = true;
             YesNoMessageBox messageBox = new YesNoMessageBox();
             messageBox.Message    = Languages.AppResources.fillingSurveyPage_saveQuestion;
             messageBox.Completed += (object sender, EventArgs args) =>
             {
                 if (((YesNoMessageBox)sender).Response == YesNoMessageBox.MessageResponse.Yes)
                 {
                     CheckIfCanSaveSurveyResultAndSave();
                 }
                 else
                 {
                     _savingInProgress = false;
                     NavigationService.GoBack();
                 }
             };
             messageBox.Show();
         }
     }
     base.OnBackKeyPress(e);
 }
Beispiel #2
0
        private void OnDeleteSurvey(object sender, EventArgs e)
        {
            YesNoMessageBox messageBox = new YesNoMessageBox();

            messageBox.Title      = Languages.AppResources.surveyPage_deleteSurveyDialogTitle;
            messageBox.Message    = Languages.AppResources.surveyPage_deleteSurveyDialogMessage;
            messageBox.Completed += (object YesNosender, EventArgs args) =>
            {
                if (((YesNoMessageBox)YesNosender).Response == YesNoMessageBox.MessageResponse.Yes)
                {
                    try
                    {
                        OperationsOnListOfSurveys op = new OperationsOnListOfSurveys(new ObservableCollection <SurveyBasicInfo>(), new DownloadListStatus());
                        op.Delete(_viewModel.SurveyId);

                        NavigationService.GoBack();
                    }
                    catch (IsolatedStorageException)
                    {
                        MessageBox.Show(Languages.AppResources.surveyPage_deleteSurveyError);
                    }
                }
            };
            messageBox.Show();
        }
 /// <summary>
 /// Standard WP7 method which is running always when user presses back key.
 /// </summary>
 /// <param name="e">NavigationService argument</param>
 protected override void OnBackKeyPress(CancelEventArgs e)
 {
     e.Cancel = true;
     YesNoMessageBox message = new YesNoMessageBox();
     message.Message = Languages.AppResources.enableEncryptionPage_closeQuestion;
     message.Completed += (object s, EventArgs args) =>
         {
             if ((s as YesNoMessageBox).Response == YesNoMessageBox.MessageResponse.Yes)
             {
                 App.Quit();
             }
         };
     message.Show();
 }
Beispiel #4
0
        /// <summary>
        /// Standard WP7 method which is running always when user presses back key.
        /// </summary>
        /// <param name="e">NavigationService argument</param>
        protected override void OnBackKeyPress(CancelEventArgs e)
        {
            e.Cancel = true;
            YesNoMessageBox message = new YesNoMessageBox();

            message.Message    = Languages.AppResources.enableEncryptionPage_closeQuestion;
            message.Completed += (object s, EventArgs args) =>
            {
                if ((s as YesNoMessageBox).Response == YesNoMessageBox.MessageResponse.Yes)
                {
                    App.Quit();
                }
            };
            message.Show();
        }
 /// <summary>
 /// Method to display customize DialogBox with options Yes/No.
 /// </summary>
 /// <param name="box">Contain information about MessageBox (e.g. title, message field)</param>
 public static void AssignYesNoMessage(DialogBox box)
 {
     box.YesNoMessageEvent += (object sender, EventArgs args) =>
     {
         YesNoMessageBox messageBox = new YesNoMessageBox();
         messageBox.Message = box.Field;
         messageBox.Title = box.Title;
         messageBox.Completed += (object YesNosender, EventArgs completedArgs) =>
         {
             box.YesNoResponse = (YesNosender as YesNoMessageBox).Response;
             if (box.YesNoAnswerCompleted != null)
             {
                 box.YesNoAnswerCompleted(sender, args);
             }
         };
         messageBox.Show();
     };
 }
Beispiel #6
0
        private void OnDeleteResult(object sender, RoutedEventArgs e)
        {
            YesNoMessageBox messageBox = new YesNoMessageBox();

            messageBox.Title      = Languages.AppResources.surveyPage_deleteResultQuestionTitle;
            messageBox.Message    = Languages.AppResources.surveyPage_deleteResultQuestionMessage;
            messageBox.Completed += (object YesNosender, EventArgs args) =>
            {
                if (((YesNoMessageBox)YesNosender).Response == YesNoMessageBox.MessageResponse.Yes)
                {
                    try
                    {
                        ResultBasicInfo selectedListBoxItem = (sender as MenuItem).DataContext as ResultBasicInfo;
                        _viewModel.DeleteResult(selectedListBoxItem);
                    }
                    catch (IsolatedStorageException)
                    {
                        MessageBox.Show(Languages.AppResources.surveyPage_deleteResultError);
                    }
                }
            };
            messageBox.Show();
        }
        private void OnDeleteSurvey(object sender, EventArgs e)
        {
            YesNoMessageBox messageBox = new YesNoMessageBox();
            messageBox.Title = Languages.AppResources.surveyPage_deleteSurveyDialogTitle;
            messageBox.Message = Languages.AppResources.surveyPage_deleteSurveyDialogMessage;
            messageBox.Completed += (object YesNosender, EventArgs args) =>
            {
                if (((YesNoMessageBox)YesNosender).Response == YesNoMessageBox.MessageResponse.Yes)
                {
                    try
                    {
                        OperationsOnListOfSurveys op = new OperationsOnListOfSurveys(new ObservableCollection<SurveyBasicInfo>(), new DownloadListStatus());
                        op.Delete(_viewModel.SurveyId);

                        NavigationService.GoBack();
                    }
                    catch (IsolatedStorageException)
                    {
                        MessageBox.Show(Languages.AppResources.surveyPage_deleteSurveyError);
                    }
                }
            };
            messageBox.Show();
        }
 private void OnDeleteResult(object sender, RoutedEventArgs e)
 {
     YesNoMessageBox messageBox = new YesNoMessageBox();
     messageBox.Title = Languages.AppResources.surveyPage_deleteResultQuestionTitle;
     messageBox.Message = Languages.AppResources.surveyPage_deleteResultQuestionMessage;
     messageBox.Completed += (object YesNosender, EventArgs args) =>
     {
         if (((YesNoMessageBox)YesNosender).Response == YesNoMessageBox.MessageResponse.Yes)
         {
             try
             {
                 ResultBasicInfo selectedListBoxItem = (sender as MenuItem).DataContext as ResultBasicInfo;
                 _viewModel.DeleteResult(selectedListBoxItem);
             }
             catch (IsolatedStorageException)
             {
                 MessageBox.Show(Languages.AppResources.surveyPage_deleteResultError);
             }
         }
     };
     messageBox.Show();
 }
 private void OnSettingsDelete(object sender, EventArgs e)
 {
     YesNoMessageBox messageBox = new YesNoMessageBox();
     messageBox.Title = Languages.AppResources.settings_deleteSettings;
     messageBox.Message = Languages.AppResources.settings_deleteSettingsDialogMessage;
     messageBox.Completed += (object YesNosender, EventArgs args) =>
     {
         if (((YesNoMessageBox)YesNosender).Response == YesNoMessageBox.MessageResponse.Yes)
         {
             _settingsList.DeleteSettings();
             MessageBox.Show(Languages.AppResources.settings_settingsDeleted);
             NavigationService.GoBack();
         }
     };
     messageBox.Show();
 }