Example #1
0
        public SparkleEventLog() : base("")
        {
            SetSizeRequest(480, (int)(Gdk.Screen.Default.Height * 0.8));

            int x = (int)(Gdk.Screen.Default.Width * 0.61);
            int y = (int)(Gdk.Screen.Default.Height * 0.5 - (HeightRequest * 0.5));

            Move(x, y);

            Resizable   = true;
            BorderWidth = 0;

            Title    = "Recent Changes";
            IconName = "folder-sparkleshare";

            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Controller.WindowClosed();
                args.RetVal = true;
            };

            KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape ||
                    (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w))
                {
                    Controller.WindowClosed();
                }
            };

            this.size_label = new Label()
            {
                Markup = "<b>Size:</b> …",
                Xalign = 0
            };

            this.history_label = new Label()
            {
                Markup = "<b>History:</b> …",
                Xalign = 0
            };

            HBox layout_sizes = new HBox(false, 12);

            layout_sizes.Add(this.size_label);
            layout_sizes.Add(this.history_label);

            VBox layout_vertical = new VBox(false, 0);

            this.spinner         = new SparkleSpinner(22);
            this.content_wrapper = new EventBox();
            this.scrolled_window = new ScrolledWindow();

            Gdk.Color white = new Gdk.Color();
            Gdk.Color.Parse("white", ref white);

            this.content_wrapper.ModifyBg(StateType.Normal, white);

            this.web_view = new WebView()
            {
                Editable = false
            };


            this.web_view.NavigationRequested += WebViewNavigationRequested;

            this.scrolled_window.Add(this.web_view);
            this.content_wrapper.Add(this.spinner);

            this.spinner.Start();

            this.layout_horizontal = new HBox(true, 0);
            this.layout_horizontal.PackStart(layout_sizes, true, true, 12);

            layout_vertical.PackStart(this.layout_horizontal, false, false, 0);
            layout_vertical.PackStart(this.content_wrapper, true, true, 0);

            Add(layout_vertical);


            Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate {
                    HideAll();

                    if (this.content_wrapper.Child != null)
                    {
                        this.content_wrapper.Remove(this.content_wrapper.Child);
                    }
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    ShowAll();
                    Present();
                });
            };

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Application.Invoke(delegate {
                    FileChooserDialog dialog = new FileChooserDialog("Restore from History",
                                                                     this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok);

                    dialog.CurrentName             = file_name;
                    dialog.DoOverwriteConfirmation = true;
                    dialog.SetCurrentFolder(target_folder_path);

                    if (dialog.Run() == (int)ResponseType.Ok)
                    {
                        Controller.SaveDialogCompleted(dialog.Filename);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }

                    dialog.Destroy();
                });
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Application.Invoke(delegate {
                    UpdateChooser(folders);
                });
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Application.Invoke(delegate {
                    this.combo_box.Sensitive = enabled;
                });
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Application.Invoke(delegate {
                    UpdateContent(html);
                });
            };

            Controller.ContentLoadingEvent += delegate {
                Application.Invoke(delegate {
                    if (this.content_wrapper.Child != null)
                    {
                        this.content_wrapper.Remove(this.content_wrapper.Child);
                    }

                    this.content_wrapper.Add(this.spinner);
                    this.spinner.Start();
                    this.content_wrapper.ShowAll();
                });
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Application.Invoke(delegate {
                    this.size_label.Markup    = "<b>Size:</b> " + size;
                    this.history_label.Markup = "<b>History:</b> " + history_size;

                    this.size_label.ShowAll();
                    this.history_label.ShowAll();
                });
            };
        }
Example #2
0
        public SparkleEventLog() : base("Recent Changes")
        {
            SetWmclass("SparkleShare", "SparkleShare");

            Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry(0);
            SetSizeRequest(480, (int)(monitor_0_rect.Height * 0.8));

            IconName   = "sparkleshare";
            this.pos_x = (int)(monitor_0_rect.Width * 0.61);
            this.pos_y = (int)(monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));

            this.size_label = new Label()
            {
                Xalign = 0, Markup = "<b>Size:</b> …"
            };
            this.history_label = new Label()
            {
                Xalign = 0, Markup = "<b>History:</b> …"
            };

            this.size_label.SetSizeRequest(100, 24);

            HBox layout_sizes = new HBox(false, 0);

            layout_sizes.PackStart(this.size_label, false, false, 12);
            layout_sizes.PackStart(this.history_label, false, false, 0);

            VBox layout_vertical = new VBox(false, 0);

            this.spinner         = new Spinner();
            this.spinner_wrapper = new VBox();
            this.content_wrapper = new EventBox();
            this.scrolled_window = new ScrolledWindow();

            this.content_wrapper.OverrideBackgroundColor(StateFlags.Normal,
                                                         new Gdk.RGBA()
            {
                Red = 1, Green = 1, Blue = 1, Alpha = 1
            });

            this.web_view = new WebView()
            {
                Editable = false
            };
            this.web_view.NavigationRequested += WebViewNavigationRequested;

            this.scrolled_window.Add(this.web_view);

            this.spinner_wrapper = new VBox(false, 0);
            this.spinner_wrapper.PackStart(new Label(""), true, true, 0);
            this.spinner_wrapper.PackStart(this.spinner, false, false, 0);
            this.spinner_wrapper.PackStart(new Label(""), true, true, 0);
            this.spinner.SetSizeRequest(24, 24);
            this.spinner.Start();

            this.content_wrapper.Add(this.spinner_wrapper);

            this.layout_horizontal = new HBox(false, 0);
            this.layout_horizontal.PackStart(layout_sizes, true, true, 12);

            layout_vertical.PackStart(this.layout_horizontal, false, false, 0);
            layout_vertical.PackStart(new HSeparator(), false, false, 0);
            layout_vertical.PackStart(this.content_wrapper, true, true, 0);

            Add(layout_vertical);


            Controller.HideWindowEvent += delegate {
                Application.Invoke(delegate {
                    Hide();

                    if (this.content_wrapper.Child != null)
                    {
                        this.content_wrapper.Remove(this.content_wrapper.Child);
                    }
                });
            };

            Controller.ShowWindowEvent += delegate {
                Application.Invoke(delegate {
                    Move(this.pos_x, this.pos_y);
                    ShowAll();
                    Present();
                });
            };

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Application.Invoke(delegate {
                    FileChooserDialog dialog = new FileChooserDialog("Restore from History", this,
                                                                     FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Save", ResponseType.Ok);

                    dialog.CurrentName             = file_name;
                    dialog.DoOverwriteConfirmation = true;
                    dialog.SetCurrentFolder(target_folder_path);

                    if (dialog.Run() == (int)ResponseType.Ok)
                    {
                        Controller.SaveDialogCompleted(dialog.Filename);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }

                    dialog.Destroy();
                });
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Application.Invoke(delegate { UpdateChooser(folders); });
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Application.Invoke(delegate { this.combo_box.Sensitive = enabled; });
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Application.Invoke(delegate { UpdateContent(html); });
            };

            Controller.ContentLoadingEvent += delegate {
                Application.Invoke(delegate {
                    if (this.content_wrapper.Child != null)
                    {
                        this.content_wrapper.Remove(this.content_wrapper.Child);
                    }

                    this.content_wrapper.Add(this.spinner_wrapper);
                    this.spinner.Start();
                });
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Application.Invoke(delegate {
                    this.size_label.Markup    = "<b>Size</b>  " + size;
                    this.history_label.Markup = "<b>History</b>  " + history_size;
                });
            };

            DeleteEvent += delegate(object o, DeleteEventArgs args) {
                Controller.WindowClosed();
                args.RetVal = true;
            };

            KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                if (args.Event.Key == Gdk.Key.Escape ||
                    (args.Event.State == Gdk.ModifierType.ControlMask && args.Event.Key == Gdk.Key.w))
                {
                    Controller.WindowClosed();
                }
            };
        }
Example #3
0
        public SparkleEventLogWindow()
        {
            InitializeComponent();


            Background         = new SolidColorBrush(Color.FromRgb(240, 240, 240));
            AllowsTransparency = false;
            Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            WriteOutImages();

            this.label_Size.Content    = "Size: " + Controller.Size;
            this.label_History.Content = "History: " + Controller.HistorySize;

            this.webbrowser.ObjectForScripting = new SparkleScriptingObject();

            // Disable annoying IE clicking sound
            CoInternetSetFeatureEnabled(21, 0x00000002, true);

            Closing += this.OnClosing;

            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    Show();
                    Activate();
                    BringIntoView();
                }));
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action)(() => {
                    Hide();
                    this.spinner.Visibility = Visibility.Visible;
                    this.webbrowser.Visibility = Visibility.Collapsed;
                }));
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Dispatcher.BeginInvoke((Action)(() => {
                    this.label_Size.Content = "Size: " + size;
                    this.label_History.Content = "History: " + history_size;
                }));
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Dispatcher.BeginInvoke((Action)(() =>
                                                UpdateChooser(folders))
                                       );
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Dispatcher.BeginInvoke((Action)(() =>
                                                this.combobox.IsEnabled = enabled
                                                ));
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Dispatcher.BeginInvoke((Action)(() => {
                    UpdateContent(html);

                    this.spinner.Visibility = Visibility.Collapsed;
                    this.webbrowser.Visibility = Visibility.Visible;
                }));
            };

            Controller.ContentLoadingEvent += () => this.Dispatcher.BeginInvoke(
                (Action)(() => {
                this.spinner.Visibility = Visibility.Visible;
                this.spinner.Start();
                this.webbrowser.Visibility = Visibility.Collapsed;
            }));

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Dispatcher.BeginInvoke((Action)(() => {
                    SaveFileDialog dialog = new SaveFileDialog()
                    {
                        FileName = file_name,
                        InitialDirectory = target_folder_path,
                        Title = "Restore from History",
                        DefaultExt = "." + Path.GetExtension(file_name),
                        Filter = "All Files|*.*"
                    };

                    bool?result = dialog.ShowDialog(this);

                    if (result == true)
                    {
                        Controller.SaveDialogCompleted(dialog.FileName);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }
                }));
            };
        }
Example #4
0
        public SparkleEventLog() : base()
        {
            Title    = "Recent Changes";
            Delegate = new SparkleEventsDelegate();

            int min_width  = 480;
            int min_height = 640;
            int height     = (int)(NSScreen.MainScreen.Frame.Height * 0.85);

            float x = (float)(NSScreen.MainScreen.Frame.Width * 0.61);
            float y = (float)(NSScreen.MainScreen.Frame.Height * 0.5 - (height * 0.5));

            SetFrame(
                new RectangleF(
                    new PointF(x, y),
                    new SizeF(min_width, height)),
                true);

            StyleMask = (NSWindowStyle.Closable | NSWindowStyle.Miniaturizable |
                         NSWindowStyle.Titled | NSWindowStyle.Resizable);

            MinSize        = new SizeF(min_width, min_height);
            HasShadow      = true;
            BackingType    = NSBackingStore.Buffered;
            TitlebarHeight = Frame.Height - ContentView.Frame.Height;
            Level          = NSWindowLevel.Floating;


            this.web_view = new WebView(new RectangleF(0, 0, 481, 579), "", "")
            {
                Frame = new RectangleF(new PointF(0, 0),
                                       new SizeF(ContentView.Frame.Width, ContentView.Frame.Height - 39))
            };

            this.web_view.Preferences.PlugInsEnabled = false;

            this.cover = new NSBox()
            {
                Frame = new RectangleF(
                    new PointF(-1, -1),
                    new SizeF(Frame.Width + 2, this.web_view.Frame.Height + 1)),
                FillColor  = NSColor.White,
                BorderType = NSBorderType.NoBorder,
                BoxType    = NSBoxType.NSBoxCustom
            };

            this.hidden_close_button = new NSButton()
            {
                KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask,
                KeyEquivalent             = "w"
            };

            this.hidden_close_button.Activated += delegate {
                Controller.WindowClosed();
            };


            this.size_label = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(0, ContentView.Frame.Height - 31),
                    new SizeF(60, 20)),
                StringValue = "Size:"
            };

            this.size_label_value = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(60, ContentView.Frame.Height - 27),
                    new SizeF(60, 20)),
                StringValue = "…",
                Font        = NSFont.FromFontName(SparkleUI.FontName + " Bold", NSFont.SystemFontSize)
            };


            this.history_label = new NSTextField()
            {
                Alignment       = NSTextAlignment.Right,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(130, ContentView.Frame.Height - 31),
                    new SizeF(60, 20)),
                StringValue = "History:"
            };

            this.history_label_value = new NSTextField()
            {
                Alignment       = NSTextAlignment.Left,
                BackgroundColor = NSColor.WindowBackground,
                Bordered        = false,
                Editable        = false,
                Frame           = new RectangleF(
                    new PointF(190, ContentView.Frame.Height - 27),
                    new SizeF(60, 20)
                    ),
                StringValue = "…",
                Font        = NSFont.FromFontName(SparkleUI.FontName + " Bold", NSFont.SystemFontSize)
            };

            this.popup_button = new NSPopUpButton()
            {
                Frame = new RectangleF(
                    new PointF(ContentView.Frame.Width - 156 - 12, ContentView.Frame.Height - 33),
                    new SizeF(156, 26)),
                PullsDown = false
            };

            this.background = new NSBox()
            {
                Frame = new RectangleF(
                    new PointF(-1, -1),
                    new SizeF(Frame.Width + 2, this.web_view.Frame.Height + 2)),
                FillColor   = NSColor.White,
                BorderColor = NSColor.LightGray,
                BoxType     = NSBoxType.NSBoxCustom
            };

            this.progress_indicator = new NSProgressIndicator()
            {
                Frame = new RectangleF(
                    new PointF(Frame.Width / 2 - 10, this.web_view.Frame.Height / 2 + 10),
                    new SizeF(20, 20)),
                Style = NSProgressIndicatorStyle.Spinning
            };

            this.progress_indicator.StartAnimation(this);

            ContentView.AddSubview(this.size_label);
            ContentView.AddSubview(this.size_label_value);
            ContentView.AddSubview(this.history_label);
            ContentView.AddSubview(this.history_label_value);
            ContentView.AddSubview(this.popup_button);
            ContentView.AddSubview(this.progress_indicator);
            ContentView.AddSubview(this.background);
            ContentView.AddSubview(this.hidden_close_button);

            (Delegate as SparkleEventsDelegate).WindowResized += delegate(SizeF new_window_size) {
                Program.Controller.Invoke(() => Relayout(new_window_size));
            };


            // Hook up the controller events
            Controller.HideWindowEvent += delegate {
                Program.Controller.Invoke(() => {
                    this.progress_indicator.Hidden = true;
                    PerformClose(this);
                });
            };

            Controller.ShowWindowEvent += delegate {
                Program.Controller.Invoke(() => OrderFrontRegardless());
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Program.Controller.Invoke(() => UpdateChooser(folders));
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Program.Controller.Invoke(() => { this.popup_button.Enabled = enabled; });
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Program.Controller.Invoke(() => {
                    this.cover.RemoveFromSuperview();
                    this.progress_indicator.Hidden = true;
                    UpdateContent(html);
                });
            };

            Controller.ContentLoadingEvent += delegate {
                Program.Controller.Invoke(() => {
                    this.web_view.RemoveFromSuperview();
                    // FIXME: Hack to hide that the WebView sometimes doesn't disappear
                    ContentView.AddSubview(this.cover);
                    this.progress_indicator.Hidden = false;
                    this.progress_indicator.StartAnimation(this);
                });
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Program.Controller.Invoke(() => {
                    this.size_label_value.StringValue    = size;
                    this.history_label_value.StringValue = history_size;
                });
            };

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Program.Controller.Invoke(() => {
                    NSSavePanel panel = new NSSavePanel()
                    {
                        DirectoryUrl         = new NSUrl(target_folder_path, true),
                        NameFieldStringValue = file_name,
                        ParentWindow         = this,
                        Title = "Restore from History",
                        PreventsApplicationTerminationWhenModal = false
                    };

                    if ((NSPanelButtonType)panel.RunModal() == NSPanelButtonType.Ok)
                    {
                        string target_file_path = Path.Combine(panel.DirectoryUrl.RelativePath, panel.NameFieldStringValue);
                        Controller.SaveDialogCompleted(target_file_path);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }
                });
            };
        }
Example #5
0
        public SparkleEventLog()
        {
            Title              = "Recent Changes";
            Height             = 640;
            Width              = 480;
            ResizeMode         = ResizeMode.NoResize; // TODO
            Background         = new SolidColorBrush(Color.FromRgb(240, 240, 240));
            AllowsTransparency = false;
            Icon = SparkleUIHelpers.GetImageSource("sparkleshare-app", "ico");

            int x = (int)(SystemParameters.PrimaryScreenWidth * 0.61);
            int y = (int)(SystemParameters.PrimaryScreenHeight * 0.5 - (Height * 0.5));

            WindowStartupLocation = WindowStartupLocation.Manual;
            Left = x;
            Top  = y;

            WriteOutImages();

            Label size_label = new Label()
            {
                Content    = "Size:",
                FontWeight = FontWeights.Bold
            };

            this.size_label_value = new Label()
            {
                Content = Controller.Size
            };

            size_label.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            Rect size_label_rect = new Rect(size_label.DesiredSize);

            Label history_label = new Label()
            {
                Content    = "History:",
                FontWeight = FontWeights.Bold
            };

            this.history_label_value = new Label()
            {
                Content = Controller.HistorySize,
            };

            history_label.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
            Rect history_label_rect = new Rect(history_label.DesiredSize);

            Shapes.Rectangle line = new Shapes.Rectangle()
            {
                Width  = Width,
                Height = 1,
                Fill   = new SolidColorBrush(Color.FromRgb(223, 223, 223))
            };

            Shapes.Rectangle background = new Shapes.Rectangle()
            {
                Width  = Width,
                Height = Height,
                Fill   = new SolidColorBrush(Color.FromRgb(250, 250, 250))
            };

            this.web_browser = new WebBrowser()
            {
                Width  = Width - 6,
                Height = Height - 64
            };

            this.web_browser.ObjectForScripting = new SparkleScriptingObject();


            spinner = new SparkleSpinner(22);

            // Disable annoying IE clicking sound
            CoInternetSetFeatureEnabled(21, 0x00000002, true);


            this.canvas = new Canvas();
            Content     = this.canvas;

            this.canvas.Children.Add(size_label);
            Canvas.SetLeft(size_label, 24);
            Canvas.SetTop(size_label, 4);

            this.canvas.Children.Add(this.size_label_value);
            Canvas.SetLeft(this.size_label_value, 22 + size_label_rect.Width);
            Canvas.SetTop(this.size_label_value, 4);

            this.canvas.Children.Add(history_label);
            Canvas.SetLeft(history_label, 130);
            Canvas.SetTop(history_label, 4);

            this.canvas.Children.Add(this.history_label_value);
            Canvas.SetLeft(this.history_label_value, 130 + history_label_rect.Width);
            Canvas.SetTop(this.history_label_value, 4);

            this.canvas.Children.Add(background);
            Canvas.SetLeft(background, 0);
            Canvas.SetTop(background, 36);

            this.canvas.Children.Add(spinner);
            Canvas.SetLeft(spinner, (Width / 2) - 15);
            Canvas.SetTop(spinner, (Height / 2) - 22);

            this.canvas.Children.Add(line);
            Canvas.SetLeft(line, 0);
            Canvas.SetTop(line, 35);


            Closing += Close;

            Controller.ShowWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Show();
                    Activate();
                    BringIntoView();
                });
            };

            Controller.HideWindowEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    Hide();

                    if (this.canvas.Children.Contains(this.web_browser))
                    {
                        this.canvas.Children.Remove(this.web_browser);
                    }
                });
            };

            Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.size_label_value.Content = size;
                    this.size_label_value.UpdateLayout();

                    this.history_label_value.Content = history_size;
                    this.history_label_value.UpdateLayout();
                });
            };

            Controller.UpdateChooserEvent += delegate(string [] folders) {
                Dispatcher.BeginInvoke((Action) delegate {
                    UpdateChooser(folders);
                });
            };

            Controller.UpdateChooserEnablementEvent += delegate(bool enabled) {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.combo_box.IsEnabled = enabled;
                });
            };

            Controller.UpdateContentEvent += delegate(string html) {
                Dispatcher.BeginInvoke((Action) delegate {
                    UpdateContent(html);
                });
            };

            Controller.ContentLoadingEvent += delegate {
                Dispatcher.BeginInvoke((Action) delegate {
                    this.spinner.Start();

                    if (this.canvas.Children.Contains(this.web_browser))
                    {
                        this.canvas.Children.Remove(this.web_browser);
                    }
                });
            };

            Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) {
                Dispatcher.BeginInvoke((Action) delegate {
                    SaveFileDialog dialog = new SaveFileDialog()
                    {
                        FileName         = file_name,
                        InitialDirectory = target_folder_path,
                        Title            = "Restore from History",
                        DefaultExt       = "." + Path.GetExtension(file_name),
                        Filter           = "All Files|*.*"
                    };

                    Nullable <bool> result = dialog.ShowDialog(this);

                    if (result == true)
                    {
                        Controller.SaveDialogCompleted(dialog.FileName);
                    }
                    else
                    {
                        Controller.SaveDialogCancelled();
                    }
                });
            };
        }