Пример #1
0
        public BackgammonScreen(BackgammonVM vm)
        {
            InitializeComponent();
            VM = vm;
            this.DataContext = VM;
            chat_cc.Content  = new ChatScreen(VM.PlayerA, VM.PlayerB);
            AddTriangles();
            animatedTriangles = new List <int>();

            //Seed random to be different between clients
            int seed = (int)DateTime.Now.Ticks;

            rand = new Random(seed);


            _timer              = new DispatcherTimer();
            _timer.Interval     = TimeSpan.FromMilliseconds(200);
            _timer.Tick        += _timer_Tick;
            VM.PropertyChanged += VM_PropertyChanged;
            DisplayWaitingScreen(VM.IsWaiting);
        }
Пример #2
0
        public ChatWindow(string contact, bool isGame = false, bool isMyTurn = false, Guid?session = null)
        {
            InitializeComponent();
            _mainVM  = MainVM.Instance;
            _contact = contact;
            IsGame   = isGame;

            if (IsGame)
            {
                this.Title              = $"{_mainVM.UserName} - Game with {_contact}";
                this.Width              = 1200;
                this.Height             = 700;
                gameVM                  = new BackgammonVM(_mainVM.UserName, contact);
                gameVM.Session          = session;
                gameVM.IsWaiting        = !isMyTurn;
                chatControl_cc.Content  = new BackgammonScreen(gameVM);
                gameVM.PropertyChanged += GameVM_GameEnded;
            }
            else
            {
                this.Title             = $"{_mainVM.UserName} - Chat with {_contact}";
                chatControl_cc.Content = new ChatScreen(_mainVM.UserName, contact);
            }
        }
Пример #3
0
 public MainWindow(string player1, string player2)
 {
     InitializeComponent();
     _gameVM          = new BackgammonVM(player1, player2);
     this.DataContext = _gameVM;
 }