跳到主要内容

github/tai

公开

Tai · Windows 软件与网站使用时长统计。上游 Planshit/Tai 的源码镜像,非灵栈原创;MIT 许可。来源:https://github.com/Planshit/Tai 。本次为手动同步,暂不提供安装包。

浏览文件

MainServicer.cs

59 行 · 2.0 KB历史下载
1using Core.Servicers.Interfaces;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace UI.Servicers
9{
10 public class MainServicer : IMainServicer
11 {
12 private readonly IMain main;
13 private readonly IThemeServicer themeServicer;
14 private readonly IInputServicer inputServicer;
15 private readonly IAppContextMenuServicer appContextMenuServicer;
16 private readonly IWebSiteContextMenuServicer _webSiteContext;
17 private readonly IStatusBarIconServicer _statusBarIconServicer;
18 private readonly IAppConfig _config;
19 private bool isSelfStart = false;
20 public MainServicer(
21 IMain main,
22 IThemeServicer themeServicer,
23 IInputServicer inputServicer,
24 IAppContextMenuServicer appContextMenuServicer,
25 IWebSiteContextMenuServicer webSiteContext_,
26 IStatusBarIconServicer statusBarIconServicer_,
27 IAppConfig config_)
28 {
29 this.main = main;
30 this.themeServicer = themeServicer;
31 this.inputServicer = inputServicer;
32 this.appContextMenuServicer = appContextMenuServicer;
33 _webSiteContext = webSiteContext_;
34 _statusBarIconServicer = statusBarIconServicer_;
35 _config = config_;
36 }
37 public void Start(bool isSelfStart)
38 {
39 this.isSelfStart = isSelfStart;
40 _statusBarIconServicer.Init();
41
42 main.OnStarted += Main_OnStarted;
43 main.Run();
44 }
45
46 private void Main_OnStarted(object sender, EventArgs e)
47 {
48 themeServicer.Init();
49 inputServicer.Start();
50 appContextMenuServicer.Init();
51 _webSiteContext.Init();
52
53 if (!isSelfStart && _config.GetConfig().General.IsStartupShowMainWindow)
54 {
55 _statusBarIconServicer.ShowMainWindow();
56 }
57 }
58 }
59}