Ejemplo n.º 1
0
 public LoginForm(LoginHandler loginHandler)
 {
     this.itsState       = ClientState.UNAUTENTIZED;
     this.loginHandler   = loginHandler;
     this.updateObserver = this.update;
     InitializeComponent();
 }
Ejemplo n.º 2
0
            public async void Client_to_actor()
            {
                var actor = system.FreshActorOf <TestActor>();

                using (var observer = await ClientObserver.Create())
                {
                    await actor.Tell(new Attach { Observer = observer });

                    Notification @event = null;

                    var done         = new AutoResetEvent(false);
                    var subscription = observer.Subscribe((Notification e) =>
                    {
                        @event = e;
                        done.Set();
                    });

                    await actor.Tell(new Publish { Text = "c-a" });

                    done.WaitOne(TimeSpan.FromMilliseconds(100));
                    Assert.That(@event.Text, Is.EqualTo("c-a"));

                    subscription.Dispose();
                    await actor.Tell(new Publish { Text = "kaboom" });

                    done.WaitOne(TimeSpan.FromMilliseconds(100));
                    Assert.That(@event.Text, Is.EqualTo("c-a"));
                }
            }
Ejemplo n.º 3
0
 TestObserver(ClientObserver observer)
 {
     this.observer = observer;
     observer.Subscribe(message =>
     {
         Notifications.Add(message);
         Received.Set();
     });
 }
Ejemplo n.º 4
0
        public async Task Join()
        {
            client = await ClientObserver.Create();
            client.Subscribe((ChatRoomMessage msg) =>
            {
                if (msg.User != user)
                    Console.WriteLine(msg.Text);
            });

            await room.Tell(new Join {User = user, Client = client});
        }
Ejemplo n.º 5
0
        public static void Initialize()
        {
            clients = GlobalHost.ConnectionManager.GetHubContext<Relay>().Clients;
            
            observer = Task.Run(() => ClientObserver.Create()).Result;
            observer.Subscribe(On);

            Task.Run(() => Subscribe())
                .Wait();

            Task.Run(() => Resubscribe());
        }
Ejemplo n.º 6
0
        public static void Initialize()
        {
            clients = GlobalHost.ConnectionManager.GetHubContext <Relay>().Clients;

            observer = Task.Run(() => ClientObserver.Create()).Result;
            observer.Subscribe(On);

            Task.Run(() => Subscribe())
            .Wait();

            Task.Run(() => Resubscribe());
        }
Ejemplo n.º 7
0
        public async Task Join()
        {
            client = await ClientObserver.Create();

            client.Subscribe((ChatRoomMessage msg) =>
            {
                if (msg.User != user)
                {
                    Console.WriteLine(msg.Text);
                }
            });

            await room.Tell(new Join { User = user, Client = client });
        }
 public PlaceBidForm(ClientModel model, PlaceBidHandler placeBidHandler, ProductListViewHandler productListViewHandler)
 {
     this.itsModel = model;
     this.itsState = ClientState.UNAUTENTIZED;
     this.handleProductListClick = productListViewHandler;
     this.placeBidHandler        = placeBidHandler;
     this.updateObserver         = this.update;
     this.Show();
     this.Hide();
     InitializeComponent();
     this.Invoke(new Action(() =>
     {
         update(this.itsState);
     }));
 }
Ejemplo n.º 9
0
        public static void Main()
        {
            Console.WriteLine("Running demo. Booting cluster might take some time ...\n");

            var properties = new Dictionary <string, string>
            {
                { "account", "UseDevelopmentStorage=true" }
            };

            var system = ActorSystem.Configure()
                         .Playground()
                         .Run <ServiceLocator.Bootstrap>(properties)
                         .Register(typeof(Api).Assembly)
                         .Done();

            client = new Client(system, ClientObserver.Create().Result);
            client.Run();

            Console.WriteLine("Press Enter to terminate ...");
            Console.ReadLine();

            system.Dispose();
        }
Ejemplo n.º 10
0
            public static async Task <TestObserver> Create()
            {
                var observer = await ClientObserver.Create();

                return(new TestObserver(observer));
            }
 public void registerObserver(ClientObserver observer)
 {
     registry.Add(observer);
 }
 TestObserver(ClientObserver observer)
 {
     this.observer = observer;
     observer.Subscribe(message =>
     {
         Notifications.Add(message);
         Received.Set();
     });
 }
Ejemplo n.º 13
0
 public Client(IActorSystem system, ClientObserver observer)
 {
     this.system   = system;
     this.observer = observer;
 }
Ejemplo n.º 14
0
 public Client(IActorSystem system, ClientObserver observer)
 {
     this.system = system;
     this.observer = observer;
 }