public GameWindowViewModel(int level, string word, Category categoryProperty, int mistakes, int wordIndex, ObservableCollection <string> pickedWordsCollection, int sec, string imagePath)
        {
            currentUser      = SignInViewModel.SignedInUser;
            Level            = level;
            Word             = word;
            CategoryProperty = categoryProperty;
            switch (CategoryProperty)
            {
            case Category.AllCategories:
                AllCategoryChecked = true;
                break;

            case Category.Rivers:
                RiversCategoryChecked = true;
                break;

            case Category.Cars:
                CarsCategoryChecked = true;
                break;

            case Category.Movies:
                MoviesCategoryChecked = true;
                break;

            case Category.Flowers:
                FlowersCategoryChecked = true;
                break;

            default:
                break;
            }
            Mistakes              = mistakes;
            WordIndex             = wordIndex;
            PickedWordsCollection = pickedWordsCollection;
            Seconds = sec;
            StartTimer(Seconds);
            ImagePath             = imagePath;
            signInVM              = actions.DeserializeUsers("User.xml");
            dispatcherTimer.Tick += new EventHandler(TimerTick);
            words = new Words();
            words = actions.DeserializeWords("Words.xml");
        }
예제 #2
0
        //private User user;

        public SignUpViewModel()
        {
            ImageSource = images.Emojis.ElementAt(0);

            try
            {
                FileStream fileUsr = new FileStream(Constants.UsersFile, FileMode.Open);
                fileUsr.Dispose();
            }
            catch (FileNotFoundException)
            {
                return;
            }

            this.users = serializationActions.DeserializeUsers(Constants.UsersFile);
        }
예제 #3
0
 public SignIn()
 {
     InitializeComponent();
     DataContext = actions.DeserializeUsers("User.xml");
 }
예제 #4
0
 public SignUpViewModel()
 {
     ImageSource = images.ImagesList.ElementAt(0);
     signInVM    = actions.DeserializeUsers("User.xml");
 }
예제 #5
0
        public HomeViewModel(User user, bool resumeGame = false)
        {
            users = serializationActions.DeserializeUsers(Constants.UsersFile);
            words = serializationActions.DeserializeWords(Constants.WordsFile);
            foreach (var userInList in users.List)
            {
                if (userInList.Name == user.Name)
                {
                    users.List.Remove(userInList);
                    users.List.Add(user);
                    break;
                }
            }
            serializationActions.SerializeUsers(Constants.UsersFile, users);
            users     = serializationActions.DeserializeUsers(Constants.UsersFile);
            this.user = user;
            if (!resumeGame)
            {
                PickWord();
                CreateWordOnDisplay(user.GameProperty.WordToGuess);
                delay = 61;
            }
            else
            {
                switch (user.GameProperty.CategoryProperty)
                {
                case Models.Category.All:
                    AllIsSelected = true;
                    break;

                case Models.Category.Cars:
                    CarsIsSelected = true;
                    break;

                case Models.Category.Movies:
                    MoviesIsSelected = true;
                    break;

                case Models.Category.States:
                    StatesIsSelected = true;
                    break;

                case Models.Category.Mountains:
                    MountainsIsSelected = true;
                    break;

                case Models.Category.Rivers:
                    RiversIsSelected = true;
                    break;

                default:
                    break;
                }
                delay           = user.GameProperty.SecondsRemaining;
                firstCreation   = false;
                this.resumeGame = resumeGame;
            }
            HangImageSource = images.Hangs[user.GameProperty.MistakesProperty];
            timer.Tick     += new EventHandler(TimerTick);
            StartTimer(delay);
        }
예제 #6
0
 public SignInViewModel()
 {
     this.users  = serializationActions.DeserializeUsers(Constants.UsersFile);
     ImageSource = users.List.Count > 0 ? new BitmapImage(new Uri(images.Emojis.ElementAt(users.List[0].ImageIndex).UriSource.ToString(), UriKind.Relative)) : new BitmapImage(new Uri(@"/Assets/Emojis/Emoji_1.png", UriKind.Relative));
 }