public HistoryFeedViewModel(IUserSession userSession, ISyncService syncService, ITimeEntryRepository timeEntryRepository, ITimeEntryTypeRepository timeEntryTypeRepository, IUserWlanSettingsService userWlanSettingsService, IAppSettings appSettings) { _userSession = userSession; _syncService = syncService; _timeEntryRepository = timeEntryRepository; _timeEntryTypeRepository = timeEntryTypeRepository; _userWlanSettingsService = userWlanSettingsService; _appSettings = appSettings; TimeEntries = new ObservableCollection <HistoryFeedRowViewModel>(); ApplicationCommands.SyncCompleted.RegisterCommand(new DelegateCommand <object>(SyncComplete)); ApplicationCommands.SyncProgressChanged.RegisterCommand(new DelegateCommand <Tuple <int, string> >(SyncProgressChanged)); ApplicationCommands.SyncStarted.RegisterCommand(new DelegateCommand <object>(SyncStarted)); TaskCommands.SaveTaskCompleted.RegisterCommand(new DelegateCommand <object>(TaskSaved)); SyncInProgress = _syncService.SyncInProgress; ApplicationCommands.SyncFailed.RegisterCommand(new DelegateCommand <string>(SyncFailedCommand)); CloseErrorMessageCommand = new DelegateCommand <object>(ExecuteCloseErrorMessage); CancelChanges = new DelegateCommand <object>(CancelChangesExecute); TimeEntryTypes = _timeEntryTypeRepository.GetGlobal(); ApplicationCommands.PremiseSettingChanged.RegisterCommand(new DelegateCommand <object>(SetDefaultType)); }
public ReportScreenMasterViewModel(ITimeEntryService timeEntryService, IBusyService busyService, IConnectivityService connectivityService, ITimeEntryTypeRepository timeEntryTypeRepository, ITimeEntryRepository timeEntryRepository, IAppSettings appSettings) { _timeEntryService = timeEntryService; _busyService = busyService; _connectivityService = connectivityService; _timeEntryTypeRepository = timeEntryTypeRepository; _timeEntryRepository = timeEntryRepository; _appSettings = appSettings; Search = new DelegateCommand <object>(ExecuteSearch); _busyService.ShowBusy(_reportscreenKey); LoadPredefinedSearchItems(); SelectedPredefinedSearch = PredefinedSearchItems[1]; EditTimeEntryCommand = new DelegateCommand <object>(EditTimeEntry); SaveCommand = new DelegateCommand <object>(SaveCommandExecute); try { TimeEntryTypes = _timeEntryTypeRepository.GetGlobal(); } catch (Exception ex) { Logger.Error(ex); } TaskCommands.SaveTaskCompleted.RegisterCommand(new DelegateCommand(Reload)); TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand(Reload)); ApplicationCommands.ConnectivityChanged.RegisterCommand(new DelegateCommand <object>(ConnectivityChangedExecute)); }
public WeeklyOverviewViewmodel(ITimeEntryService timeEntryService, IBusyService busyService, ITimeEntryRepository timeEntryRepository, ITaskItemViewmodelFactory taskItemViewmodelFactory, ITimeEntryTypeRepository timeEntryTypeRepository, ISyncService syncService, ICommonDialogs commonDialogs) { _timeEntryService = timeEntryService; //_busyService = busyService; _timeEntryRepository = timeEntryRepository; _taskItemViewmodelFactory = taskItemViewmodelFactory; _timeEntryTypeRepository = timeEntryTypeRepository; _syncService = syncService; _commonDialogs = commonDialogs; _syncCompletedCommand = new DelegateCommand <object>(SyncCompletedExecute); PreviousDateCommand = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(-7)); NextDayCommand = new DelegateCommand <object>(a => StartDate = StartDate.AddDays(7)); TodayCommand = new DelegateCommand <object>(a => TodayCommandExecute()); SwitchToDayViewCommand = new DelegateCommand <object>(SwitchToDayViewCommandExecute); CopyPreviousTasksToSelectedDate = new DelegateCommand <object>(CopyPreviousTasksToSelectedDateExecute); AddTaskCommand = new DelegateCommand <object>(AddTaskCommandExecute); SaveCommand = new DelegateCommand <object>(SaveCommandExecute); DeleteTimeEntry = new DelegateCommand <object>(DeleteTimeEntryExecute); ApplicationCommands.SyncCompleted.RegisterCommand(_syncCompletedCommand); TaskCommands.TaskSelectCompleted.RegisterCommand(new DelegateCommand <Task>(TaskSelectCompleted)); TaskCommands.SaveTaskCancelled.RegisterCommand(new DelegateCommand <TimeEntry>(TaskSelectCompleted)); Rows = new ObservableItemCollection <TaskItemViewmodel>(); Rows.ItemChanged += TasksOnItemChanged; _deletedRows = new List <TaskItemViewmodel>(); _timeEntriesForThisWeek = new List <TimeEntry>(); TimeEntryTypes = _timeEntryTypeRepository.GetGlobal(); StartDate = DateTime.Today.FirstDayOfWeek(); }
private void SyncComplete(object obj) { SyncInProgress = false; if (_userSession.UserStatistics != null && _userSession.UserStatistics.LastXDaysTimeEntries != null) { TaskSaved(obj); Update(); } TimeEntryTypes = _timeEntryTypeRepository.GetGlobal(); }
private void LoadTimeEntryTypes() { List <TimeEntryType> timeEntryTypes; if (_timeEntry.Task == null) { TimeEntryTypes = null; timeEntryTypes = _timeEntryTypeRepository.GetGlobal(); } else { var selectedCompany = _timeEntry.Task.Project.Company; timeEntryTypes = _timeEntryTypeRepository.GetByCompany(selectedCompany); } TimeEntryTypes = new ObservableCollection <TimeEntryType>(timeEntryTypes); SetSelectedTimeEntryType(); }