/// <summary> /// Default constructor. /// </summary> public ListOfSurveysViewModel() { List = new ObservableCollection <SurveyBasicInfo>(); DownloadStatus = new DownloadListStatus(); Connection = new TestConnection(); _operations = new OperationsOnListOfSurveys(List, DownloadStatus); }
private bool CheckIfPasswordIsCorrect() { if (!String.IsNullOrEmpty(EncryptionPassword)) { ObservableCollection <SurveyBasicInfo> surveys = new ObservableCollection <SurveyBasicInfo>(); OperationsOnListOfSurveys operations = new OperationsOnListOfSurveys(surveys, new DownloadListStatus()); operations.Read(); foreach (SurveyBasicInfo survey in surveys) { ObservableCollection <ResultBasicInfo> results = new ObservableCollection <ResultBasicInfo>(); OperationsOnListOfResults resultsOperator = new OperationsOnListOfResults(survey.SurveyId, results); resultsOperator.ReadList(); foreach (ResultBasicInfo result in results) { Survey surveyModel = new Survey(); surveyModel.Id = survey.SurveyId; surveyModel.ResultInfo = result; try { surveyModel.GetSavedDocument(); return(true); } catch (CryptographicException) { return(false); } } } return(true); } return(false); }
/// <summary> /// Default constructor. /// </summary> public ListOfNewSurveysViewModel() { List = new ObservableCollection <SurveyBasicInfo>(); DownloadListStatus = new DownloadListStatus(); Operations = new OperationsOnListOfSurveys(List, DownloadListStatus); DownloadSurveysStatus = new DownloadSurveysStatus(); }
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> /// Allows you to initialize all necessary data members. /// </summary> /// <param name="operationsOnList">Instance of <see cref="OperationsOnListOfSurveys" /> class.</param> /// <param name="surveysToDownload">List of surveys downloaded with <see cref="CheckForNewSurveyList" /> class.</param> /// <param name="downloadStatus">Instance of <see cref="DownloadSurveysStatus" /> class.</param> public DownloadNewSurveys(OperationsOnListOfSurveys operationsOnList, List<SurveyBasicInfo> surveysToDownload, DownloadSurveysStatus downloadStatus) { _operationsOnList = operationsOnList; _surveysToDownload = surveysToDownload; _downloadStatus = downloadStatus; string strIMEI = OperationsOnSettings.Instance.IMEI; string strBaseURL = OperationsOnSettings.Instance.ServerURL; Random rand = new Random(); _downloadUrl = string.Format("{0}ReceiveSurveys?do=download&imei={1}&nocache={2}", strBaseURL, strIMEI, rand.Next(50)); _ackUrl = string.Format("{0}ReceiveSurveys?do=ack&imei={1}&nocache={2}", strBaseURL, strIMEI, rand.Next(50)); }
/// <summary> /// Allows you to initialize all necessary data members. /// </summary> /// <param name="operationsOnList">Instance of <see cref="OperationsOnListOfSurveys" /> class.</param> /// <param name="surveysToDownload">List of surveys downloaded with <see cref="CheckForNewSurveyList" /> class.</param> /// <param name="downloadStatus">Instance of <see cref="DownloadSurveysStatus" /> class.</param> public DownloadNewSurveys(OperationsOnListOfSurveys operationsOnList, List <SurveyBasicInfo> surveysToDownload, DownloadSurveysStatus downloadStatus) { _operationsOnList = operationsOnList; _surveysToDownload = surveysToDownload; _downloadStatus = downloadStatus; string strIMEI = OperationsOnSettings.Instance.IMEI; string strBaseURL = OperationsOnSettings.Instance.ServerURL; Random rand = new Random(); _downloadUrl = string.Format("{0}ReceiveSurveys?do=download&imei={1}&nocache={2}", strBaseURL, strIMEI, rand.Next(50)); _ackUrl = string.Format("{0}ReceiveSurveys?do=ack&imei={1}&nocache={2}", strBaseURL, strIMEI, rand.Next(50)); }
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"; } }
/// <summary> /// Allows you to initialize all necessary data members. /// </summary> /// <param name="list">List of current saved surveys.</param> /// <param name="downloadStatus">Instance of <see cref="DownloadListStatus" /> class.</param> /// <param name="operations">Instance of <see cref="OperationsOnListOfSurveys" /> class.</param> public CheckForNewSurveyList(ObservableCollection<SurveyBasicInfo> list, DownloadListStatus downloadStatus, OperationsOnListOfSurveys operations) { _list = list; _downloadStatus = downloadStatus; _operationsOnListOfSurveys = operations; }
/// <summary> /// Allows you to initialize all necessary data members. /// </summary> /// <param name="list">List of current saved surveys.</param> /// <param name="downloadStatus">Instance of <see cref="DownloadListStatus" /> class.</param> /// <param name="operations">Instance of <see cref="OperationsOnListOfSurveys" /> class.</param> public CheckForNewSurveyList(ObservableCollection <SurveyBasicInfo> list, DownloadListStatus downloadStatus, OperationsOnListOfSurveys operations) { _list = list; _downloadStatus = downloadStatus; _operationsOnListOfSurveys = operations; }