public void ConstructorTest_With_ValidAgent_and_EventType() { string agent = "agent"; IntelEventType eventType = IntelEventType.AgentEnter; IntelEventArgs target = new IntelEventArgs(new AgentProfile(agent)); Assert.AreEqual<string>(agent, target.AgentProfile.Agent); Assert.AreEqual<IntelEventType>(eventType, target.EventType); }
private void OnIntelRecevied(IntelEventArgs intelEventArgs) { if (IntelReceived != null) { if (_syncContext != null) { _syncContext.Send(send => { IntelReceived(this, intelEventArgs); }, null); } else { IntelReceived(this, intelEventArgs); } } }
private void OnAgentStatusChanged(IntelEventArgs intelEventArgs) { if (AgentStatusChanged != null) { if (_syncContext != null) { _syncContext.Send(send => { AgentStatusChanged(this, intelEventArgs); }, null); } else { AgentStatusChanged(this, intelEventArgs); } } }
public void OnAgentStatusChanged(object sender, IntelEventArgs args) { switch (args.EventType) { case IntelEventType.AgentEnter: var offline = (from a in this.Agents where a.IsOnline == false select a).ToArray(); foreach (var a in offline) this.Agents.Remove(a); AgentViewModel agentViewModel = new AgentViewModel(args.AgentProfile); agentViewModel.IsOnline = true; this.Agents.Add(agentViewModel); break; case IntelEventType.AgentLeave: var agent = (from a in this.Agents where a.Agent == args.AgentProfile.Agent select a).First(); if (agent != null) agent.IsOnline = false; break; } }
private void OnAgentStatusChanged(IntelEventArgs intelEventArgs) { if (AgentStatusChanged != null) { if (_syncContext != null) _syncContext.Send(send => { AgentStatusChanged(this, intelEventArgs); }, null ); else AgentStatusChanged(this, intelEventArgs); } }
private void OnIntelRecevied(IntelEventArgs intelEventArgs) { if (IntelReceived != null) { if (_syncContext != null) _syncContext.Send(send => { IntelReceived(this, intelEventArgs); }, null); else IntelReceived(this, intelEventArgs); } }
public void ConstructorTest_With_NullAgent_and_EventType() { string agent = null; IntelEventArgs target = new IntelEventArgs(new AgentProfile (agent )); }
public void ConstructorTest_With_ValidAgent_and_NullImage() { string agent = "agent"; Bitmap image = null; string caption = "caption"; IntelEventArgs target = new IntelEventArgs(new IntelData(agent, image, caption)); }
public void ConstructorTest_With_NullAgent_and_Image() { string agent = null ; Bitmap image = new Bitmap(100, 100); string caption = "caption"; IntelEventArgs target = new IntelEventArgs(new IntelData(agent, image, caption)); }
public void ConstructorTest_With_ValidAgent_and_Image() { string agent = "agent"; Bitmap image = new Bitmap(100, 100); string caption = "caption"; IntelEventArgs target = new IntelEventArgs(new IntelData(agent,image,caption)); Assert.AreEqual<string>(agent, target.AgentProfile.Agent); Assert.AreEqual<Bitmap>(image, target.Image); Assert.AreEqual<string>(caption, target.Caption); Assert.AreEqual<IntelEventType>(IntelEventType.IntelReceived, target.EventType); }
public void OnImageryReceived(object sender, IntelEventArgs args) { ImageryViewModel imageViewModel = new ImageryViewModel(args.AgentProfile.Agent, args.Image, args.Caption); this.MostRecentImagery = imageViewModel; this.Imagery.Add(imageViewModel); }