예제 #1
0
        public LoginViewModel()
        {
            ConsoleLog = new ConsoleLog {
                Document = "check binding \n"
            };                                                             //test
            AuthenticatedUser = AuthenticatedUser.Instance;
            //load all contacts:
            ContactStateManager.LoadAllContacts();
            //init Proxies:
            UserServiceProxy = UserServiceProxy.Instance;
            ChatServiceProxy = ChatServiceProxy.Instance;
            GameServiceProxy = GameServiceProxy.Instance;

            //Init Commands:
            SendLoginRequestCommand   = new MyCommand(SendLoginRequest);
            ChangeViewToSignUpCommand = new MyCommand(ChangeViewToSignUp);
        }
예제 #2
0
 public GameWindowViewModel(IUserName chosenContact)
 {
     //get opponent:
     ChosenContact = chosenContact;
     //init Game:
     gameManager                  = new GameManager("hen", "simon");
     gameManager.GameChanged     += GameManager_OnGameChanged;
     gameManager.Game.StepsEnded += Game_OnStepsEnded;
     //init proxies:
     GameServiceProxy = GameServiceProxy.Instance;
     GameServiceProxy.OnInGameEvent += GameServiceProxy_OnInGame;
     //init UI Slots:
     RefreshGameUI();
     cubesSteps = new ObservableCollection <Step>(gameManager.Game.Steps);
     ConsoleLog = new ConsoleLog();
     //chosenSlotInit:
     onChosenSlotChanged += slotClicked;
     //init Commands:
     RollCubesCommand = new MyCommand(RollCubes);
 }
예제 #3
0
 //ctor:
 public ContactListViewModel()
 {
     onlineUsers  = new ObservableCollection <UserDTO>(ContactStateManager.GetOnlineContacts());
     offlineUsers = new ObservableCollection <UserDTO>(ContactStateManager.GetOfflineContacts());
     ConsoleLog   = new ConsoleLog();
     //init proxies:
     UserServiceProxy = UserServiceProxy.Instance;  //TODO: is needed?
     UserServiceProxy.OnLoginEvent    += UserServiceProxy_OnLoginEvent;
     UserServiceProxy.OnSignedUpEvent += UserServiceProxy_OnSignedUp;
     UserServiceProxy.OnLogoutEvent   += UserServiceProxy_OnLogout;
     ChatServiceProxy = ChatServiceProxy.Instance;
     ChatServiceProxy.OnMessageSentEvent += ChatServiceProxy_OnMessageSent;
     GameServiceProxy              = GameServiceProxy.Instance;
     GameServiceProxy.OnGameEvent += GameServiceProxy_OnGameEvent;
     //init ICommands:
     SendGameRequestCommand = new MyCommand(SendGameRequest);
     OpenChatWindowCommand  = new MyCommand(OpenChatWindow);
     //subscribe to Closing Window event:
     Application.Current.MainWindow.Closing += MainWindow_OnWindowClosing;
 }