Example #1
0
        /// <summary>
        /// Establishes a connection with game service to get a game category word.
        /// </summary>
        /// <param name="category">GameCategory that needs the word</param>
        /// <returns>
        ///     Empty string if word couldn't be found; otherwise, a random word whose
        ///     first letter is accord to the selected for the actual round.
        /// </returns>
        public string GetCategoryWord(GameCategory category)
        {
            var word = string.Empty;

            EngineNetwork.EstablishChannel <IGameService>((service) => {
                word = service.GetCategoryWord(game.ActiveGuidGame, activePlayerGuid, category.Name);
                return(true);
            });
            return(word);
        }
Example #2
0
        /// <summary>
        /// Handles AddButton click event.
        /// </summary>
        /// <param name="sender">AddButton object</param>
        /// <param name="e">Button click event</param>
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            var addCategoryWindow = new GameConfiguration_AddCategoryWindow();

            addCategoryWindow.Closed += (windowSender, windowEvent) => {
                if (!addCategoryWindow.CategoryAdded)
                {
                    return;
                }
                var newCategory = new GameCategory(0, game, addCategoryWindow.CategoryName);
                categoriesList.Add(new GameCategoryItem {
                    GameCategory = newCategory,
                    IsSelected   = true,
                    Name         = addCategoryWindow.CategoryName
                });
                categoriesItemsControl.Items.Refresh();
            };
            addCategoryWindow.Show();
        }
Example #3
0
 /// <summary>
 /// Establishes a connection with game service to remove a GameCategory from the game.
 /// </summary>
 /// <param name="category">GameCategory to be removed</param>
 /// <returns>True if category was removed successfully; False if not</returns>
 public bool RemoveCategory(GameCategory category)
 {
     return(EngineNetwork.EstablishChannel <IGameService>((service) => {
         return service.RemoveCategory(ActiveGuidGame, category.Name);
     }));
 }