private void RegisterCommands(ImagePresentationViewModel viewModel)
        {
            viewModel.SaveCommand = UICommand.Regular(() =>
            {
                var dialog = new SaveFileDialog
                {
                    Filter = "PNG Image|*.png|Bitmap Image|*.bmp",
                    InitialDirectory = Settings.Instance.DefaultPath
                };
                var dialogResult = dialog.ShowDialog();
                if (dialogResult.HasValue && dialogResult.Value)
                {
                    var tmp = viewModel.Image;
                    using (var bmp = new Bitmap(tmp))
                    {
                        if (File.Exists(dialog.FileName))
                        {
                            File.Delete(dialog.FileName);
                        }

                        switch (dialog.FilterIndex)
                        {
                            case 0:
                                bmp.Save(dialog.FileName, ImageFormat.Png);
                                break;
                            case 1:
                                bmp.Save(dialog.FileName, ImageFormat.Bmp);
                                break;
                        }
                    }
                }
            });
        }
 public ImagePresentationController(string image, string text = "")
 {
     var viewModel = new ImagePresentationViewModel(image, text);
     RegisterCommands(viewModel);
     mView = new ImagePresentation {DataContext = viewModel};
     mView.ImageExpander.Expanded += ImageExpanderEvent;
     mView.ImageExpander.Collapsed += ImageExpanderEvent;
     mView.ShowDialog();
     UnregisterEvent();
 }