Exemplo n.º 1
0
        private void RenderTile(Button btn, TileType tileType)
        {
            string res = tileType.GetImageResourceName();

            if (res != null)
            {
                if (!(btn.Content is Image))
                {
                    btn.Content = CreateImageForResource(res);
                }
                else
                {
                    ((Image)btn.Content).Visibility = Visibility.Visible;
                    ((Image)btn.Content).Source     = (BitmapImage)FindResource(res);
                }
            }
            else
            {
                if (!(btn.Content is Image))
                {
                    btn.Content = null;
                }
                else
                {
                    ((Image)btn.Content).Visibility = Visibility.Hidden;
                }
            }
        }
Exemplo n.º 2
0
        void tile_MouseLeftDown(object sender, MouseButtonEventArgs e)
        {
            Button  btn = (Button)sender;
            TileTag tag = (TileTag)btn.Tag;

            btn.Content = CreateImageForResource(selectedTileType.GetImageResourceName());

            bool levelChanged = level.SetTileTypeForTag(tag, selectedTileType);

            if (levelChanged)
            {
                this.progressSaved = false;
                UpdateUnsavedIndicator();
            }
        }