Skip to content

Commit e9993f0

Browse files
authored
[DYN-7466] Navigate-to-corresponding-node/group-by-clicking-it-in-the-TuneUp-list (#15504)
1 parent cebc4bf commit e9993f0

File tree

6 files changed

+54
-15
lines changed

6 files changed

+54
-15
lines changed

src/DynamoCoreWpf/Properties/Resources.Designer.cs

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DynamoCoreWpf/Properties/Resources.en-US.resx

+3
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,9 @@ You can always redownload the package.</value>
13231323
</data>
13241324
<data name="MessageFailedToFindNodeById" xml:space="preserve">
13251325
<value>No node could be found with that Id.</value>
1326+
</data>
1327+
<data name="MessageFailedToFindGroupById" xml:space="preserve">
1328+
<value>No group could be found with that Id.</value>
13261329
</data>
13271330
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
13281331
<value>Error opening corrupted file: {0}</value>

src/DynamoCoreWpf/Properties/Resources.resx

+3
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,9 @@ Do you want to install the latest Dynamo update?</value>
19151915
</data>
19161916
<data name="MessageFailedToFindNodeById" xml:space="preserve">
19171917
<value>No node could be found with that Id.</value>
1918+
</data>
1919+
<data name="MessageFailedToFindGroupById" xml:space="preserve">
1920+
<value>No group could be found with that Id.</value>
19181921
</data>
19191922
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
19201923
<value>Error opening corrupted file: {0}</value>

src/DynamoCoreWpf/PublicAPI.Unshipped.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4856,6 +4856,7 @@ static Dynamo.Wpf.Properties.Resources.MessageFailedToDelete.get -> string
48564856
static Dynamo.Wpf.Properties.Resources.MessageFailedToDownloadPackage.get -> string
48574857
static Dynamo.Wpf.Properties.Resources.MessageFailedToDownloadPackageVersion.get -> string
48584858
static Dynamo.Wpf.Properties.Resources.MessageFailedToFindNodeById.get -> string
4859+
static Dynamo.Wpf.Properties.Resources.MessageFailedToFindGroupById.get -> string
48594860
static Dynamo.Wpf.Properties.Resources.MessageFailedToOpenCorruptedFile.get -> string
48604861
static Dynamo.Wpf.Properties.Resources.MessageFailedToSaveAsImage.get -> string
48614862
static Dynamo.Wpf.Properties.Resources.MessageFailedToUnload.get -> string

src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs

+19-15
Original file line numberDiff line numberDiff line change
@@ -2736,31 +2736,35 @@ internal void FocusCustomNodeWorkspace(Guid symbol, bool silent = false)
27362736
/// </summary>
27372737
/// <param name="e"></param>
27382738
/// <param name="forceShowElement"></param>
2739-
internal void ShowElement(NodeModel e, bool forceShowElement = true)
2739+
internal void ShowElement(ModelBase e, bool forceShowElement = true)
27402740
{
27412741
if (HomeSpace.RunSettings.RunType == RunType.Automatic && forceShowElement)
27422742
return;
27432743

2744-
if (!model.CurrentWorkspace.Nodes.Contains(e))
2744+
// Handle NodeModel
2745+
if (e is NodeModel node)
27452746
{
2746-
if (HomeSpace != null && HomeSpace.Nodes.Contains(e))
2747+
if (!model.CurrentWorkspace.Nodes.Contains(e))
27472748
{
2748-
//Show the homespace
2749-
model.CurrentWorkspace = HomeSpace;
2750-
}
2751-
else
2752-
{
2753-
foreach (
2754-
var customNodeWorkspace in
2755-
model.CustomNodeManager.LoadedWorkspaces.Where(
2756-
customNodeWorkspace => customNodeWorkspace.Nodes.Contains(e)))
2749+
if (HomeSpace != null && HomeSpace.Nodes.Contains(e))
27572750
{
2758-
FocusCustomNodeWorkspace(customNodeWorkspace.CustomNodeId);
2759-
break;
2751+
//Show the homespace
2752+
model.CurrentWorkspace = HomeSpace;
2753+
}
2754+
else
2755+
{
2756+
foreach (
2757+
var customNodeWorkspace in
2758+
model.CustomNodeManager.LoadedWorkspaces.Where(
2759+
customNodeWorkspace => customNodeWorkspace.Nodes.Contains(e)))
2760+
{
2761+
FocusCustomNodeWorkspace(customNodeWorkspace.CustomNodeId);
2762+
break;
2763+
}
27602764
}
27612765
}
27622766
}
2763-
2767+
// Center the view on the model
27642768
this.CurrentSpaceViewModel.OnRequestCenterViewOnElement(this, new ModelEventArgs(e));
27652769
}
27662770

src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs

+19
Original file line numberDiff line numberDiff line change
@@ -1646,6 +1646,25 @@ private void FindById(object id)
16461646
{
16471647
DynamoViewModel.Model.Logger.Log(Wpf.Properties.Resources.MessageFailedToFindNodeById);
16481648
}
1649+
1650+
try
1651+
{
1652+
var group = DynamoViewModel.Model.CurrentWorkspace.Annotations.FirstOrDefault(x => x.GUID.ToString() == id.ToString());
1653+
1654+
if (group != null)
1655+
{
1656+
//select the element
1657+
DynamoSelection.Instance.ClearSelection();
1658+
DynamoSelection.Instance.Selection.Add(group);
1659+
1660+
//focus on the element
1661+
DynamoViewModel.ShowElement(group);
1662+
}
1663+
}
1664+
catch
1665+
{
1666+
DynamoViewModel.Model.Logger.Log(Wpf.Properties.Resources.MessageFailedToFindGroupById);
1667+
}
16491668
}
16501669

16511670
private static bool CanFindById(object id)

0 commit comments

Comments
 (0)