partial void OnPluginGeneratorGuidChanged() { if (!this.IsNotifying) { return; } if (string.IsNullOrWhiteSpace(this.PluginGeneratorGuid)) { return; } var nv = new ModelVisitorNodeGenSettings(); this.RestoreSettings(); nv.NodeGenSettingsApplyAction(cfg, (p) => { p.AddNodeAppGenSettings(this.Guid); }); this.DescriptionGenerator = _PluginGenerator.Description; if (this.PluginDbGenerator != null) { this._GenFileName = "app-settings.json"; this._RelativePathToGenFolder = string.Empty; } else { this._GenFileName = prevGenFileName; this._RelativePathToGenFolder = prevRelativePathToGenFolder; } HideProperties(); this.NotifyPropertyChanged(() => this.IconName); this.NotifyPropertyChanged(() => this.DynamicModelNodeSettings); this.NotifyPropertyChanged(() => this.DynamicGeneratorSettings); this.NotifyPropertyChanged(() => this.DynamicMainConnStrSettings); }
partial void OnPluginGeneratorGuidChanging(ref string to) { if (!this.IsNotifying) { return; } if (cfg._DicActiveAppProjectGenerators.ContainsKey(this.Guid)) { cfg._DicActiveAppProjectGenerators.Remove(this.Guid); } var nv = new ModelVisitorNodeGenSettings(); nv.NodeGenSettingsApplyAction(cfg, (p) => { p.RemoveNodeAppGenSettings(this.Guid); }); this.GeneratorSettings = string.Empty; this.DescriptionGenerator = string.Empty; //this.DicGenNodeSettings.TryRemove(this.Guid); this._PluginGenerator = null; cfg.Model._DicGenNodeSettings.TryRemove(this.Guid); this.DynamicGeneratorSettings = null; this.DynamicMainConnStrSettings = null; this.DynamicModelNodeSettings = null; }
partial void OnPluginGuidChanged() { if (!this.IsNotifying) { return; } this.PluginGeneratorGuid = string.Empty; this.GenFileName = string.Empty; UpdateListGenerators(); if (cfg.IsInitialized) { var nv = new ModelVisitorNodeGenSettings(); nv.NodeGenSettingsApplyAction(this.GetConfig(), (p) => { p.RemoveNodeAppGenSettings(this.Guid); }); } //this.NotifyPropertyChanged(() => this.DynamicNodesSettings); if (!string.IsNullOrWhiteSpace(this.GenFileName)) { prevGenFileName = this.GenFileName; } this.GenFileName = string.Empty; if (!string.IsNullOrWhiteSpace(this.RelativePathToGenFolder)) { prevRelativePathToGenFolder = this.RelativePathToGenFolder; } this.RelativePathToGenFolder = string.Empty; // adding new plugins group settings var sln = (AppSolution)this.Parent.Parent; if (!string.IsNullOrWhiteSpace(this.PluginGuid)) { this.plugin = cfg.DicPlugins[this.PluginGuid]; this.Name = this.plugin.Name; var groupSettings = this.plugin.GetPluginGroupSolutionSettingsVmFromJson(null); if (groupSettings != null) { this.PluginGroupSettingsGuid = groupSettings.Guid; if (!sln.DicPluginsGroupSettings.ContainsKey(groupSettings.Guid)) { sln.DicPluginsGroupSettings[groupSettings.Guid] = groupSettings; } } } HideProperties(); sln.DynamicPluginGroupSettings = null; this.DynamicGeneratorSettings = null; this.DynamicMainConnStrSettings = null; this.DynamicModelNodeSettings = null; // auto selection generator if it is only one if (this.ListGenerators.Count == 1) { this.PluginGeneratorGuid = this.ListGenerators[0].Guid; } }
public Config GetDiffAnnotatedConfig(Config curr, IConfig prev, IConfig old) { VmBindable.IsValidateAll = false; curr.PluginSettingsToModel(); var proto = Config.ConvertToProto(curr); this.DiffAnnotatedConfig = new Config(proto); ModelVisitorForAnnotation.InitConfig(this.DiffAnnotatedConfig); int dicNodesCount = this.DiffAnnotatedConfig.DicNodes.Count; var nv = new ModelVisitorNodeGenSettings(); nv.NodeGenSettingsApplyAction(this.DiffAnnotatedConfig, (p) => { p.RestoreNodeAppGenSettingsVm(); }); VmBindable.IsValidateAll = true; //foreach (var t in curr.DicActiveAppProjectGenerators) //{ // this.DiffAnnotatedConfig.DicActiveAppProjectGenerators[t.Key] = t.Value; //} //foreach (var t in curr.DicGenNodeSettings) //{ // this.DiffAnnotatedConfig.DicGenNodeSettings[t.Key] = t.Value; //} //foreach (var t in curr.DicNodes) //{ // this.DiffAnnotatedConfig.DicNodes[t.Key] = t.Value; //} //this.DiffAnnotatedConfig.DicGenerators = curr.DicGenerators; //this.DiffAnnotatedConfig.DicPluginLists = curr.DicPluginLists; //this.DiffAnnotatedConfig.DicPlugins = curr.DicPlugins; //this.DiffAnnotatedConfig.AddAllAppGenSettingsVmsToNode(); this.ListGuidsRenamedObjects = new List <string>(); base.RunThroughConfig(this.DiffAnnotatedConfig, prev, old, (visitor, obj) => { if (obj is IGuid) { IGuid curr2 = (IGuid)obj; if (obj.IsRenamed()) { ListGuidsRenamedObjects.Add(curr2.Guid); } } }); Debug.Assert(dicNodesCount <= this.DiffAnnotatedConfig.DicNodes.Count); foreach (var t in curr.Model.DicGenNodeSettings) { this.DiffAnnotatedConfig.Model.DicGenNodeSettings[t.Key] = t.Value; } return(this.DiffAnnotatedConfig); }
public void PluginSettingsToModel() { foreach (var t in this.GroupAppSolutions.ListAppSolutions) { t.SaveGroupSettings(); foreach (var tt in t.ListAppProjects) { foreach (var ttt in tt.ListAppProjectGenerators) { ttt.SaveSettings(); } } } // Save Node Settings VM for all nodes, which are supporting INodeGenSettings var nv = new ModelVisitorNodeGenSettings(); nv.NodeGenSettingsApplyAction(this, (p) => { p.SaveNodeAppGenSettings(); }); //foreach (var t in this._Config.GroupPlugins.ListPlugins) //{ // foreach (var tt in t.ListGenerators) // { // foreach (var ttt in tt.ListSettings) // { // Utils.TryCall( // () => // { // ttt.GeneratorSettings = ttt.VM.SettingsAsJson; // }, "Can't get PROTO settings from Plugin: '" + t.Name + "' Generator: '" + tt.Name + "' Settings: '" + ttt.Name + "'"); // if (ttt.IsPrivate) // { // Utils.TryCall( // () => // { // File.WriteAllText(ttt.FilePath, ttt.GeneratorSettings); // }, "Private connection settins was not saved. Plugin: '" + t.Name + "' Generator: '" + tt.Name + "' Settings: '" + ttt.Name + "' File path: '" + ttt.FilePath + "'"); // ttt.GeneratorSettings = string.Empty; // } // } // } //} }