Skip to content

Commit 4cba98d

Browse files
github-actions[bot]johnpiersonclaude
authored
[Cherry-pick] DYN-10639: Revert DYN-8575 to fix pop-ups flashing then disappearing (#17179)
Co-authored-by: john pierson <john.pierson@autodesk.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 1c89eeb commit 4cba98d

2 files changed

Lines changed: 4 additions & 49 deletions

File tree

src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,11 +1592,7 @@ private void HidePopupWhenWindowDeactivated(object obj)
15921592
{
15931593
var workspace = this.ChildOfType<WorkspaceView>();
15941594
if (workspace != null)
1595-
{
15961595
workspace.HideAllPopUp(obj);
1597-
workspace.DestroyPortContextMenu();
1598-
}
1599-
16001596
}
16011597

16021598
private void TrackStartupAnalytics()

src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml.cs

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ public WorkspaceView()
108108

109109
InitializeComponent();
110110

111-
Loaded += WorkspaceView_Loaded;
112-
Unloaded += WorkspaceView_Unloaded;
113-
114-
LostFocus += WorkspaceView_LostFocus;
115-
116111
DataContextChanged += OnWorkspaceViewDataContextChanged;
117112

118113
// view of items to drag
@@ -124,11 +119,6 @@ public WorkspaceView()
124119
dictionaries.Add(SharedDictionaryManager.DataTemplatesDictionary);
125120
}
126121

127-
private void WorkspaceView_LostFocus(object sender, RoutedEventArgs e)
128-
{
129-
DestroyPortContextMenu();
130-
}
131-
132122
void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
133123
{
134124
switch (e.PropertyName)
@@ -914,47 +904,20 @@ private void OnCanvasMouseDown(object sender, MouseButtonEventArgs e)
914904
InCanvasSearchBar.IsOpen = false;
915905
if (GeoScalingPopup != null)
916906
GeoScalingPopup.IsOpen = false;
917-
918-
if (PortContextMenu.IsOpen) DestroyPortContextMenu();
907+
908+
if(PortContextMenu.IsOpen) DestroyPortContextMenu();
919909

920910
if (!ViewModel.IsConnecting && !ViewModel.IsPanning && e.MiddleButton == MouseButtonState.Pressed)
921911
{
922912
ViewModel.RequestTogglePanMode();
923913
}
924914
}
925915

926-
private void WorkspaceView_Loaded(object sender, RoutedEventArgs e)
927-
{
928-
var ownerWindow = Window.GetWindow(this);
929-
if (ownerWindow != null)
930-
{
931-
ownerWindow.Deactivated += OwnerWindow_Deactivated;
932-
}
933-
}
934-
935-
private void WorkspaceView_Unloaded(object sender, RoutedEventArgs e)
936-
{
937-
var ownerWindow = Window.GetWindow(this);
938-
if (ownerWindow != null)
939-
{
940-
ownerWindow.Deactivated -= OwnerWindow_Deactivated;
941-
}
942-
}
943-
944-
/// <summary>
945-
/// When the Dynamo/Revit window loses focus, close the port context menu
946-
/// so it doesn't float above other windows.
947-
/// </summary>
948-
private void OwnerWindow_Deactivated(object sender, EventArgs e)
949-
{
950-
DestroyPortContextMenu();
951-
}
952-
953916
/// <summary>
954917
/// Closes the port's context menu and sets its references to null.
955918
/// </summary>
956-
internal void DestroyPortContextMenu() => PortContextMenu.IsOpen = false;
957-
919+
private void DestroyPortContextMenu() => PortContextMenu.IsOpen = false;
920+
958921
private void OnMouseRelease(object sender, MouseButtonEventArgs e)
959922
{
960923
if (e == null) return; // in certain bizarre cases, e can be null
@@ -1296,10 +1259,6 @@ private void OnGeometryScaling_Click(object sender, RoutedEventArgs e)
12961259
public void Dispose()
12971260
{
12981261
RemoveViewModelsubscriptions(ViewModel);
1299-
1300-
Loaded -= WorkspaceView_Loaded;
1301-
Unloaded -= WorkspaceView_Unloaded;
1302-
LostFocus -= WorkspaceView_LostFocus;
13031262
DataContextChanged -= OnWorkspaceViewDataContextChanged;
13041263
}
13051264
}

0 commit comments

Comments
 (0)