public object Run(AppSolution node) { TypeBuilder tbSettings = SettingsTypeBuilder.GetTypeBuilder(); // type builder for solutions ConstructorBuilder constructor = tbSettings.DefineDefaultConstructor(MethodAttributes.Public | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName); Config cfg = (Config)node.GetConfig(); var dic_groups = new Dictionary <string, object>(); foreach (var t in node.DicPluginsGroupSettings) { string groupName = t.Value.Name; SettingsTypeBuilder.CreateProperty(tbSettings, t.Value.Name, typeof(Object), t.Value.Name, t.Value.Description); dic_groups[groupName] = t.Value; } if (dic_groups.Count == 0) { return(null); } Type settingsType = tbSettings.CreateType(); object objSettings = Activator.CreateInstance(settingsType); foreach (var dt in dic_groups) { settingsType.InvokeMember(dt.Key, BindingFlags.SetProperty, null, objSettings, new object[] { dt.Value }); } return(objSettings); }
public override ITreeConfigNode NodeAddNew() { var node = new AppSolution(this.Parent); (this.Parent as GroupListAppSolutions).Add(node); this.GetUniqueName(AppSolution.DefaultName, node, (this.Parent as GroupListAppSolutions).ListAppSolutions); this.SetSelected(node); return(node); }
//public override void NodeRemove(bool ask = true) //{ // if (ask) // { // var res = MessageBox.Show("You are deleting generators for Solution. Continue?", "Warning", System.Windows.MessageBoxButton.OKCancel); // if (res != System.Windows.MessageBoxResult.OK) // return; // } // foreach (var t in this.ListAppProjects) // { // t.NodeRemove(false); // } // (this.Parent as GroupListAppSolutions).ListAppSolutions.Remove(this); // this.Parent = null; //} public override ITreeConfigNode NodeAddClone() { var node = AppSolution.Clone(this.Parent, this, true, true); node.Parent = this.Parent; (this.Parent as GroupListAppSolutions).Add(node); this._Name = this._Name + "2"; this.SetSelected(node); return(node); }
public AppSolution AddAppSolution(string name, string appSolutionPath) { appSolutionPath = Path.GetFullPath(appSolutionPath); AppSolution node = new AppSolution(this, name) { //RelativeAppSolutionPath = this.GetRelativeToConfigDiskPath(appSolutionPath) RelativeAppSolutionPath = appSolutionPath }; this.NodeAddNewSubNode(node); return(node); }
public string GetProjectPath() { var cfg = this.GetConfig(); if (string.IsNullOrEmpty(cfg.CurrentCfgFolderPath)) { return(""); } AppSolution sln = this.Parent as AppSolution; var path = Path.Combine(sln.GetSolutionFolderPath(), this.RelativeAppProjectPath); return(path); }
public override ITreeConfigNode NodeAddNewSubNode(ITreeConfigNode node_impl = null) { AppSolution node = null; if (node_impl == null) { node = new AppSolution(this); } else { node = (AppSolution)node_impl; } this.Add(node); if (node_impl == null) { this.GetUniqueName(AppSolution.DefaultName, node, this.ListAppSolutions); } this.SetSelected(node); return(node); }
private bool IsUnique(AppSolution val) { if (val.Parent == null) { return(true); } if (string.IsNullOrWhiteSpace(val.Name)) // handled by another rule { return(true); } GroupListAppSolutions p = (GroupListAppSolutions)val.Parent; foreach (var t in p.ListAppSolutions) { if ((val.Guid != t.Guid) && (val.Name == t.Name)) { return(false); } } return(true); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); sln = (AppSolution)propertyItem.Instance; Grid grd = new Grid(); var cd1 = new ColumnDefinition(); cd1.Width = new GridLength(1, GridUnitType.Star); var cd2 = new ColumnDefinition(); cd2.Width = new GridLength(1, GridUnitType.Auto); grd.ColumnDefinitions.Add(cd1); grd.ColumnDefinitions.Add(cd2); textBox = new PropertyGridEditorTextBox(); textBox.Watermark = "Select file"; var _binding = new Binding("Value"); //bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(textBox, PropertyGridEditorTextBox.TextProperty, _binding); Button b = new Button(); b.Content = "..."; b.Click += B_Click; Grid.SetColumn(textBox, 0); Grid.SetColumn(b, 1); grd.Children.Add(textBox); grd.Children.Add(b); return(grd); }
public void AddAppSolution(AppSolution node) { this.NodeAddNewSubNode(node); }