/// <summary> /// 取消自启动 /// </summary> internal static void DelAutoStart() { AtState.DelAutoStart(); Kit.Msg("已取消自启动设置!"); }
/// <summary> /// 加载Windows模式桌面 /// </summary> static void LoadDesktop() { Desktop desktop = new Desktop(); // 主页 if (_homePageType != null) { Win win = Activator.CreateInstance(_homePageType) as Win; if (win != null) { if (string.IsNullOrEmpty(win.Title)) { win.Title = "主页"; } win.Icon = Icons.主页; desktop.HomeWin = win; } } // 自启动 AutoStartInfo autoStart; if (!string.IsNullOrEmpty(_launchArgs)) { // 带启动参数的自启动 LaunchFreely(_launchArgs); _launchArgs = null; } else if ((autoStart = AtState.GetAutoStart()) != null) { // 用户设置的自启动 bool suc = false; Type type = Type.GetType(autoStart.WinType); if (type != null) { try { Win win = null; if (string.IsNullOrEmpty(autoStart.Params)) { win = (Win)Activator.CreateInstance(type); } else { var par = JsonSerializer.Deserialize(autoStart.Params, Type.GetType(autoStart.ParamsType)); win = (Win)Activator.CreateInstance(type, par); } if (win != null) { win.Title = string.IsNullOrEmpty(autoStart.Title) ? "自启动" : autoStart.Title; Icons icon; if (Enum.TryParse(autoStart.Icon, out icon)) { win.Icon = icon; } desktop.ShowNewWin(win); suc = true; } } catch { } } if (!suc) { AtState.DelAutoStart(); } } if (desktop.MainWin == null) { desktop.MainWin = desktop.HomeWin; } SysVisual.RootContent = desktop; }