Ejemplo n.º 1
0
        internal EnumerationViewModel(DatabaseConfiguration databaseConfiguration, ProjectItem project, EnumerationType enumerationType, IDialogService dialogService, ILogService logService)
        {
            if (databaseConfiguration == null)
            {
                throw new ArgumentNullException(nameof(databaseConfiguration));
            }

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }

            this._Project         = project;
            this._EnumerationType = enumerationType;
            this._DialogService   = dialogService;

            this._DatabaseConnectorService = new MySqlConnectorService(databaseConfiguration, logService);

            this.RefreshCommand = new RelayCommand(this.RefreshExecute, this.CanRefreshExecute);
            this.UpdateCommand  = new RelayCommand(this.UpdateExecute, this.CanUpdateExecute);

            this.Items.CollectionChanged += this.ItemsOnCollectionChanged <EnumerationItem>;
        }
Ejemplo n.º 2
0
        public Setting(IBitnamiRedmineService bitnamiRedmineService, IRedmineDatabaseConfigurationService databaseConfigurationService, ITaskService taskService, IDialogService dialogService, ILogService logService, BitnamiRedmineStack stack)
        {
            if (bitnamiRedmineService == null)
            {
                throw new ArgumentNullException(nameof(bitnamiRedmineService));
            }

            if (databaseConfigurationService == null)
            {
                throw new ArgumentNullException(nameof(databaseConfigurationService));
            }

            if (taskService == null)
            {
                throw new ArgumentNullException(nameof(taskService));
            }

            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }

            if (logService == null)
            {
                throw new ArgumentNullException(nameof(logService));
            }

            if (stack == null)
            {
                throw new ArgumentNullException(nameof(stack));
            }

            this._Stack         = stack;
            this._DialogService = dialogService;
            this._LogService    = logService;

            var configuration = new ServiceConfiguration
            {
                Apache     = true,
                MySql      = true,
                Redmine    = true,
                Subversion = true
            };

            var serviceStatuses = bitnamiRedmineService.GetServiceDisplayNames(stack, configuration);

            this._ServiceStatuses = new ObservableCollection <ServiceStatus>(serviceStatuses);

            this._DatabaseConfiguration    = databaseConfigurationService.GetDatabaseConfiguration(stack).FirstOrDefault();
            this._DatabaseConnectorService = new MySqlConnectorService(this._DatabaseConfiguration, logService);

            var projects = this._DatabaseConnectorService.GetProjects().ToList();

            projects.Insert(0, new ProjectItem(new ProjectObject {
                Id = 0, Name = "[‘S‘Ì]"
            }));
            this._Projects = new ObservableCollection <ProjectItem>(projects);

            this._SelectedProject         = this._Projects.First();
            this._SelectedEnumerationType = EnumerationTypes.First();

            this.UpdateSelectedEnumeration();
            this.SelectedTaskScheduler = new TaskSchedulerViewModel(stack, taskService, dialogService);
        }