Ejemplo n.º 1
0
        private void ChangeUserConfig(int selectedIndex_new)
        {
            bool ensureLoad = true;

            if (G.Module.IsDirty)
            {
                ensureLoad = G.Module.DisplayDialog("更改未保存,是否要放弃更改?", "放弃保存", "返回");
            }
            if (ensureLoad)
            {
                try
                {
                    var    newUserConfig = new Configs.UserConfig();
                    string newConfigName = userConfigNames[selectedIndex_new] + ".json";
                    newUserConfig.JsonPath = Path.Combine(G.Module.ModuleConfig.UserConfigsFolderPath, newConfigName);
                    newUserConfig.Load();
                    newUserConfig.InitImporterGroups();
                    newUserConfig.PullAll();
                    //至此加载成功
                    G.Module.ModuleStateConfig.Json.CurrentUserConfigName = newConfigName;
                    G.Module.UserConfig     = newUserConfig;
                    selectedUserConfigIndex = selectedIndex_new;
                    G.g.OnChangeCurrentUserConfig();
                }
                catch (Exception e)
                {
                    G.Module.DisplayDialog("切换配置时发生错误:" + e.Message);
                }
            }
        }
Ejemplo n.º 2
0
 private void App_UserConfigChanged(object sender, Configs.UserConfig e)
 => this.ShowStatusMessage(e != null ? "read user config successd" : "read user config failed");
Ejemplo n.º 3
0
 private static void App_UserConfigChanged(object sender, Configs.UserConfig e) => Remap();