コード例 #1
0
        public TimeTrackerService()
        {
            try
            {
                InitializeComponent();

                eventLog = new EventLog
                {
                    Source = ServiceName,
                    Log    = "Application"
                };

                systemActivityService = new SystemActivityService();
                windowActivityService = new WindowActivityService();

                dbContext = new TimeTrackerDbContext();
                dbContext.Database.EnsureCreated();

                userSystemEventRepository = new UserSystemEventRepository(dbContext);
                userWindowEventRepository = new UserWindowEventRepository(dbContext);
                windowsAppRepository      = new WindowsAppRepository(dbContext);
            }
            catch (Exception ex)
            {
                Log(ex.ToString());
            }
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: d2cTool/FLS_TimeTracker
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            MainWindow          = new MainWindow(userSystemEventRepository, userWindowEventRepository, windowsAppRepository);
            MainWindow.Closing += MainWindow_Closing;

            _notifyIcon              = new SWF.NotifyIcon();
            _notifyIcon.DoubleClick += (s, args) => ShowMainWindow();
            _notifyIcon.Icon         = BackgroundApp.Properties.Resources.time;
            _notifyIcon.Visible      = true;

            systemActivityService = new SystemActivityService();
            windowActivityService = new WindowActivityService();

            dbContext = new TimeTrackerDbContext();
            dbContext.Database.EnsureCreated();

            userSystemEventRepository = new UserSystemEventRepository(dbContext);
            userWindowEventRepository = new UserWindowEventRepository(dbContext);
            windowsAppRepository      = new WindowsAppRepository(dbContext);

            systemActivityService.SystemActivitySnapshot += SystemActivityService_SystemActivitySnapshot;
            windowActivityService.WindowActivitySnapshot += WindowActivityService_WindowActivitySnapshot;

            systemActivityService.Start();
            windowActivityService.Start();

            CreateContextMenu();
        }
コード例 #3
0
        static void Main(string[] args)
        {
            SystemActivityService systemActivityService = new SystemActivityService();
            WindowActivityService windowActivityService = new WindowActivityService();

            dbContext = new TimeTrackerDbContext();
            dbContext.Database.EnsureCreated();

            userSystemEventRepository = new UserSystemEventRepository(dbContext);
            userWindowEventRepository = new UserWindowEventRepository(dbContext);
            windowsAppRepository      = new WindowsAppRepository(dbContext);

            systemActivityService.SystemActivitySnapshot += SystemActivityService_SystemActivitySnapshot;
            windowActivityService.WindowActivitySnapshot += WindowActivityService_WindowActivitySnapshot;

            systemActivityService.Start();
            windowActivityService.Start();

            while (true)
            {
                Thread.Sleep(10);
            }
        }