private frmUserSettingsNode() { this._model = null; this._node = null; this._nodeDefinition = null; this._template = null; this._userSettingsManager = null; InitializeComponent(); }
public frmUserSettingsNode(MsSqlAuditorModel model, TreeNode node) : this() { if (node == null) { throw new ArgumentNullException("node"); } this._node = node; this._nodeDefinition = node.Tag as ConcreteTemplateNodeDefinition; if (this._nodeDefinition == null) { throw new ArgumentException("Template is not specified for the node."); } this._model = model; this._template = GetUserSettings(); this._userSettingsManager = new UserSettingsManager( this._model.Settings.InterfaceLanguage ); }
public TreeNode CreateTreeViewNode(TemplateNodeInfo node, out ConcreteTemplateNodeDefinition nodeDef) { Debug.Assert(node.IsInstance); ConnectionData connection = node.Connection; nodeDef = new ConcreteTemplateNodeDefinition(node, connection.ConnectionGroup); UserSettingsManager settingsManager = new UserSettingsManager( Program.Model.Settings.InterfaceLanguage ); UserSettingsRow nodeSettings = settingsManager.LoadUserSettings( node.TemplateNodeId.GetValueOrDefault() ); if (nodeSettings != null) { if (!string.IsNullOrEmpty(nodeSettings.NodeUIName)) { node.Title = nodeSettings.NodeUIName; } node.UIcon = nodeSettings.NodeUIIcon; node.FontColor = nodeSettings.NodeFontColor; node.IsDisabled = !nodeSettings.NodeEnabled; } string iconName = GetIcon(nodeDef); TreeNode treeNode = new TreeNode { Tag = nodeDef, Text = nodeDef.FormatNodeText(), ImageKey = iconName, SelectedImageKey = iconName, }; if (node.FontColor != null) { Color color = Colors.FromString(node.FontColor); treeNode.ForeColor = color; } if (node.FontStyle != null) { treeNode.NodeFont = new Font(treeTemplate.Font, ParseFontStyle(node.FontStyle)); } if (node.Template.Childs.Any()) { if (treeNode.Nodes.Count == 0) { // to make it expandable treeNode.Nodes.Add( new TreeNode { Tag = _MakeExpandableNodeTag } ); } } nodeDef.NodeActivated = !node.IsDisabled; SetNodeOnLoading(treeNode); return treeNode; }