Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the OrganizationViewModel class.
        /// </summary>
        public OrganizationViewModel(IDataService dataService)
        {
            // Initialize data services
            _dataService = dataService;

            // Fill country list
            _countryCollection = new Collection <CountryViewModelItem>();
            _dataService.ActiveCountryList(FillCountryCollection);
            _dataService.CountryModified += (sender, e) => _dataService.ActiveCountryList(FillCountryCollection);

            // Fill organization collection
            _organizationCollection = new ObservableCollection <OrganizationViewModelItem>();
            _dataService.OrganizationList(FillOrganizationCollection);
            _dataService.OrganizationModified += (sender, e) => _dataService.OrganizationList(FillOrganizationCollection);

            // Default visibility
            _notesVisibility = Visibility.Visible;
            _editVisibility  = Visibility.Collapsed;

            if (ViewModelBase.IsInDesignModeStatic)
            {
                _notesVisibility = Visibility.Collapsed;
                _editVisibility  = Visibility.Visible;
            }
            else
            {
                _notesVisibility = Visibility.Visible;
                _editVisibility  = Visibility.Collapsed;
            }

            // Commands
            AddButtonCommand         = new RelayCommand(AddCommand);
            EditButtonCommand        = new RelayCommand(EditCommand);
            DeleteButtonCommand      = new RelayCommand(DeleteCommand);
            CancelButtonCommand      = new RelayCommand(CancelCommand);
            SaveButtonCommand        = new RelayCommand(SaveCommand);
            SaveNotesButtonCommand   = new RelayCommand(SaveNotesCommand);
            NavigateToUrlCommand     = new RelayCommand(NavigateToUrl);
            NavigateToJobsUrlCommand = new RelayCommand(NavigateToJobsUrl);
        }
Ejemplo n.º 2
0
        // Constructor
        public CountryViewModel(IDataService dataService)
        {
            // Get reference to dataService
            _dataService = dataService;

            // Fill country collections
            _activeCountryCollection   = new ObservableCollection <CountryViewModelItem>();
            _inactiveCountryCollection = new ObservableCollection <CountryViewModelItem>();
            _dataService.ActiveCountryList(FillCountryCollections);
            _dataService.CountryModified += (sender, e) => _dataService.ActiveCountryList(FillCountryCollections);

            // Default control states.
            _manageCountryVisibility = Visibility.Collapsed;
            _useCountryVisibility    = Visibility.Visible;

            // Commands
            ManageCountryButtonCommand = new RelayCommand(ManageCountryCommand);
            AddCountryButtonCommand    = new RelayCommand(AddCountryCommand);
            RemoveCountryButtonCommand = new RelayCommand(RemoveCountryCommand);
            DoneButtonCommand          = new RelayCommand(DoneCountryCommand);
            SaveNotesButtonCommand     = new RelayCommand(SaveNotesCommand);
        }
Ejemplo n.º 3
0
        private bool _editFlag;     //True -> edit, False -> add.

        // Constructor
        public ApplicationViewModel(IDataService dataService)
        {
            // Initialize edit flag
            _editFlag = false;

            // Get reference to dataService
            _dataService = dataService;

            // Get country collection
            _countryCollection = new ObservableCollection <CountryViewModelItem>();
            _dataService.ActiveCountryList(FillCountryCollection);
            _dataService.CountryModified += (sender, e) => _dataService.ActiveCountryList(FillCountryCollection);

            // Get application collection
            _applicationCollection = new ObservableCollection <ApplicationOrganizationVMItem>();
            _dataService.ApplicationList(FillApplicationCollection);
            _dataService.ApplicationModified += (sender, e) => _dataService.ApplicationList(FillApplicationCollection);

            // Get organization collection
            _organizationCollection = new ObservableCollection <OrganizationViewModelItem>();
            _dataService.OrganizationList(FillOrganizationCollection);
            _dataService.OrganizationModified += (sender, e) => _dataService.OrganizationList(FillOrganizationCollection);

            // Get next action collection
            _nextActionCollection = new ObservableCollection <SimpleItem>();
            _dataService.NextActionList(FillNextActionCollection);
            _dataService.NextActionModified += (sender, e) => _dataService.NextActionList(FillNextActionCollection);

            // Get job type collection
            _jobTypeCollection = new ObservableCollection <SimpleItem>();
            _dataService.JobTypeList(FillJobTypeCollection);
            _dataService.JobTypeModified += (sender, e) => _dataService.JobTypeList(FillJobTypeCollection);

            // Get status collection and subscribe to data modified events.
            _statusCollection = new ObservableCollection <SimpleItem>();
            _dataService.StatusList(FillStatusCollection);
            _dataService.StatusModified += (sender, e) => _dataService.StatusList(FillStatusCollection);

            //Visibility defaults
            if (ViewModelBase.IsInDesignModeStatic)
            {
                _lstVisibility  = Visibility.Visible;
                _editVisibility = Visibility.Collapsed;
                //_lstVisibility = Visibility.Collapsed;
                //_editVisibility = Visibility.Visible;
            }
            else
            {
                _lstVisibility  = Visibility.Visible;
                _editVisibility = Visibility.Collapsed;
            }

            // Commands
            AddButtonCommand        = new RelayCommand(AddCommand);
            EditButtonCommand       = new RelayCommand(EditCommand);
            DeleteButtonCommand     = new RelayCommand(DeleteCommand);
            OkButtonCommand         = new RelayCommand(OkCommand);
            CancelButtonCommand     = new RelayCommand(CancelCommand);
            SaveNotesButtonCommand  = new RelayCommand(SaveNotesCommand);
            NavigateToJobUrlCommand = new RelayCommand(NavigateToJobUrl);
        }