Пример #1
0
 /// <summary>
 /// Simple View with out MVVM pattern
 /// </summary>
 public MenuView()
 {
     InitializeComponent();
     PlayerName = ConfigurationManager.AppSettings["PlayerName"];
     if (PlayerName == null || PlayerName == "Unknown")
     {
         ChangePlayerName();
     }
     if (ConfigurationManager.AppSettings["AI_behavior"] == null)
     {
         OptionsWindow.SetSetting("AI_behavior", "default");
     }
     LoggerConfiguration();
     Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, "Menu open"));
 }
Пример #2
0
        private void Info_Click(object sender, RoutedEventArgs e)
        {
            Logger.Add(new Log(this.GetType().Name, MethodBase.GetCurrentMethod().Name, "Menu -> Info"));
            this.Visibility = Visibility.Hidden;
            if (ConfigurationManager.AppSettings["AI_behavior"] == null)
            {
                OptionsWindow.SetSetting("AI_behavior", "default");
            }
            var tmp = ConfigurationManager.AppSettings["AI_behavior"] ?? "";

            if (tmp != "default" && tmp != "")
            {
                tmp = tmp.Substring(1);
            }
            new InfoView($"Player Name : {PlayerName} \nAI : {tmp}").ShowDialog();
            this.Visibility = Visibility.Visible;
        }
Пример #3
0
        private void ChangePlayerName()
        {
            PlayerNameWindow player = new PlayerNameWindow();

            if (bool.Parse(player.ShowDialog().ToString()))
            {
                PlayerName = player.PlayerName;
                Task.Factory.StartNew(
                    () =>
                {
                    string playerName = ConfigurationManager.AppSettings["PlayerName"];
                    if (PlayerName == null || playerName == "Unknown" && player.PlayerName != "Unknown")
                    {
                        OptionsWindow.SetSetting("PlayerName", player.PlayerName);
                    }
                }
                    );
            }
            else //unknown error
            {
                KILL();
            }
        }