public SaveTaskDialogViewModel(TimeEntry timeEntry, ITimeEntryTypeRepository timeEntryTypeRepository, ITimeEntryRepository timeEntryRepository, ITaskSearchService taskSearchService, IUserSession userSession, IAppSettings appSettings, IUserWlanSettingsService userWlanSettingsService, bool isEditing, ITaskRepository taskRepository) { _timeEntry = timeEntry; _timeEntryTypeRepository = timeEntryTypeRepository; _timeEntryRepository = timeEntryRepository; _appSettings = appSettings; _userWlanSettingsService = userWlanSettingsService; _isEditing = isEditing; SaveTask = new DelegateCommand <object>(ExecuteSaveTask, CanSaveTask); executeSelectTaskCommand = new DelegateCommand <Task>(ExecuteSelectTask); taskStoppedCommand = new DelegateCommand <object>(TaskStopped); CloseCommand = new DelegateCommand <object>(ExecuteClose); TaskCommands.TaskIdle.RegisterCommand(taskStoppedCommand); TaskCommands.TaskSelectCompleted.RegisterCommand(executeSelectTaskCommand); SelectTaskViewModel = new SelectTaskViewModel(taskSearchService, userSession, appSettings, taskRepository); LoadTimeEntryTypes(); _isInSelectionMode = _timeEntry.Task == null; MinSelectedDate = appSettings.MinTimeEntryDate; }
private void SelectTaskStart(object obj) { var taskSearchService = _unityContainer.Resolve <ITaskSearchService>(); var userSession = _unityContainer.Resolve <IUserSession>(); var dialog = new SelectTaskBox.SelectTaskBox(); ITaskRepository taskRepository = _unityContainer.Resolve <ITaskRepository>(); var viewModel = new SelectTaskViewModel(taskSearchService, userSession, _appSettings, taskRepository); dialog.ApplyViewModel(viewModel); OpenDialog(dialog, SaveTaskRegionName); _screenIsOpen = true; }