void loadTaxa(IList <TaxonList> selectedLists)
 {
     if (DefinitionsSvc != null)
     {
         CurrentOperation = DefinitionsSvc.loadTaxonLists(selectedLists);
     }
     else
     {
         _Log.Error("DefinitionsService N/A");
     }
 }
        /// <summary>
        /// Initializes a new instance of the ActionsViewModel class.
        /// </summary>
        public ActionsViewModel()
            : base("Actions_NextText", "Actions_PreviousText", "Actions_Title", "Actions_Description")
        {
            NextPage        = Page.Actions;
            PreviousPage    = Page.ProjectSelection;
            CanNavigateBack = true;
            CanNavigateNext = true;

            updateFromSyncState();

            MessengerInstance.Register <ConnectionStateChanged>(this,
                                                                (msg) =>
            {
                _cState = msg.Content;
            });

            MessengerInstance.Register <SyncStateChanged>(this,
                                                          (msg) =>
            {
                _sState = msg.Content;

                updateFromSyncState();
            });

            MessengerInstance.Register <ApplicationClosing>(this,
                                                            (msg) =>
            {
                if (msg.WarningOnly)
                {
                    saveAndClose();
                }
            });

            MessengerInstance.Register <ExecuteAction>(this,
                                                       (msg) =>
            {
                if (msg.Content == Enums.Action.CleanDB)
                {
                    executeCleanDB();
                }
            });
            MessengerInstance.Register <SelectedTaxonLists>(this,
                                                            (msg) =>
            {
                if (DefinitionsSvc != null)
                {
                    DefinitionsSvc.TaxaLoaded += new AsyncOperationFinishedHandler(DefinitionsSvc_TaxaLoaded);
                }
                loadTaxa(msg.Content);
            });



            GetTaxonDefinitions = new RelayCommand(
                () =>
            {
                MessengerInstance.Send <CustomDialog>(Dialog.Taxon);
            },
                () =>
            {
                return(requiredConnectionLevel(DEFINITIONS));
            });

            GetPropertyNames = new RelayCommand(
                () =>
            {
                if (DefinitionsSvc != null)
                {
                    IsBusy           = true;
                    CurrentOperation = DefinitionsSvc.loadProperties();
                }
                else
                {
                    _Log.Error("DefinitionsService N/A");
                }
            },
                () =>
            {
                return(requiredConnectionLevel(DEFINITIONS));
            });

            GetPrimaryData = new RelayCommand(
                () =>
            {
                MessengerInstance.Send <NavigateToPage>(Page.FieldData);
            },
                () =>
            {
                return(requiredConnectionLevel(REPOSITORY));
            });

            UploadData = new RelayCommand(
                () =>
            {
                if (FieldDataSvc != null)
                {
                    if (ProfileSvc != null)
                    {
                        var projectID = ProfileSvc.ProjectID;
                        var userNo    = ProfileSvc.UserNr;
                        IsBusy        = true;

                        CurrentOperation = FieldDataSvc.uploadData(userNo, projectID);
                    }
                    else
                    {
                        _Log.Error("UserProfileService N/A");
                    }
                }
                else
                {
                    _Log.Error("FieldDataService N/A");
                }
            },
                () =>
            {
                return(requiredConnectionLevel(REPOSITORY));
            });

            CleanDatabase = new RelayCommand(
                () =>
            {
                showYesNoBox("Actions_Clean", "Actions_ReallyClean_Message", System.Windows.MessageBoxResult.No, (res) =>
                {
                    if (res == System.Windows.MessageBoxResult.Yes)
                    {
                        executeCleanDB();
                    }
                });
            },
                () =>
            {
                return(requiredConnectionLevel(ConnectionState.ConnectedToSynchronization | ConnectionState.ConnectedToMobileTax | ConnectionState.ConnectedToMobile));
            });
            OpenMaps = new RelayCommand(
                () =>
            {
                MessengerInstance.Send <NavigateToPage>(Page.Map);
            });
        }