コード例 #1
0
 private void PhoneAFriendbtn_Click(object sender, RoutedEventArgs e)
 {
     if (this.DefaultViewModel.FafIsActive)
     {
         FoneAFriend faf = new FoneAFriend(QuestionGroup.Options.IndexOf(QuestionGroup.Options.Where(x => x.IsAnswer.Equals("True")).First()));
         this.DefaultViewModel.FoneAFriendOption = faf.FafOption;
         this.DefaultViewModel.LifeLine          = LifeLine.FoneAFriend;
         this.DefaultViewModel.FafIsActive       = false;
     }
 }
コード例 #2
0
ファイル: Game.cs プロジェクト: nccgroup/44Con2013Game
        public void SaveGame()
        {
            if (Directory.Exists("C:\\NCCPlayers\\") == false)
            {
                try
                {
                    Directory.CreateDirectory("C:\\NCCPlayers\\");
                }
                catch (Exception)
                {
                    MessageBox.Show("Couldn't create the required directory C:\\NCCPlayer\\. Games wont be saved!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            XmlDocument newDoc  = new XmlDocument();
            XmlElement  newRoot = newDoc.CreateElement("Game");
            XmlNode     xmlE    = newDoc.AppendChild(newRoot);

            XmlElement XPlayerName = newDoc.CreateElement("PlayerName");

            XPlayerName.InnerText = PlayerName;
            xmlE.AppendChild(XPlayerName);
            XmlElement XEMail = newDoc.CreateElement("PlayerEMail");

            XEMail.InnerText = PlayerEMail;
            xmlE.AppendChild(XEMail);
            XmlElement XLevel = newDoc.CreateElement("Level");

            XLevel.InnerText = Level.ToString();
            xmlE.AppendChild(XLevel);
            XmlElement XSeconds = newDoc.CreateElement("Seconds");

            XSeconds.InnerText = Seconds.ToString();
            xmlE.AppendChild(XSeconds);

            XmlElement X5050 = newDoc.CreateElement("FiftyFifty");

            X5050.InnerText = FiftyFifty.ToString();
            xmlE.AppendChild(X5050);
            XmlElement XBackdoor = newDoc.CreateElement("Backdoor");

            XBackdoor.InnerText = FoneAFriend.ToString();
            xmlE.AppendChild(XBackdoor);
            XmlElement XMoreTime = newDoc.CreateElement("MoreTime");

            XMoreTime.InnerText = XMoreTime.ToString();
            xmlE.AppendChild(XMoreTime);


            string strFile = "C:\\NCCPlayers\\" + GetTimestamp(DateTime.Now) + ".xml";

            newDoc.Save(@strFile);
        }