예제 #1
0
 public LoginViewModel(IAuthenticationDataService authDataService,
                       IEventAggregator eventAggregator)
 {
     _eventAggregator = eventAggregator;
     _authDataService = authDataService;
     LoginCommand     = new RelayCommand <object>(async(parameter) => await LoginAsync(parameter), (parameter) => CanLogin());
 }
예제 #2
0
 public MainWindowViewModel(IEventAggregator eventAggregator)
 {
     _customerDataService    = new CustomerDataService(() => new PlannerDbContext());
     _appointmentDataService = new AppointmentDataService(() => new PlannerDbContext());
     _authDataService        = new AuthenticationDataService(() => new PlannerDbContext());
     _eventAggregator        = eventAggregator;
     CurrentPage             = new LoginPage(new LoginViewModel(_authDataService, _eventAggregator));
     _eventAggregator.GetEvent <UserAuthenticationEvent>().Subscribe(OnUserAuthenticated);
 }
예제 #3
0
        public MainPageViewModel(ICustomerDataService customerDataService,
                                 IAppointmentDataService appointmentDataService,
                                 IAuthenticationDataService authDataService, User user)
        {
            _customerDataService    = customerDataService;
            _appointmentDataService = appointmentDataService;
            _authDataService        = authDataService;
            _user                 = user;
            _customers            = new ObservableCollection <CustomerWrapper>();
            _allAppointments      = new ObservableCollection <AppointmentWrapper>();
            _customerAppointments = new ObservableCollection <AppointmentWrapper>();
            _users                = new ObservableCollection <User>();
            _eventAggregator      = new EventAggregator();
            _customerListVM       = new CustomersListViewModel(_eventAggregator, _customers);
            _appointmentListVM    = new AppointmentsListViewModel(_eventAggregator, _customers, _customerAppointments);

            //Initializing all events
            InitializeEvents();

            //creates controls for the main page
            Controls = new Dictionary <ApplicationControls, UserControl>
            {
                [ApplicationControls.CustomersList]    = new CustomersListControl(_customerListVM),
                [ApplicationControls.AppointmentsList] = new AppointmentsListControl(_appointmentListVM),
                [ApplicationControls.Calendar]         = new CalendarControl(new CalendarViewModel(_eventAggregator, _allAppointments)),
                [ApplicationControls.Report]           = new ReportControl(
                    new ReportViewModel(_eventAggregator, _customers, _allAppointments, _users))
            };

            //setting up onLoad control
            CurrentContent = Controls[ApplicationControls.CustomersList];

            //initializing Commands
            CustomersCommand    = new RelayCommand(OnCustomersControlLoad);
            AppointmentsCommand = new RelayCommand(OnAppointmentsControlLoad);
            CalendarCommand     = new RelayCommand(OnCalendarControlLoad);
            ReportCommand       = new RelayCommand(OnReportControlLoad);
            InitCusAppList();
        }
 /// <summary>
 /// Конструктор контроллера для работы с аутентификацией и учетными записями пользователей.
 /// </summary>
 /// <param name="authenticationDataService">Сервис аутентификации и работы с учетными записями пользователей.</param>
 /// <param name="tokensStorage">Хранилище токенов для обновления токенов.</param>
 public AuthenticationController(IAuthenticationDataService authenticationDataService, ITokensStorage tokensStorage)
 {
     this.AuthenticationDataService = authenticationDataService;
     this.TokensStorage             = tokensStorage;
 }
 /// <summary>
 /// Конструктор контроллера для работы с аутентификацией и учетными записями пользователей.
 /// </summary>
 /// <param name="authenticationDataService">Сервис аутентификации и работы с учетными записями пользователей.</param>
 public AuthenticationController(IAuthenticationDataService authenticationDataService)
 {
     this.AuthenticationDataService = authenticationDataService;
 }