Example #1
0
        private void MenuSelectTexturePack_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("这是个正在试验的功能,请不要报告有关任何该功能的bug");
            var frmTexturepack = new FrmTexturepack();

            frmTexturepack.ShowDialog();
            Texturepack.TexturePackEntity texture = frmTexturepack.GetSelected();
            var b      = new ImageBrush();
            var bitmap = new BitmapImage();

            bitmap.BeginInit();
            bitmap.StreamSource = texture.GuiBackground;
            bitmap.EndInit();
            b.ImageSource   = bitmap;
            b.ViewportUnits = BrushMappingMode.Absolute;
            b.Viewport      = new Rect(0, 0, bitmap.Width, bitmap.Height);
            b.Stretch       = Stretch.None;
            b.TileMode      = TileMode.Tile;
            var button = new ImageBrush {
                ImageSource = texture.GuiButton.Source
            };

            var da = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(0.25));

            this.BeginAnimation(UIElement.OpacityProperty, da);
            this.Container.Background = b;
            btnStart.Background       = button;
            da = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
            this.BeginAnimation(UIElement.OpacityProperty, da);
        }
Example #2
0
        private void MenuSelectTexturePack_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("这是个正在试验的功能,请不要报告有关任何该功能的bug");
            var frmTexturepack = new FrmTexturepack();
            frmTexturepack.ShowDialog();
            Texturepack.TexturePackEntity texture = frmTexturepack.GetSelected();
            var b = new ImageBrush();
            var bitmap = new BitmapImage();
            bitmap.BeginInit();
            bitmap.StreamSource = texture.GuiBackground;
            bitmap.EndInit();
            b.ImageSource = bitmap;
            b.ViewportUnits = BrushMappingMode.Absolute;
            b.Viewport = new Rect(0, 0, bitmap.Width, bitmap.Height);
            b.Stretch = Stretch.None;
            b.TileMode = TileMode.Tile;
            var button = new ImageBrush {ImageSource = texture.GuiButton.Source};

            var da = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(0.25));
            this.BeginAnimation(UIElement.OpacityProperty, da);
            this.Container.Background = b;
            btnStart.Background = button;
            da = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.25));
            this.BeginAnimation(UIElement.OpacityProperty, da);
        }