Skip to content

Commit

Permalink
DYN-5437 Export image button shortcut (#13550)
Browse files Browse the repository at this point in the history
* Insert the export command in the shortcut view model

* remove test method
  • Loading branch information
filipeotero authored Nov 21, 2022
1 parent 3e9ebc0 commit cf1f5c1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Collections.ObjectModel;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Media;
Expand Down Expand Up @@ -39,15 +39,15 @@ public ObservableCollection<ShortcutBarItem> ShortcutBarRightSideItems
/// Construct a ShortcutToolbar.
/// </summary>
/// <param name="updateManager"></param>
public ShortcutToolbar(IUpdateManager updateManager)
public ShortcutToolbar(DynamoViewModel dynamoViewModel)
{
shortcutBarItems = new ObservableCollection<ShortcutBarItem>();
shortcutBarRightSideItems = new ObservableCollection<ShortcutBarItem>();

InitializeComponent();
UpdateControl.DataContext = updateManager;
UpdateControl.DataContext = dynamoViewModel.Model.UpdateManager;

var shortcutToolbar = new ShortcutToolbarViewModel();
var shortcutToolbar = new ShortcutToolbarViewModel(dynamoViewModel);
DataContext = shortcutToolbar;
}

Expand Down
13 changes: 11 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/ShortcutToolbarViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using Dynamo.ViewModels;
using Dynamo.UI.Commands;
using Dynamo.ViewModels;
using System;
using System.Windows;

namespace Dynamo.Wpf.ViewModels.Core
{
internal class ShortcutToolbarViewModel : ViewModelBase
{
public ShortcutToolbarViewModel()
public ShortcutToolbarViewModel(DynamoViewModel dynamoViewModel)
{
NotificationsNumber = 0;
ShowSaveImageDialogAndSaveResultCommand = new DelegateCommand(dynamoViewModel.ShowSaveImageDialogAndSaveResult);
}

private int notificationsNumber;
Expand Down Expand Up @@ -36,5 +39,11 @@ public bool IsNotificationsCounterVisible
return true;
}
}


/// <summary>
/// Exports an image from the user's 3D background or workpace
/// </summary>
public DelegateCommand ShowSaveImageDialogAndSaveResultCommand { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ private void InitializeLogin()

private void InitializeShortcutBar()
{
shortcutBar = new ShortcutToolbar(this.dynamoViewModel.Model.UpdateManager) { Name = "ShortcutToolbar" };
shortcutBar = new ShortcutToolbar(this.dynamoViewModel) { Name = "ShortcutToolbar" };

var newScriptButton = new ShortcutBarItem
{
Expand Down

0 comments on commit cf1f5c1

Please sign in to comment.