Skip to content
Open
6 changes: 3 additions & 3 deletions doc/distrib/xml/en-US/DSCoreNodes.xml
Comment thread
edwin-vasquez-ucaldas marked this conversation as resolved.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,11 @@
<MenuItem Name="saveThisButton"
Command="{Binding ShowSaveDialogIfNeededAndSaveResultCommand}"
Header="{x:Static p:Resources.DynamoViewFileMenuSave}"
InputGestureText="Ctrl + S"
IsEnabled="False" />
Comment thread
edwin-vasquez-ucaldas marked this conversation as resolved.
InputGestureText="Ctrl + S" />
<MenuItem Name="saveButton"
Command="{Binding ShowSaveDialogAndSaveResultCommand}"
Header="{x:Static p:Resources.DynamoViewFileMenuSaveAs}"
InputGestureText="Ctrl + Shift + S"
IsEnabled="False" />
InputGestureText="Ctrl + Shift + S" />
<Separator />
<MenuItem Name="importLibrary"
Command="{Binding Path=DataContext.ImportLibraryCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls:DynamoView}}}"
Expand Down
11 changes: 0 additions & 11 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,6 @@ void DynamoView_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

private void DynamoViewModel_RequestEnableShortcutBarItems(bool enable)
{
if (!(saveThisButton is null))
{
saveThisButton.IsEnabled = enable;
saveButton.IsEnabled = enable;
}
if (!(exportMenu is null))
{
exportMenu.IsEnabled = enable;
Comment thread
edwin-vasquez-ucaldas marked this conversation as resolved.
Expand Down Expand Up @@ -471,12 +466,6 @@ private void DynamoViewModel_RequestEnableShortcutBarItems(bool enable)

private void OnWorkspaceOpened(WorkspaceModel workspace)
{
if (!(saveThisButton is null))
{
saveThisButton.IsEnabled = true;
saveButton.IsEnabled = true;
}

if (!(exportMenu is null))
{
exportMenu.IsEnabled = true;
Expand Down
25 changes: 25 additions & 0 deletions test/DynamoCoreWpfTests/DynamoViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,31 @@ public void TestHomeWorkspaceClosedBeforeCustomNode()
Assert.IsTrue(View.saveButton.IsEnabled);
}

[Test]
public void WhenDynamoLaunchesThenSaveMenuItemsAreEnabled()
{
// Regression test for DYN-10717: the File > Save and Save As menu items were
// hardcoded IsEnabled="False" in XAML and only re-enabled via events that never
// fire for the workspace created at startup (it is never "Opened" from a file).
Assert.IsTrue(View.saveThisButton.IsEnabled);
Assert.IsTrue(View.saveButton.IsEnabled);
}

[Test]
public void WhenLastWorkspaceIsClosedThenSaveMenuItemsRemainEnabled()
{
// Regression test for DYN-10717: closing the only open workspace returns to the
// start page; the Save/Save As menu items should remain enabled for the fresh
// workspace left behind (Ctrl+S already worked in this state before the fix).
DynamoModel.IsTestMode = false;
ViewModel.CloseHomeWorkspaceCommand.Execute(null);
DynamoModel.IsTestMode = true;

Assert.IsTrue(ViewModel.ShowStartPage);
Assert.IsTrue(View.saveThisButton.IsEnabled);
Assert.IsTrue(View.saveButton.IsEnabled);
}

[Test]
public void ElementBinding_SaveAs()
{
Expand Down
Loading