public MainWindow(IGraphService graphService,
                          IWorkingHoursService workingHoursService,
                          MediatR.IMediator mediator,
                          IOptionsMonitor <BaseConfig> optionsAccessor,
                          LIFXOAuthHelper lifxOAuthHelper,
                          DiagnosticsClient diagClient,
                          ILogger <MainWindow> logger,
                          ISettingsService settingsService)
        {
            _logger = logger;
            InitializeComponent();
            System.Windows.Application.Current.SessionEnding += new SessionEndingCancelEventHandler(Current_SessionEnding);

            LoadAboutMe();

            _workingHoursService = workingHoursService;
            _graphservice        = graphService;


            logs.LogFilePath = App.StaticConfig["Serilog:WriteTo:1:Args:Path"];

            _mediator        = mediator;
            _options         = optionsAccessor != null ? optionsAccessor.CurrentValue : throw new NullReferenceException("Options Accessor is null");
            _lIFXOAuthHelper = lifxOAuthHelper;
            _diagClient      = diagClient;
            _settingsService = settingsService;

            LoadSettings().ContinueWith(
                t =>
            {
                if (t.IsFaulted)
                {
                }

                this.Dispatcher.Invoke(() =>
                {
                    LoadApp();

                    var tbContext = landingPage.notificationIcon.DataContext;
                    DataContext   = Config;
                    landingPage.notificationIcon.DataContext = tbContext;

                    if (Config.StartMinimized)
                    {
                        this.Hide();
                    }
                });
            }, TaskScheduler.Current);
        }
 public Worker(ILogger <Worker> logger,
               IOptionsMonitor <BaseConfig> optionsAccessor,
               AppState appState,
               UserAuthService userAuthService,
               MediatR.IMediator mediator,
               IWorkingHoursService workingHoursService)
 {
     _workingHoursService = workingHoursService;
     _mediator            = mediator;
     _userAuthService     = userAuthService;
     _logger          = logger;
     _appState        = appState;
     _appState.Config = optionsAccessor.CurrentValue;
     _graphClient     = new GraphServiceClient(userAuthService);
 }
Exemple #3
0
 public WorkingHoursController(IWorkingHoursService workinghoursService)
 {
     _workinghoursService = workinghoursService;
 }
Exemple #4
0
        public MainWindow(IGraphService graphService,
                          IWorkingHoursService workingHoursService,
                          MediatR.IMediator mediator,
                          IOptionsMonitor <BaseConfig> optionsAccessor,
                          LIFXOAuthHelper lifxOAuthHelper,
                          DiagnosticsClient diagClient,
                          ILogger <MainWindow> logger,
                          ISettingsService settingsService,
                          AppState appState)
        {
            var currentApp = (App)System.Windows.Application.Current;

            Resources.Add("services", currentApp.ServiceProvider);

            _appState = appState;

            _logger = logger;
            InitializeComponent();
            System.Windows.Application.Current.SessionEnding += new SessionEndingCancelEventHandler(Current_SessionEnding);

            _workingHoursService = workingHoursService;
            _graphservice        = graphService;


            _mediator        = mediator;
            _options         = optionsAccessor != null ? optionsAccessor.CurrentValue : throw new NullReferenceException("Options Accessor is null");
            _lIFXOAuthHelper = lifxOAuthHelper;
            _diagClient      = diagClient;
            _settingsService = settingsService;

            LoadSettings().ContinueWith(
                async t =>
            {
                if (t.IsFaulted)
                {
                }

                await Task.Run(() =>
                {
                    this.Dispatcher.Invoke(() =>
                    {
                        appState.SignedIn = false;
                        LoadApp();

                        var tbContext = notificationIcon.DataContext;
                        DataContext   = _appState.Config;
                        notificationIcon.DataContext = tbContext;

                        if (_appState.Config.StartMinimized)
                        {
                            this.Hide();
                        }
                    });

                    while (true)
                    {
                        if (_appState.SignInRequested)
                        {
                            _appState.SignInRequested = false;

                            this.Dispatcher.Invoke(() =>
                            {
                                SignIn();
                            });
                        }

                        if (_appState.SignOutRequested)
                        {
                            _appState.SignOutRequested = false;
                            this.Dispatcher.Invoke(() =>
                            {
                                SignOut();
                            });
                        }
                    }
                });
            }, TaskScheduler.Current);
        }
Exemple #5
0
 public WorkingHoursController(IWorkingHoursService workingHoursService, IProjectService projectService)
 {
     _workingHoursService = workingHoursService;
     _projectService      = projectService;
 }
 public UseWorkingHoursHandler(IWorkingHoursService service)
 {
     _service = service;
 }