c#方法没有被调用

时间:2015-11-25 18:35:22

标签: c# methods

因为标题说我的方法“颜色”没有在多个地方被调用我试图设置一个断点但它只是跳过方法并继续进行,这里是方法代码

void Colors(int start, int end, string name)
{
    for (int j = 0; j <= 13; j++)
    {
        for (int p = start; p < end; p++)
        {
            if (Reserve[p].Contains("clubs"))
            {
                string a = j.ToString() + "_clubs";
                string b = j.ToString() + "-clubs";
                clubs++;
                if (Reserve[p].Contains(a) || Reserve[p].Contains(b))
                {
                    if (maxClubs <= j)
                    {
                        maxClubs = j;
                        if (Cvqt.Contains(maxClubs.ToString() + " " + "maxClub " + name))
                        {

                        }
                        else
                        {
                            Cvqt.Add(maxClubs + " " + "maxClub " + name);
                        }
                        if (Cvqt.Contains(clubs.ToString() + " " + "clubs" + name))
                        {

                        }
                        else
                        {
                            Cvqt.Add(clubs + " " + "clubs" + name);
                        }
                        /////////////////////////////
                    }
                }
            }
        }
    }
}

在这里我称之为方法

async void Shuffle()
{
    bool check = false;
    Bitmap backImage = new Bitmap("Assets\\Back\\Back.png");
    int horizontal = 580, vertical = 480;
    Random r = new Random();
    for (i = ImgLocation.Length; i > 0; i--)
    {
        int j = r.Next(i);
        var k = ImgLocation[j];
        ImgLocation[j] = ImgLocation[i - 1];
        ImgLocation[i - 1] = k;
    }
    for (i = 0; i < 17; i++)
    {
        Deck[i] = Image.FromFile(ImgLocation[i]);
        Reserve[i] = ImgLocation[i];
        Holder[i] = new PictureBox();
        Holder[i].SizeMode = PictureBoxSizeMode.StretchImage;
        Holder[i].Height = 130;
        Holder[i].Width = 80;
        this.Controls.Add(Holder[i]);
        Holder[i].Name = "pb" + i.ToString();
        await Task.Delay(200);
        if (i < 2)
        {
            Holder[i].Image = Deck[i];

            if (Holder[0].Tag != null)
            {
                Holder[1].Tag = Reserve[1];
            }
            Holder[0].Tag = Reserve[0];
            Holder[i].Location = new Point(horizontal, vertical);
            horizontal += Holder[i].Width;
            Colors(0, 1, "Player"); //it's just skipping this part here
        }
    }
}

1 个答案:

答案 0 :(得分:0)

刚刚为我做了清洁和重建解决方案,感谢Ron Beyer的快速回答!干杯..