Ejemplo n.º 1
0
        public bool CreateAccount(string name, string password)
        {
            try
            {
                PexesoPlayer pexesoPlayer = _pexesoServiceClient.AddPlayer(name, password);

                if (pexesoPlayer == null)
                {
                    throw new ArgumentException("Incorrect name or password!");
                }
                else
                {
                    Player = pexesoPlayer;
                    MessageBox.Show("Your account was successfully created");

                    instanceContext = new InstanceContext(new Client());
                    var client = new DuplexChannelFactory <IPexesoService>(instanceContext, "PexesoClient");
                    _pexesoServiceClient = client.CreateChannel();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                instanceContext = new InstanceContext(new Client());
                var client = new DuplexChannelFactory <IPexesoService>(instanceContext, "PexesoClient");
                _pexesoServiceClient = client.CreateChannel();

                MessageBox.Show(ex.Message);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public MainViewModel(IPexesoService pexesoService, IChatService chatService)
        {
            Pictures      = new ObservableCollection <Image>();
            Rectangles    = new ObservableCollection <Rectangle>();
            PexesoService = pexesoService;
            ChatService   = chatService;
            CommmandInit();

            PexesoService.ChoseSecondCardTimer.Tick += ChoseSecondCardTimerTick;
            PexesoService.TurnTimer.Tick            += InActiveTimerTick;
            PexesoService.RoundTimer.Tick           += RoundTImeTick;
            Score = PexesoService.Score.ToString();
        }
Ejemplo n.º 3
0
        public Client()
        {
            var registerChannelFactory = new ChannelFactory <IRegisterService>("MyRegisterTcpEndpoint");

            _registerChannel = registerChannelFactory.CreateChannel();

            var chatChannelFactory = new DuplexChannelFactory <IChatService>(this, "MyChatTcpEndpoint");

            _chatChannel = chatChannelFactory.CreateChannel();

            var pexesoChannelFactory = new DuplexChannelFactory <IPexesoService>(this, "MyPexesoTcpEndpoint");

            _pexesoChannel = pexesoChannelFactory.CreateChannel();
        }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            _pexeso_Page = new Pexeso_Page(this);
            var client = new DuplexChannelFactory <IPexesoService>(instanceContext, "PexesoClient");

            _pexesoServiceClient = client.CreateChannel();

            InvitationResultCame += MainWindow_InvitationResultCame;
            _activePlayers_Page   = new ActivePlayers_Page(this);
            _frame_Main           = new Frame();
            _frame_Main.SetValue(Grid.RowProperty, 1);
            Grid_Main.Children.Add(_frame_Main);
        }
Ejemplo n.º 5
0
 public InviteViewModel(IPexesoService pexesoService)
 {
     PlayerList    = new ObservableCollection <Player>();
     PexesoService = pexesoService;
     CommandInit();
 }
Ejemplo n.º 6
0
 public LoginViewModel(IPexesoService pexesoService, IChatService chatSerivce)
 {
     PexesoService = pexesoService;
     ChatSerivce   = chatSerivce;
     CommandInit();
 }