Пример #1
0
 void linkImg_Tapped(object sender, TappedRoutedEventArgs e)
 {
     bo.Play();
     if (firstBlock == null)
     {
         firstImg   = sender as LinkImage;
         firstBlock = (sender as LinkImage).DataContext as LinkBlock;
         firstImg.StartFlash();
     }
     else
     {
         LinkBlock secondBlock = (sender as LinkImage).DataContext as LinkBlock;
         (sender as LinkImage).StopFlash();
         firstImg.StopFlash();
         if (linkmap.isCanDead(firstBlock, secondBlock))
         {
             firstBlock.IsAlive  = false;
             secondBlock.IsAlive = false;
             firstBlock          = null;
         }
         else
         {
             firstBlock = null;
         }
     }
 }
Пример #2
0
 private void btnHelpMe_Click(object sender, RoutedEventArgs e)
 {
     LinkBlock[] linkHelps = linkmap.HelpMe();
     if (linkHelps[0] != null)
     {
         LinkBlock b1 = linkHelps[0];
         LinkBlock b2 = linkHelps[1];
         LinkImage i1 = listImgs.First(linkImage => linkImage.Tag == b1.Tag);
         LinkImage i2 = listImgs.First(linkImage => linkImage.Tag == b2.Tag);
         i1.StartFlash();
         i2.StartFlash();
         b1 = null; b2 = null; linkHelps = null;
     }
     else
     {
         MessageDialog msd = new MessageDialog("没有可连了你完蛋了!");
         msd.ShowAsync();
     }
 }
Пример #3
0
        private async void Button_Click_2(object sender, RoutedEventArgs e)
        {
            LinkBlock[] linkHelps = linkmap.HelpMe();
            if (linkHelps[0] != null)
            {
                LinkBlock b1 = linkHelps[0];
                LinkBlock b2 = linkHelps[1];
                LinkImage i1 = listImgs.First(linkImage => linkImage.Tag == b1.Tag);
                LinkImage i2 = listImgs.First(linkImage => linkImage.Tag == b2.Tag);
                i1.StartFlash();
                i2.StartFlash();
                b1 = null; b2 = null; linkHelps = null;
            }
            else
            {
                MessageDialog msd = new MessageDialog("没有可连了你完蛋了!");
                await msd.ShowAsync();
            }
            //int i, j;
            //i = linkHelps[0].X;
            //j = linkHelps[0].Y;


            //foreach(var itemLinkImg in listImgs.Where(LinkImage =>LinkImage.Tag==b1.Tag))
            //{
            //    if (i1==null)
            //    {
            //        i1 = itemLinkImg as LinkImage;
            //    }
            //}
            // foreach(var itemLinkImg in listImgs.Where(LinkBlock=>LinkBlock.Tag==b2.Tag))
            // {
            //     if(i2==null)
            //     {
            //         i2 = itemLinkImg as LinkImage;
            //     }
            // }

            //i1=where(b1=>b1.Tag==i1.Tag)
            //where(x=>x.Tag==控件.Tag)
        }