Skip to content

Commit

Permalink
Dynamo SignIn UI toolbar fixes and tooltip updates (#14842)
Browse files Browse the repository at this point in the history
* Fix PostDiff job

* fixes 1 and 2

* DYN-5868 fix-3
  • Loading branch information
zeusongit authored Jan 15, 2024
1 parent 3d6f23b commit b0eb47a
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
</MenuItem.Header>
<MenuItem Focusable="False"
Header="{x:Static p:Resources.LogoutMenuItemText}"
Command="{Binding SignOutCommand}"
Click="LogoutOption_Click"
Name="logoutOption">
<MenuItem.ToolTip>
<ToolTip Content="{x:Static p:Resources.LogoutMenuItemText}" Style="{StaticResource GenericToolTipLight}"/>
Expand Down
32 changes: 27 additions & 5 deletions src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,17 @@ public ShortcutToolbar(DynamoViewModel dynamoViewModel)
var shortcutToolbar = new ShortcutToolbarViewModel(dynamoViewModel);
DataContext = shortcutToolbar;
authManager = dynamoViewModel.Model.AuthenticationManager;
if (authManager.IsLoggedInInitial())
if (authManager != null)
{
authManager.LoginStateChanged += AuthChangeHandler;
}
else {
logoutOption.Visibility = Visibility.Collapsed;
if (authManager.LoginState == LoginState.LoggedIn)
{
loginMenu.Items.Add(logoutOption);
}
else
{
loginMenu.Items.Remove(logoutOption);
}
}

this.Loaded += ShortcutToolbar_Loaded;
Expand Down Expand Up @@ -90,12 +95,17 @@ private void AuthChangeHandler(LoginState status)
LoginButton.ToolTip = Wpf.Properties.Resources.SignInButtonContentToolTip;
txtSignIn.Text = Wpf.Properties.Resources.SignInButtonText;
logoutOption.Visibility = Visibility.Collapsed;
loginMenu.Items.Remove(logoutOption);
}
else if (status == LoginState.LoggedIn)
{
txtSignIn.Text = authManager.Username;
logoutOption.Visibility = Visibility.Visible;
LoginButton.ToolTip = null;
if (loginMenu.Items.Count == 0)
{
loginMenu.Items.Add(logoutOption);
}
logoutOption.Visibility = Visibility.Visible;
}
}

Expand Down Expand Up @@ -134,6 +144,18 @@ private void LoginButton_OnClick(object sender, RoutedEventArgs e)
}
}

private void LogoutOption_Click(object sender, RoutedEventArgs e)
{
if (authManager.LoginState == LoginState.LoggedIn)
{
var result = Wpf.Utilities.MessageBoxService.Show(Application.Current?.MainWindow, Wpf.Properties.Resources.SignOutConfirmationDialogText, Wpf.Properties.Resources.SignOutConfirmationDialogTitle,MessageBoxButton.OKCancel, new List<string>() { "Sign Out", "Cancel"}, MessageBoxImage.Information);
if (result == MessageBoxResult.OK)
{
authManager.ToggleLoginState(null);
}
}
}

public List<Control> AllChildren(DependencyObject parent)
{
var _list = new List<Control> { };
Expand Down
20 changes: 19 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

10 changes: 8 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,7 @@ Do you wish to uninstall {1}? Restart {2} to complete the uninstall and try down
<value>Package/Library Search Paths</value>
</data>
<data name="PreferencesViewShowRunPreviewTooltip" xml:space="preserve">
<value>Switchable only when the current workspace is in Manual run mode.</value>
<value>To preview the execution state of your graph, wires connected to ports that will be affected by a graph run are highlighted in orange. Available only when the current workspace is in Manual run mode.</value>
</data>
<data name="PersistentVisualStatusOfLinterIssues" xml:space="preserve">
<value>Issues found</value>
Expand Down Expand Up @@ -3879,4 +3879,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
<data name="SignOutConfirmationDialogText" xml:space="preserve">
<value>Signing out of Dynamo will sign you out of all Autodesk desktop products.</value>
</data>
<data name="SignOutConfirmationDialogTitle" xml:space="preserve">
<value>Sign out of Dynamo</value>
</data>
</root>
10 changes: 8 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2877,7 +2877,7 @@ Do you wish to uninstall {1}? Restart {2} to complete the uninstall and try down
<value>Package/Library Search Paths</value>
</data>
<data name="PreferencesViewShowRunPreviewTooltip" xml:space="preserve">
<value>Switchable only when the current workspace is in Manual run mode.</value>
<value>To preview the execution state of your graph, wires connected to ports that will be affected by a graph run are highlighted in orange. Available only when the current workspace is in Manual run mode.</value>
</data>
<data name="PersistentVisualStatusOfLinterIssues" xml:space="preserve">
<value>Issues found</value>
Expand Down Expand Up @@ -3866,4 +3866,10 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
<data name="SignOutConfirmationDialogText" xml:space="preserve">
<value>Signing out of Dynamo will sign you out of all Autodesk desktop products.</value>
</data>
<data name="SignOutConfirmationDialogTitle" xml:space="preserve">
<value>Sign out of Dynamo</value>
</data>
</root>
21 changes: 21 additions & 0 deletions src/DynamoCoreWpf/UI/Prompts/DynamoMessageBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,27 @@ internal static MessageBoxResult Show(string messageBoxText, string caption, Mes
return dynamoMessageBox.CustomDialogResult;
}

internal static MessageBoxResult Show(Window owner, string messageBoxText, string caption, MessageBoxButton button, IEnumerable<string> buttonNames,
MessageBoxImage icon)
{
var dynamoMessageBox = new DynamoMessageBox
{
BodyText = messageBoxText,
TitleText = caption,
MessageBoxButton = button,
MessageBoxImage = icon
};

if (owner != null && owner.IsLoaded)
{
dynamoMessageBox.Owner = owner;
}

dynamoMessageBox.ConfigureButtons(button, buttonNames);
dynamoMessageBox.ShowDialog();
return dynamoMessageBox.CustomDialogResult;
}

public event PropertyChangedEventHandler PropertyChanged;

/// <summary>
Expand Down
10 changes: 10 additions & 0 deletions src/DynamoCoreWpf/Utilities/MessageBoxUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal interface IMessageBox
MessageBoxResult Show(string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner,string msg, string title, MessageBoxButton button, MessageBoxImage img);
MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img);
MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img);
}

Expand All @@ -38,6 +39,11 @@ MessageBoxResult IMessageBox.Show(string msg, string title, MessageBoxButton but
{
return DynamoMessageBox.Show(msg, title, button,buttonNames, img);
}

MessageBoxResult IMessageBox.Show(Window owner, string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img)
{
return DynamoMessageBox.Show(owner, msg, title, button, buttonNames, img);
}
}

private static IMessageBox msg_box;
Expand All @@ -57,6 +63,10 @@ public static MessageBoxResult Show(Window owner,string msg, string title, Messa
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner,msg, title, button, img);
}
public static MessageBoxResult Show(Window owner, string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(owner, msg, title, button, buttonNames, img);
}
public static MessageBoxResult Show(string msg, string title, MessageBoxButton button, IEnumerable<string> buttonNames, MessageBoxImage img)
{
return (msg_box ?? (msg_box = new DefaultMessageBox())).Show(msg, title, button, buttonNames, img);
Expand Down

0 comments on commit b0eb47a

Please sign in to comment.