private void ListOfSurveysPage_Loaded(object sender, RoutedEventArgs e) { _viewModel = new ListOfSurveysViewModel(); _viewModel.Read(); bool isLanguageChanged = (AppResources.Culture.ToString() != _oldLanguage); _oldLanguage = AppResources.Culture.ToString(); bool isThemeChanged = (OperationsOnSettings.Instance.Theme != _oldTheme); _oldTheme = OperationsOnSettings.Instance.Theme; if (_isNewPageInstance || isLanguageChanged || isThemeChanged) { BuildApplicationBar(); } if (_isFavoriteView) { ListOfSurveysBox.DataContext = from favorites in _viewModel.List where favorites.IsFavorite == true select favorites; } else { ListOfSurveysBox.DataContext = _viewModel.List; } BusyIndicator.DataContext = _viewModel.Connection.Busy; MessageView.AssignDisplay(_viewModel.Connection.Message); CheckNewSurvey(); }
/// <summary> /// Standard WP7 method which is running always when user navigates to page. /// </summary> /// <param name="e">NavigationService argument</param> protected override void OnNavigatedTo(NavigationEventArgs e) { if (_isNewInstance) { if ((Application.Current as App).ApplicationState == App.AplicationStates.Activated) { // Do what you have to do when application is activated and change state for runing. (Application.Current as App).ApplicationState = App.AplicationStates.Runing; } base.OnNavigatedTo(e); string strSurveyName = string.Empty; string strSurveyId = string.Empty; string isFavorite; if (NavigationContext.QueryString.TryGetValue("SurveyName", out strSurveyName) && NavigationContext.QueryString.TryGetValue("SurveyId", out strSurveyId) && NavigationContext.QueryString.TryGetValue("isFavorite", out isFavorite)) { PageTitle.Text = strSurveyName; _viewModel = new SurveyViewModel(strSurveyId); _viewModel.IsFavorite = isFavorite; BusyIndicator.DataContext = _viewModel.ProgressBar; ListOfResults.DataContext = _viewModel.ListOfResults; MessageView.AssignDisplay(_viewModel.Message); } _isNewInstance = false; BuildApplicationBar(); } _viewModel.ReloadList(); }
/// <summary> /// Default constuctor which initializes component on page. /// </summary> public RegistrationPage() { InitializeComponent(); LengthValidationRule rule = new LengthValidationRule(5, 15) { MaxErrorMessage = Languages.AppResources.operationsOnRegistration_ContainMaximum, MinErrorMessage = Languages.AppResources.operationsOnRegistration_ContainMinimum }; ImeiTextBox.ValidationRule = rule; PhoneNumberTextBox.ValidationRule = rule; string urlPattern = "^(http(s?)\\:\\/\\/)*[0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*(:(0-9)*)*(\\/?)([a-zA-Z0-9\\-\\.\\?\\,\\'\\/\\\\+&%\\$#_]*)?$"; ServerUrlTextBox.ValidationRule = new RegexValidationRule(urlPattern) { Message = Languages.AppResources.operationsOnRegistration_ValidServerAddress }; _registration = new RegistrationViewModel(); _registration.Operator.LeaveRegistrationEvent += new EventHandler(LeaveRegistrationCallback); MessageView.AssignDisplay(_registration.Operator.ConnectionResult); RegistrationDisplay.DataContext = _registration.Operator.RegistrationInstance; BusyIndicator.DataContext = _registration.Operator.Busy; }
/// <summary> /// Standard WP7 method which is running always when user navigates to page. /// </summary> /// <param name="e">NavigationService argument</param> protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); string action = string.Empty; if (NavigationContext.QueryString.TryGetValue("action", out action)) { _viewModel = new ListOfNewSurveysViewModel(); _viewModel.List = App.AppDictionary["NewSurveys"] as ObservableCollection <SurveyBasicInfo>; _viewModel.DownloadSurveysStatus.GoBackEventHandler += (object sender, EventArgs args) => { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { NavigationService.GoBack(); }); }; _isNewPageInstance = false; ListOfNewSurveysBox.DataContext = _viewModel.List; Status.DataContext = _viewModel.DownloadListStatus; if (action == "downloadNewSurveys") { OnDownloadSurveys(null, null); } } if (_isNewPageInstance) { _viewModel = new ListOfNewSurveysViewModel(); _viewModel.DownloadListStatus.PropertyChanged += (object sender, PropertyChangedEventArgs args) => { if (args.PropertyName.Equals("IsDownloadButtonEnabled")) { _appBarDownload.IsEnabled = _viewModel.DownloadListStatus.IsDownloadButtonEnabled; } }; MessageView.AssignDisplay(_viewModel.DownloadListStatus.Message); MessageView.AssignDisplay(_viewModel.DownloadSurveysStatus.Message); _viewModel.DownloadSurveysStatus.GoBackEventHandler += (object sender, EventArgs args) => { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { NavigationService.GoBack(); }); }; if ((Application.Current as App).ApplicationState == App.AplicationStates.Activated) { if (!string.IsNullOrEmpty((Application.Current as com.comarch.mobile.ndg.App).ApplicationDataObject)) { _viewModel.Operations.StateDictionaryData = (Application.Current as com.comarch.mobile.ndg.App).ApplicationDataObject; } (Application.Current as App).ApplicationState = App.AplicationStates.Runing; } else { _viewModel.Operations.CheckForNewSurveys(); } ListOfNewSurveysBox.DataContext = _viewModel.List; Status.DataContext = _viewModel.DownloadListStatus; BusyIndicator.DataContext = _viewModel.DownloadListStatus.ProgressBar; _isNewPageInstance = false; } }
/// <summary> /// Default constuctor which initializes component on page. /// </summary> public SettingsPage() { InitializeComponent(); MessageView.AssignDisplay(OperationsOnSettings.Instance.Message); }