/// <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;
            }
        }
        private void CheckNewSurvey()
        {
            if (OperationsOnSettings.Instance.AutoCheckNewSurvey && _isNewPageInstance)
            {
                ListOfNewSurveysViewModel newSurveyViewModel = new ListOfNewSurveysViewModel();
                newSurveyViewModel.Operations.CheckForNewSurveys();

                newSurveyViewModel.DownloadListStatus.Message.DialogBoxEvent += (object sender, EventArgs args) =>
                {
                    //don't display message if server not found
                    if ((newSurveyViewModel.DownloadListStatus.Message.Field != Languages.AppResources.checkForNewSurveyList_ServerNotFound) && (newSurveyViewModel.DownloadListStatus.Message.Field != Languages.AppResources.checkForNewSurveyList_ServerIncompleteResponse))
                    {
                        ShowDownloadCancelMessageBox messageBox = new ShowDownloadCancelMessageBox();
                        messageBox.Title = newSurveyViewModel.DownloadListStatus.Message.Field;

                        messageBox.Completed += (object snd, EventArgs arg) =>
                        {
                            if (App.AppDictionary.ContainsKey("NewSurveys"))
                                App.AppDictionary["NewSurveys"] = newSurveyViewModel.List;
                            else
                                App.AppDictionary.Add("NewSurveys", newSurveyViewModel.List);

                            if (((ShowDownloadCancelMessageBox)snd).Response == ShowDownloadCancelMessageBox.MessageResponse.Show) //show list of new surveys
                                NavigationService.Navigate(new Uri("/View/ListOfNewSurveysPage.xaml?action=showListOfSurveys", UriKind.Relative));
                            else if (((ShowDownloadCancelMessageBox)snd).Response == ShowDownloadCancelMessageBox.MessageResponse.Download) //download new surveys
                                NavigationService.Navigate(new Uri("/View/ListOfNewSurveysPage.xaml?action=downloadNewSurveys", UriKind.Relative));
                        };

                        messageBox.Show();
                    }
                    //server not found
                    else
                    {
                        MessageBox.Show(newSurveyViewModel.DownloadListStatus.Message.Field);
                    }
                };

                _isNewPageInstance = false;
            }
        }