private void AgentDisconnectHandler(object sernder, EventArgs args) { ((ICommunicationObject)_agent).Open(); ((ICommunicationObject)_agent).Closed -= AgentDisconnectHandler; ((ICommunicationObject)_agent).Faulted -= AgentDisconnectHandler; _agent = null; }
private void AgentReconnectHandler(object sernder, EventArgs args) { ((ICommunicationObject)_agent).Closed -= AgentDisconnectHandler; ((ICommunicationObject)_agent).Faulted -= AgentDisconnectHandler; _agent = CreateClient(ActiveAgent.Host); ((ICommunicationObject)_agent).Closed += AgentDisconnectHandler; ((ICommunicationObject)_agent).Faulted += AgentReconnectHandler; }
private void Connect() { if (_agent != null) { ((ICommunicationObject)_agent).Close(); } _agent = CreateClient(ActiveAgent.Host); ((ICommunicationObject)_agent).Closed += AgentDisconnectHandler; ((ICommunicationObject)_agent).Faulted += AgentReconnectHandler; FileSystemEntires = _agent.EnumerateEntries("\\"); ActiveDirectory = new DirectoryEntry { Name = "\\", FullName = "\\", Parent = null }; }