示例#1
0
        private void buttonSearchRoamers_Click(object sender, EventArgs e)
        {
            var searchRoamers = new SearchRoamers();
            if (searchRoamers.ShowDialog() == DialogResult.OK)
            {
                var adjacents = (List<Adjacent>) dataGridViewAdjacents.DataSource;

                if (adjacents != null)
                {
                    int cnt = 0;
                    bool found = false;

                    string roamerText = "";
                    bool firstDisplay = true;

                    if (searchRoamers.ReturnR != 0)
                    {
                        roamerText += "R: " + searchRoamers.ReturnR;
                        firstDisplay = false;
                    }

                    if (searchRoamers.ReturnE != 0)
                    {
                        if (!firstDisplay)
                            roamerText += "  ";

                        roamerText += "E: " + searchRoamers.ReturnE;
                        firstDisplay = false;
                    }

                    if (searchRoamers.ReturnL != 0)
                    {
                        if (!firstDisplay)
                            roamerText += "  ";

                        roamerText += "L: " + searchRoamers.ReturnL;
                    }

                    foreach (Adjacent adjacent in adjacents)
                    {
                        if (roamerText == adjacent.RoamerLocations)
                        {
                            dataGridViewAdjacents.FirstDisplayedScrollingRowIndex = cnt;
                            dataGridViewAdjacents.Rows[cnt].Selected = true;

                            found = true;

                            break;
                        }

                        cnt++;
                    }

                    if (!found)
                        MessageBox.Show("No match was found for your Roaming Pokemon.", "No Match", MessageBoxButtons.OK);
                }
            }
        }
示例#2
0
        private void buttonSearchRoamers_Click(object sender, EventArgs e)
        {
            var searchRoamers = new SearchRoamers();

            if (searchRoamers.ShowDialog() == DialogResult.OK)
            {
                var adjacents = (List <Adjacent>)dataGridViewAdjacents.DataSource;

                if (adjacents != null)
                {
                    int  cnt   = 0;
                    bool found = false;

                    string roamerText   = "";
                    bool   firstDisplay = true;

                    if (searchRoamers.ReturnR != 0)
                    {
                        roamerText  += "R: " + searchRoamers.ReturnR;
                        firstDisplay = false;
                    }

                    if (searchRoamers.ReturnE != 0)
                    {
                        if (!firstDisplay)
                        {
                            roamerText += "  ";
                        }

                        roamerText  += "E: " + searchRoamers.ReturnE;
                        firstDisplay = false;
                    }

                    if (searchRoamers.ReturnL != 0)
                    {
                        if (!firstDisplay)
                        {
                            roamerText += "  ";
                        }

                        roamerText += "L: " + searchRoamers.ReturnL;
                    }

                    foreach (Adjacent adjacent in adjacents)
                    {
                        if (roamerText == adjacent.RoamerLocations)
                        {
                            dataGridViewAdjacents.FirstDisplayedScrollingRowIndex = cnt;
                            dataGridViewAdjacents.Rows[cnt].Selected = true;

                            found = true;

                            break;
                        }

                        cnt++;
                    }

                    if (!found)
                    {
                        MessageBox.Show("No match was found for your Roaming Pokemon.", "No Match", MessageBoxButtons.OK);
                    }
                }
            }
        }