コード例 #1
0
        private void FlipRow()
        {
            if (this.rowIndices.Count == 0)
            {
                this.FillRowIndicesCollection();
                this.pictureCurrentFrameImage = this.GetRandomImageSource();
            }

            int rowIndex = this.rowIndices[this.randomGenerator.Next(this.rowIndices.Count)];

            for (int i = 0; i < 3; ++i)
            {
                int imagePartIndex        = (rowIndex * 3) + i;
                CustomMosaicTilePart tile = this.tilesPanel.Children[imagePartIndex] as CustomMosaicTilePart;
                tile.SizeFactor     = 3;
                tile.ImagePartIndex = imagePartIndex;

                if (tile.IsContentDisplayed)
                {
                    tile.Flip(null);
                }
                else
                {
                    tile.Flip(this.pictureCurrentFrameImage);
                }
            }

            this.rowIndices.Remove(rowIndex);
        }
コード例 #2
0
        private void ProcessIndividualTile()
        {
            this.pictureFrameCounter++;

            int randomIndex           = this.randomGenerator.Next(this.tilesPanel.Children.Count);
            CustomMosaicTilePart tile = this.tilesPanel.Children[randomIndex] as CustomMosaicTilePart;

            tile.ImagePartIndex = null;

            if (tile.IsContentDisplayed)
            {
                tile.Flip(null);
            }
            else
            {
                tile.Flip(this.GetRandomImageSource());
            }
        }
コード例 #3
0
        private void ProcessFrame()
        {
            if (this.pictureFrameIndices.Count == 0)
            {
                int randomCorner = this.randomGenerator.Next(this.cornersIndices.Length / this.cornersIndices.Rank);
                this.pictureFrameIndices      = this.cornersIndices[randomCorner].ToList <int>();
                this.pictureCurrentFrameImage = this.GetRandomImageSource();
                for (int i = 0; i < this.pictureFrameIndices.Count; ++i)
                {
                    this.pictureFrameFlipHistory[i] = false;
                }
            }

            int randomIndexIndex = this.randomGenerator.Next(this.pictureFrameIndices.Count);

            while (this.pictureFrameFlipHistory[randomIndexIndex])
            {
                randomIndexIndex = this.randomGenerator.Next(this.pictureFrameIndices.Count);
            }
            this.pictureFrameFlipHistory[randomIndexIndex] = true;

            int randomTileIndex = this.pictureFrameIndices[randomIndexIndex];

            CustomMosaicTilePart frameTile = this.tilesPanel.Children[randomTileIndex] as CustomMosaicTilePart;

            frameTile.SizeFactor     = 2;
            frameTile.ImagePartIndex = randomIndexIndex;

            frameTile.Flip(this.pictureCurrentFrameImage);

            bool allFlipped = true;

            foreach (KeyValuePair <int, bool> pair in this.pictureFrameFlipHistory)
            {
                allFlipped = allFlipped && pair.Value;
            }
            if (allFlipped)
            {
                this.pictureFrameCounter = 0;
                this.pictureFrameFlipHistory.Clear();
                this.pictureFrameIndices.Clear();
            }
        }