private void UpdateImage()
        {
            if (_dirIndex >= (int)_state.Dirs)
            {
                _dirIndex = 0;
            }
            if (_frameIndex >= _state.Frames)
            {
                _frameIndex = 0;
            }

            Bitmap      bm  = _state.GetBitmap(_dirIndex, _frameIndex);
            BitmapImage img = BitmapUtils.Bitmap2BitmapImage(bm);

            img.Freeze();
            image_viewer.Dispatcher.BeginInvoke(new Action(() =>
                                                           image_viewer.Source = img));
        }
Exemplo n.º 2
0
 private void ImageChanged(object sender, EventArgs e)
 {
     SetImage(BitmapUtils.Bitmap2BitmapImage(_state.GetImage(0, 0).GetBitmap()));
     //Task.Factory.StartNew(()=>SetImage(BitmapUtils.Bitmap2BitmapImage(_state.GetImage(0,0).GetBitmap())));
 }
Exemplo n.º 3
0
            public StateButton(FileEditor fileEditor, int stateIndex, DmiEXState state) : base(BitmapUtils.Bitmap2BitmapImage(state.GetImage(0, 0).GetBitmap()), $"\"{state.Id}\"")
            {
                StateIndex  = stateIndex;
                _state      = state;
                _fileEditor = fileEditor;

                //register click event
                Click           += Clicked;
                state.IdChanged += (sender, args) =>
                {
                    Label.Text = $"\"{state.Id}\"";
                };
                state.GetImage(0, 0).ImageChanged += ImageChanged;

                Button close_button = new Button
                {
                    Content = "Delete"
                };

                close_button.Click += DeleteState;

                Button duplicate_button = new Button
                {
                    Content = "Duplicate"
                };

                duplicate_button.Click += DuplicateState;

                StackPanel button_panel = new StackPanel
                {
                    Orientation = Orientation.Horizontal,
                    Children    =
                    {
                        duplicate_button,
                        close_button
                    }
                };

                StackPanel sp = (StackPanel)Content;

                sp.Children.Add(button_panel);
            }
 private void CreateBackground(object sender = null, EventArgs e = null)
 {
     image_background.Source = BitmapUtils.Bitmap2BitmapImage(
         BitmapHelper.CreateTransparentBackgroundMap(_state.Width * 2, _state.Height * 2));
 }