Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling the Custom Nodes and Trusted Location message #13138

Merged
merged 10 commits into from
Aug 5, 2022
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Controls/NotificationsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void NotificationsControl_Loaded(object sender, RoutedEventArgs e)
/// <param name="e"></param>
void window_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
var hsvm = (HomeWorkspaceViewModel)((DynamoViewModel)DataContext).HomeSpaceViewModel;
var hsvm = (HomeWorkspaceViewModel)((DynamoViewModel)DataContext).HomeSpaceViewModel;
// Commented this after MAGN - 8423
// hsvm.ClearWarning();
}
Expand Down
6 changes: 4 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public Point TransformOrigin

public bool ViewingHomespace
{
get { return model.CurrentWorkspace == HomeSpace; }
get {
return model.CurrentWorkspace == HomeSpace;
}
}

public int ScaleFactorLog
Expand Down Expand Up @@ -1103,7 +1105,7 @@ void _model_PropertyChanged(object sender, PropertyChangedEventArgs e)
this.PublishCurrentWorkspaceCommand.RaiseCanExecuteChanged();
RaisePropertyChanged("IsPanning");
RaisePropertyChanged("IsOrbiting");
//RaisePropertyChanged("RunEnabled");
//RaisePropertyChanged("RunEnabled");
break;

case "EnablePresetOptions":
Expand Down
13 changes: 11 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/HomeWorkspaceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,18 @@ public HomeWorkspaceViewModel(HomeWorkspaceModel model, DynamoViewModel dynamoVi
hwm.SetNodeDeltaState +=hwm_SetNodeDeltaState;

dynamoViewModel.Model.ShutdownStarted += Model_ShutdownStarted;

dynamoViewModel.PropertyChanged += DynamoViewModel_PropertyChanged;
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
SetupFooterNotificationItems();
}

private void DynamoViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == "CurrentSpace" && !((sender as DynamoViewModel).HomeSpaceViewModel as HomeWorkspaceViewModel).IsCurrentSpace)
{
ClearWarning();
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
}
}

/// <summary>
/// Setup the initial collection of FooterNotificationItems
/// </summary>
Expand Down Expand Up @@ -270,6 +278,7 @@ internal void UpdateRunStatusMsgBasedOnStates()
if(IsHomeSpace && !IsCurrentSpace)
{
SetCurrentWarning(NotificationLevel.Mild, string.Empty);
DynamoViewModel.FileTrustViewModel.ShowWarningPopup = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the gif, there will be a flash of trust warning displayed then disappear.. Less desirable, can we hide it even earlier?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we still need this fix here in addition to other changes?

return;
}
if (RunSettings.ForceBlockRun)
Expand Down Expand Up @@ -329,7 +338,7 @@ internal void UpdateRunStatusMsgBasedOnStates()
/// <param name="hasErrors"></param>
private void UpdateFooterItems(bool hasInfo, bool hasWarnings, bool hasErrors)
{

if (hasErrors)
FooterNotificationItems[0].NotificationCount = Model.Nodes.Count(n => n.State == ElementState.Error);
else
Expand Down
13 changes: 11 additions & 2 deletions src/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ public FileTrustWarning(DynamoView dynamoViewWindow)
SetUpPopup();

HomeWorkspaceModel.WorkspaceClosed += CloseWarningPopup;
dynViewModel.PropertyChanged += DynViewModel_PropertyChanged;
}

private void DynViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "CurrentSpace" && !((sender as DynamoViewModel).HomeSpaceViewModel as HomeWorkspaceViewModel).IsCurrentSpace)
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
{
IsOpen = false;
}
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
}

private void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
Expand Down Expand Up @@ -178,8 +187,8 @@ internal void CleanPopup()
internal void ManagePopupActivation(bool activate)
{
if (dynViewModel.FileTrustViewModel.ShowWarningPopup == !activate &&
!string.IsNullOrEmpty(dynViewModel.FileTrustViewModel.DynFileDirectoryName) &&
RunSettings.ForceBlockRun == true)
!string.IsNullOrEmpty(dynViewModel.FileTrustViewModel.DynFileDirectoryName) &&
RunSettings.ForceBlockRun == true)
IsOpen = activate;
}

Expand Down