コード例 #1
0
 /// <summary>
 /// when a team is selected, it will display the members in it
 /// </summary>
 /// <param name="team"></param>
 public void ShowTeamMemberLists(string team)
 {
     foreach (var item in pImpl.GetCurrentList())
     {
         if (item.TeamGS.Equals(team))
         {
             MemberListBox.Items.Add(item.NameGS);
         }
     }
 }
コード例 #2
0
        /*
         * SubmitParticipant (submits participant to created participants through several checks and procedures)
         * NewTeamWindow (shows a small window.. normally hidden behind a small picture.. that let's you create a new ally team
         * SubmitTeam..creates the new ally team
         * InsertImage (opens dialog window to choose image for team)
         * ToPreviousWindow
         * ToMenuWindow
         */
        #region buttons


        /// <summary>
        /// Takes all inputs and creates a participant and adds it to a team
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SubmitParticipant_Click(object sender, RoutedEventArgs e)
        {
            List <int>    parsedTP = new List <int>();
            List <string> tp       = new List <string>(); //tp = tryParse

            tp.Add(HealthTextBox.Text);
            tp.Add(OffenceTextBox.Text);
            tp.Add(DefenceTextBox.Text);
            tp.Add(MoveTextBox.Text);

            parsedTP = pImpl.ParseInts(tp);

            if (NameTextBox.Text == "" || HealthTextBox.Text == "" || OffenceTextBox.Text == "" || DefenceTextBox.Text == "" ||
                MoveTextBox.Text == "" || StrongAgainstFirstChoice.SelectedIndex == -1 || StrongAgainstSecondChoice.SelectedIndex == -1 ||
                WeakAgainstFirstChoice.SelectedIndex == -1 || WeakAgainstSecondChoice.SelectedIndex == -1 || ImmuneAgainstFirstChoice.SelectedIndex == -1 ||
                ImmuneAgainstSecondChoice.SelectedIndex == -1 || TeamNameChoice.SelectedIndex == -1)
            {
                MessageBoxResult result = MessageBox.Show("Please fill out and pick something from all boxes");
            }
            else if (parsedTP.Count < 4)
            {
                Console.WriteLine(parsedTP.Count);
                MessageBoxResult result = MessageBox.Show("Please fix the errors that was shown");
            }
            else
            {
                Fighter_DTO pDTO = new Fighter_DTO(); //only needed here locally
                RetrieveInput(pDTO, parsedTP);
                foreach (var item in pImpl.GetCurrentList())
                {
                    StrongAgainstFirstChoice.Items.Add(item.NameGS);
                    StrongAgainstSecondChoice.Items.Add(item.NameGS);
                    WeakAgainstFirstChoice.Items.Add(item.NameGS);
                    WeakAgainstSecondChoice.Items.Add(item.NameGS);
                    ImmuneAgainstFirstChoice.Items.Add(item.NameGS);
                    ImmuneAgainstSecondChoice.Items.Add(item.NameGS);
                }
            }
        }
コード例 #3
0
        //Constructor to take two kinds of windows
        public ParticipantCreateWindow(MainWindow mw, Window w, Fighter_Impl pImpl, Team_Impl tImpl)
        {
            this.pImpl = pImpl;
            this.tImpl = tImpl;
            exitApp    = true; //used for closing app
            this.w     = w;
            this.mw    = mw;
            InitializeComponent();
            Closed += new EventHandler(App_exit); //subscribing to closed event

            /*Test section (new team box) START */
            CreateTeamBox.Visibility = Visibility.Hidden;
            // Inserts image into site. (not sure how the path works)

            CoverTeamCanvasImage.Stretch    = Stretch.Fill;
            CoverTeamCanvasImage.Source     = new BitmapImage(new Uri(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\Sources\\SlimeBlack.png"));
            CoverTeamCanvasImage.Visibility = Visibility.Visible;
            CoverTeamCanvasImage.Margin     = new Thickness(556, 358, 0, 0);

            /*Test section (new team box) END */

            //List<Participant_DTO> participantList = pImpl.GetCurrentList();
            foreach (var item in pImpl.GetCurrentList())
            {
                StrongAgainstFirstChoice.Items.Add(item.NameGS);
                StrongAgainstSecondChoice.Items.Add(item.NameGS);
                WeakAgainstFirstChoice.Items.Add(item.NameGS);
                WeakAgainstSecondChoice.Items.Add(item.NameGS);
                ImmuneAgainstFirstChoice.Items.Add(item.NameGS);
                ImmuneAgainstSecondChoice.Items.Add(item.NameGS);
            }
            foreach (var item in tImpl.GetAllyTeamList())
            {
                TeamNameChoice.Items.Add(item.Key);
            }
        }