コード例 #1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ListOfSurveysViewModel()
 {
     List = new ObservableCollection<SurveyBasicInfo>();
     DownloadStatus = new DownloadListStatus();
     Connection = new TestConnection();
     _operations = new OperationsOnListOfSurveys(List, DownloadStatus);
 }
コード例 #2
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public ListOfNewSurveysViewModel()
 {
     List = new ObservableCollection<SurveyBasicInfo>();
     DownloadListStatus = new DownloadListStatus();
     Operations = new OperationsOnListOfSurveys(List, DownloadListStatus);
     DownloadSurveysStatus = new DownloadSurveysStatus();
 }
コード例 #3
0
        private void OnFavorite(object sender, EventArgs e)
        {
            OperationsOnListOfSurveys op = new OperationsOnListOfSurveys(new ObservableCollection<SurveyBasicInfo>(), new DownloadListStatus());

            //remove from favorite surveys
            if (Convert.ToBoolean(_viewModel.IsFavorite))
            {
                op.RemoveFromFavorite(_viewModel.SurveyId);
                _appBarFavorite.IconUri = new Uri("/View/icons/AddFavoriteIcon.png", UriKind.Relative);
                _appBarFavorite.Text = Languages.AppResources.surveyPageAppBar_AddToFavorite;
                _viewModel.IsFavorite = "false";
            }
            //add to favorite surveys
            else
            {
                op.AddToFavorite(_viewModel.SurveyId);
                _appBarFavorite.IconUri = new Uri("/View/icons/RemoveFavoriteIcon.png", UriKind.Relative);
                _appBarFavorite.Text = Languages.AppResources.surveyPageAppBar_RemoveFromFavorite;
                _viewModel.IsFavorite = "true";
            }
        }
コード例 #4
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();
        }