public ProblemServiceTest() { _conn = new DbConnexion("Test_LittleProblem"); _problemCollection = _conn.Collection<Problem>(CollectionNames.Problem); _problemService = new ProblemService(_conn); // Perform factory set up (once for entire test run) IGenerationSessionFactory factory = AutoPocoContainer.Configure(x => { x.Conventions(c => c.UseDefaultConventions()); x.AddFromAssemblyContainingType<Member>(); x.Include<Member>() .Setup(m => m.Id).Use<ObjectIdDataSource>() .Setup(m => m.OpenId).Random(5, 10) .Setup(m => m.UserName).Random(5, 7); x.Include<Problem>() .Setup(p => p.Id).Use<ObjectIdDataSource>() .Setup(p => p.Text).Use<LoremIpsumSource>() .Setup(p => p.Title).Random(7, 12); x.Include<Response>() .Setup(r => r.Text).Use<LoremIpsumSource>(); }); // Generate one of these per test (factory will be a static variable most likely) _session = factory.CreateSession(); }
public ConnexionMenuViewModel(IEventAggregator eventAggregator, IConnexion connexion, IInformationService service) { _eventAggregator = eventAggregator; _connexion = connexion; _service = service; Connexion = new DelegateCommand(Connect); }
public ProblemServiceTest() { _conn = new DbConnexion("Test_LittleProblem"); _problemCollection = _conn.Collection <Problem>(CollectionNames.Problem); _problemService = new ProblemService(_conn); // Perform factory set up (once for entire test run) IGenerationSessionFactory factory = AutoPocoContainer.Configure(x => { x.Conventions(c => c.UseDefaultConventions()); x.AddFromAssemblyContainingType <Member>(); x.Include <Member>() .Setup(m => m.Id).Use <ObjectIdDataSource>() .Setup(m => m.OpenId).Random(5, 10) .Setup(m => m.UserName).Random(5, 7); x.Include <Problem>() .Setup(p => p.Id).Use <ObjectIdDataSource>() .Setup(p => p.Text).Use <LoremIpsumSource>() .Setup(p => p.Title).Random(7, 12); x.Include <Response>() .Setup(r => r.Text).Use <LoremIpsumSource>(); }); // Generate one of these per test (factory will be a static variable most likely) _session = factory.CreateSession(); }
public MainRegionController(IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer container, IGameModeInfoService service, IConnexion connexion) { if (regionManager == null) { throw new ArgumentNullException("regionManager"); } if (eventAggregator == null) { throw new ArgumentNullException("eventAggregator"); } if (container == null) { throw new ArgumentNullException("container"); } if (service == null) { throw new ArgumentNullException("service"); } if (connexion == null) { throw new ArgumentNullException("connexion"); } this._container = container; this._regionManager = regionManager; this._eventAggregator = eventAggregator; this._service = service; _connexion = connexion; _connexion.ErrorGames += ErrorGames; this._eventAggregator.GetEvent <GameModeSelectedEvent>().Subscribe(GameModeSelected, true); this._eventAggregator.GetEvent <ChangeViewMainRegionEvent>().Subscribe(ChangeViewMain, true); }
public CurrentGameModes GetDetails(IConnexion connexion) { List <CurrentGameMode> currentGameMode = connexion.GetGames(); CurrentGameModes currentGameModes = new CurrentGameModes(); currentGameModes.AddRange(currentGameMode); return(currentGameModes); }
public PlayersInGame GetPlayers(IConnexion connexion, int idGame) { List <Player> players = connexion.GetPlayerInGame(idGame); _players.AddRange(players); return(_players); }
private void client_ConnexionRemoved(Communicator c, IConnexion conn) { /* if (!IsDisposed && client.Connexions.Count == 0) { MessageBox.Show(this, "Disconnected from server", Text); Close(); } */ }
public CreateModeMenuViewModel(IGameModeInfoService gameModeInfoService, IInformationService service, IEventAggregator eventAggregator, IConnexion connexion) { _eventAggregator = eventAggregator; Return = new DelegateCommand(ReturnMainMenu); Create = new DelegateCommand(CreateMode); _connexion = connexion; GameModeInfos = new ListCollectionView(gameModeInfoService.GetGameModeInfos()); this.GameModeInfos.CurrentChanged += new EventHandler(SelectedGameInfoChanged); _service = service; }
public AttenteMenuViewModel(IEventAggregator eventAggregator, IInformationService serviceInfo, IConnexion connexion, IPlayersInGameService servicePlayer) { _eventAggregator = eventAggregator; _connexion = connexion; _servicePlayer = servicePlayer; _serviceInfo = serviceInfo; Players = new ListCollectionView(servicePlayer.GetPlayers(connexion, serviceInfo.GetCurrentGameMode().Id)); _connexion.NewPlayer += RefreshPlayers; _connexion.DeletePLayer += DeletePlayer; _connexion.StartGame += Start; }
public JoinModeMenuViewModel(ICurrentGameModeService currentGameModeService, IInformationService service, IEventAggregator eventAggregator, IConnexion connexion) { _eventAggregator = eventAggregator; CurrentGameModes = new ListCollectionView(currentGameModeService.GetDetails(connexion)); CurrentGameModes.CurrentChanged += new EventHandler(SelectedGameInfoChanged); _gameModeService = currentGameModeService; Return = new DelegateCommand(ReturnMainMenu); Join = new DelegateCommand(JoinGame); _connexion = connexion; _service = service; StartTimer(); }
private void _server_ObjectReceived(Message m, IConnexion client, ITransport transport) { if (m is ObjectMessage) { object obj = ((ObjectMessage) m).Object; if (obj is PositionChanged) { if(PositionUpdates != null) { PositionUpdates(((PositionChanged) obj).X, ((PositionChanged) obj).Y); } } } }
public MainViewViewModel(IGridCellService gridCell, IConnexion connexion, IInformationService informationService, IZoneService zoneService) { ButtonClic = true; Scale = 1; _gridCell = gridCell; MousePressedCommand = new DelegateCommand <MouseButtonEventArgs>(MousePressed); MouseWheelCommand = new DelegateCommand <MouseWheelEventArgs>(MouseWheel); MouseMoveCommand = new DelegateCommand <MouseEventArgs>(MouseMove); RightDownCommand = new DelegateCommand <MouseButtonEventArgs>(RightDown); RightUpCommand = new DelegateCommand <MouseButtonEventArgs>(RightUp); StartPressedCommand = new DelegateCommand(StartPressed); _connexion = connexion; _informationService = informationService; _zoneService = zoneService; Zone = new Zone(); _connexion.SwitchCell += SwitchCell; _connexion.StartGenEv += StartGen; _timer.Elapsed += GetGen; }
protected override void AddConnexion(IConnexion cnx) { base.AddConnexion(cnx); newlyAddedClients.Add(cnx); // used for ClientsJoined event clientIDs.Add(cnx.Identity, cnx); }
public MembershipService(IConnexion connexion) { _connexion = connexion; _membersCollection = _connexion.Collection<Member>(CollectionNames.Member); }
public MemberRepository(IConnexion conn) { _connexion = conn; _membersCollection = _connexion.Collection<Member>(CollectionNames.Member); }
public CannotSendMessagesError(IConnexion source, Exception ex, ICollection<Message> msgs) : this(source) { AddAll(ex, msgs); }
public DataDetailsTransport(IConnexion connexion) { connectApi = connexion; }
public ProblemService(IConnexion connexion) { _connexion = connexion; _problemsCollection = _connexion.Collection<Problem>(CollectionNames.Problem); }
private void _cnx_TransportAdded(IConnexion cnx, ITransport transport) { if(transport is NetworkEmulatorTransport) { ((NetworkEmulatorTransport) transport).PacketDisposition += _transport_PacketDisposed; } UpdateTransport(transport); }
private void _client_ConnexionAdded(Communicator c, IConnexion cnx) { cnx.TransportAdded += _cnx_TransportAdded; foreach (ITransport t in cnx.Transports) { _cnx_TransportAdded(cnx, t); } }
public MembershipService(IConnexion connexion) { _connexion = connexion; _membersCollection = _connexion.Collection <Member>(CollectionNames.Member); }
public MemberRepository(IConnexion conn) { _connexion = conn; _membersCollection = _connexion.Collection <Member>(CollectionNames.Member); }
public Unduplicate(IConnexion co) { this.connexion = co; }
public ProblemService(IConnexion connexion) { _connexion = connexion; _problemsCollection = _connexion.Collection <Problem>(CollectionNames.Problem); }
public ProblemRepository(IConnexion conn) { _connexion = conn; _problemsCollection = _connexion.Collection<Problem>(CollectionNames.Problem); }
public AbstractPacketScheduler(IConnexion cnx) { log = LogManager.GetLogger(GetType()); this.cnx = cnx; }
public NoMatchingTransport(IConnexion connexion, MessageDeliveryRequirements mdr, ChannelDeliveryRequirements cdr) : base(Severity.Warning, String.Format("Could not find capable transport (mdr={0}, cdr={1})", mdr, cdr)) { SourceComponent = connexion; this.mdr = mdr; this.cdr = cdr; }
public CannotSendMessagesError(IConnexion source, Exception ex, PendingMessage msg) : this(source) { Add(ex, msg); }
public ConnexionClosedException(IConnexion connexion) : base(Severity.Warning) { SourceComponent = connexion; }
//constructeur public Unduplicate(IConnexion con) { Connect = con; }
public CannotSendMessagesError(IConnexion source) : base(Severity.Warning) { SourceComponent = source; }
private void s_MessageReceived(Message m, IConnexion client, ITransport transport) { if (Verbose > 2 && log.IsInfoEnabled) { log.Info(String.Format("received message: {0} from Client {1} via {2}", m, client.Identity, transport)); } //repeat whatever we receive to everyone else server.Send(m, null, new MessageDeliveryRequirements(transport.Reliability, MessageAggregation.Immediate, transport.Ordering)); }
public RoundRobinPacketScheduler(IConnexion cnx) : base(cnx) { }
//constructeur public DataDetailsTransport(IConnexion conn) { Connect = conn; }
public ImmediatePacketScheduler(IConnexion cnx) : base(cnx) { }
public Zone InitializeZone(IConnexion connexion, int idGame) { _zone = new Zone(); _zone.AddRange(connexion.GetZone(idGame)); return(_zone); }
public ProblemRepository(IConnexion conn) { _connexion = conn; _problemsCollection = _connexion.Collection <Problem>(CollectionNames.Problem); }
private void _cnx_TransportAdded(IConnexion connexion, ITransport transport) { timers[transport] = Stopwatch.StartNew(); }
private void _client_TransportRemoved(IConnexion client, ITransport newTransport) { if (Verbose > 1 && log.IsInfoEnabled) { log.Info(String.Format("Client {0}: transport removed: {1}", client.Identity, newTransport)); } }
private void _cnx_TransportRemoved(IConnexion connexion, ITransport transport) { timers.Remove(transport); }
private void MensagemEnviada(GT.Net.Message a, IConnexion b, ITransport c) { if ((a.MessageType.Equals(MessageType.Object)) && (a.ChannelId.Equals(2))) { ContaEnviadas++; // this.label1.Text = "Enviadas:" + ContaEnviadas.ToString() + " de:" + coords.Identity.ToString(); } }
private void _comm_ConnexionAdded(Communicator c, IConnexion cnx) { cnx.TransportAdded += _cnx_TransportAdded; cnx.TransportRemoved += _cnx_TransportRemoved; cnx.PingRequested += _cnx_PingRequested; cnx.PingReplied += _cnx_PingReceived; foreach(ITransport t in cnx.Transports) { _cnx_TransportAdded(cnx, t); } }
private void _client_ConnexionAdded(Communicator c, IConnexion cnx) { cnx.PingRequested += _cnx_PingRequested; cnx.PingReplied += _cnx_PingReceived; }
private void _comm_ConnexionRemoved(Communicator c, IConnexion conn) { conn.PingRequested -= _cnx_PingRequested; conn.PingReplied -= _cnx_PingReceived; }
protected override void RemovedConnexion(IConnexion cnx) { clientIDs.Remove(cnx.Identity); if (ClientsRemoved != null) { ClientsRemoved(new SingleItem<IConnexion>(cnx)); } base.RemovedConnexion(cnx); }
private void server_MessageReceived(Message m, IConnexion client, ITransport transport) { switch (m.MessageType) { case MessageType.Binary: if (!ByteUtils.Compare(((BinaryMessage) m).Bytes, StandardObjects.ByteMessage)) { Console.WriteLine("Invalid byte message: {0}", ByteUtils.DumpBytes(((BinaryMessage) m).Bytes)); errorOccurred = true; } break; case MessageType.String: if (!StandardObjects.StringMessage.Equals(((StringMessage) m).Text)) { Console.WriteLine("Invalid strings message: {0}", ((StringMessage) m).Text); errorOccurred = true; } break; case MessageType.Object: if (!StandardObjects.Equivalent(StandardObjects.ObjectMessage, ((ObjectMessage) m).Object)) { Console.WriteLine("Invalid object message: {0}", ((ObjectMessage) m).Object); errorOccurred = true; } break; } // Randomly send a message elsewhere 10% of the time; // this has multiple senders from outside of the server's listening loop if (random.Next(0, 100) < 10) { return; } int clientNumber = random.Next(0, Server.Clients.Count - 1); server_SendMessage(m, clientNumber); }