public void SetContext(IContext ctx) { bool deadTree = false; if (_pluginNode != null && _pluginNode.Nodes != null) { foreach (TreeNode node in _pluginNode.Nodes) { _pluginNode.Nodes.Remove(node); } deadTree = true; } ConnectToHost(); if (_pluginNode != null && _pluginNode.Nodes.Count == 0 && IsConnectionSuccess) { BuildNodesToPlugin(); } if (deadTree && _pluginNode != null) { _pluginNode.SetContext(null); } }
private LACTreeNode GetLUGNode() { if (_pluginNode == null) { Logger.Log( "LUGPlugIn.GetLUGNode: _pluginNode == null", Logger.manageLogLevel); _pluginNode = new LACTreeNode("Local Users and Groups", Resources.LocalGroup_16, typeof(DummyLUGPage), this); uNode = new LACTreeNode("Users", Resources.LocalGroup_16, typeof(LocalUserPage), this); uNode.sc = _pluginNode.sc; _pluginNode.Nodes.Add(uNode); gNode = new LACTreeNode("Groups", Resources.LocalGroup_16, typeof(LocalGroupPage), this); gNode.sc = _pluginNode.sc; _pluginNode.Nodes.Add(gNode); } foreach (TreeNode node in _pluginNode.Nodes) { LACTreeNode lacNode = (LACTreeNode)node; if (lacNode != null) { lacNode.SetContext(_hn); if (lacNode.NodeType == typeof(LocalUserPage)) { lacNode.ImageIndex = (int)Manage.ManageImageType.User; lacNode.SelectedImageIndex = (int)Manage.ManageImageType.User; } else if (lacNode.NodeType == typeof(LocalGroupPage)) { lacNode.ImageIndex = (int)Manage.ManageImageType.Group; lacNode.SelectedImageIndex = (int)Manage.ManageImageType.Group; } } } _pluginNode.ImageIndex = (int)Manage.ManageImageType.Group; _pluginNode.SelectedImageIndex = (int)Manage.ManageImageType.Group; _pluginNode.IsPluginNode = true; return(_pluginNode); }
public void SetContext(IContext ctx) { Hostinfo hn = ctx as Hostinfo; Logger.Log(String.Format("FileShareManagerPlugIn.SetHost(hn: {0}\n)", hn == null ? "<null>" : hn.ToString()), Logger.eventLogLogLevel); bool deadTree = false; if (_pluginNode != null && _pluginNode.Nodes != null && _hn != null && hn != null && hn.hostName != _hn.hostName) { foreach (TreeNode node in _pluginNode.Nodes) { _pluginNode.Nodes.Remove(node); } deadTree = true; } _hn = hn; if (HostInfo == null) { _hn = new Hostinfo(); } ConnectToHost(); if (_pluginNode != null && _pluginNode.Nodes.Count == 0 && _hn.IsConnectionSuccess) { BuildNodesToPlugin(); } if (deadTree && _pluginNode != null) { _pluginNode.SetContext(_hn); } }
public void SetContext(IContext ctx) { bool deadTree = false; if (_pluginNode != null && _pluginNode.Nodes != null) { foreach (TreeNode node in _pluginNode.Nodes) { _pluginNode.Nodes.Remove(node); } deadTree = true; } ConnectToHost(); if (deadTree && _pluginNode != null) { _pluginNode.SetContext(null); } }
public void SetContext(IContext ctx) { Hostinfo hn = ctx as Hostinfo; Logger.Log(String.Format("LUGPlugin.SetHost(hn: {0})", hn == null ? "null" : hn.hostName), Logger.manageLogLevel); _hn = hn; if (_hn == null) { _hn = new Hostinfo(); } if (_pluginNode != null && (!String.IsNullOrEmpty(hn.hostName))) { uint result = LUGAPI.NetAddConnection( _hn.hostName, _hn.creds.UserName, _hn.creds.Password); if (Configurations.currentPlatform != LikewiseTargetPlatform.Windows && result == (uint)LUGAPI.WinError.ERROR_FILE_NOT_FOUND) { result = (uint)LUGAPI.WinError.ERROR_SUCCESS; } hn.IsConnectionSuccess = false; if (result == (uint)LUGAPI.WinError.ERROR_SUCCESS) { hn.IsConnectionSuccess = true; } _pluginNode.SetContext(_hn); } }