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

Turn off Notification Center from Preferences Panel. #13190

Merged
merged 7 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class PreferenceSettings : NotificationObject, IPreferences, IRenderPreci
private int maxNumRecentFiles;
private bool isBackgroundGridVisible;
private bool disableTrustWarnings = false;
private bool isNotificationCenterEnabled;
#region Constants
/// <summary>
/// Indicates the maximum number of files shown in Recent Files
Expand Down Expand Up @@ -439,6 +440,22 @@ public string PythonTemplateFilePath
/// </summary>
public bool EnableNodeAutoComplete { get; set; }

/// <summary>
/// This defines if user wants to see the enabled Dynamo Notification Center.
/// </summary>
public bool EnableNotificationCenter
{
get
{
return isNotificationCenterEnabled;
}
set
{
isNotificationCenterEnabled = value;
RaisePropertyChanged(nameof(EnableNotificationCenter));
}
}

/// <summary>
/// Engine used by default for new Python script and string nodes. If not empty, this takes precedence over any system settings.
/// </summary>
Expand Down Expand Up @@ -626,6 +643,7 @@ public PreferenceSettings()
IsIronPythonDialogDisabled = false;
ShowTabsAndSpacesInScriptEditor = false;
EnableNodeAutoComplete = true;
EnableNotificationCenter = true;
DefaultPythonEngine = string.Empty;
ViewExtensionSettings = new List<ViewExtensionSettings>();
GroupStyleItemsList = new List<GroupStyleItem>();
Expand Down
68 changes: 39 additions & 29 deletions src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,34 +140,6 @@
<Menu HorizontalAlignment="Right"
Style="{StaticResource MainMenu}"
IsMainMenu="True">
<MenuItem Name="MenuItem"
Margin="0 0 -30 0">
<MenuItem.Header>
<Button x:Name="notificationsButton"
BorderBrush="Transparent"
Background="Transparent">
<DockPanel>
<fa:FontAwesome Margin="0,0,20,0"
DockPanel.Dock="Bottom"
Icon="BellOutline"
Foreground="{StaticResource Blue400Brush}"
FontSize="20px"/>
<Border DockPanel.Dock="Top" Background="{StaticResource Blue400Brush}" CornerRadius="2"
Padding="2" Height="15" Width="15" VerticalAlignment="Center"
HorizontalAlignment="Center">
<!--TODO insert data bind for the notifications -->
<TextBlock
FontFamily="{StaticResource ArtifaktElementRegular}"
Foreground="White"
FontWeight="Bold"
TextAlignment="Center"
FontSize="9">99
</TextBlock>
</Border>
</DockPanel>
</Button>
</MenuItem.Header>
</MenuItem>
<MenuItem Name="exportMenu"
Cursor="Hand"
Focusable="False"
Expand Down Expand Up @@ -208,8 +180,46 @@
</MenuItem.ToolTip>
</MenuItem>
</MenuItem>
<MenuItem Name="NotificationCenter"
Margin="-15 0 -30 0">
<MenuItem.Header>
<Button x:Name="notificationsButton"
BorderBrush="Transparent"
Background="Transparent">
<DockPanel>
<fa:FontAwesome Margin="0,0,25,0"
DockPanel.Dock="Top"
Icon="{Binding Path=DataContext.PreferenceSettings.EnableNotificationCenter, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type Window}},
Converter={StaticResource BoolToFAIconNameConverter}}"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{StaticResource PrimaryCharcoal300Brush}"
FontSize="18px"/>
<Border DockPanel.Dock="Bottom"
Background="{StaticResource Blue400Brush}"
CornerRadius="2"
Padding="2"
Height="14"
Width="14"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<!--TODO insert data bind for the notifications -->
<TextBlock Name="NotificationCount"
FontFamily="{StaticResource ArtifaktElementRegular}"
Foreground="White"
FontWeight="DemiBold"
TextAlignment="Center"
FontSize="9">8
</TextBlock>
</Border>
</DockPanel>
</Button>
</MenuItem.Header>
</MenuItem>
</Menu>
<controls:GraphUpdateNotificationControl x:Name="UpdateControl" HorizontalAlignment="Right"
<!--The update indication-->
<controls:GraphUpdateNotificationControl x:Name="UpdateControl"
HorizontalAlignment="Right"
Margin="0,0,50,0"
Visibility="{Binding Path=DataContext.IsUpdateAvailable, RelativeSource={RelativeSource AncestorType={x:Type Window}},
Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"/>
Expand Down
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

8 changes: 8 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3270,4 +3270,12 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="UngroupParentGroupWarning" xml:space="preserve">
<value>Dynamo cannot ungroup when there is no parent group.</value>
</data>
<data name="PreferencesViewEnableNotificationCenter" xml:space="preserve">
<value>Receive notification</value>
<comment>Preferences | Features | Notification Center | Receive notification</comment>
</data>
<data name="PreferencesViewNotificationCenter" xml:space="preserve">
<value>Notification Center</value>
<comment>Preferences | Features | Notification Center</comment>
</data>
</root>
8 changes: 8 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3257,4 +3257,12 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="UngroupParentGroupWarning" xml:space="preserve">
<value>Dynamo cannot ungroup when there is no parent group.</value>
</data>
<data name="PreferencesViewEnableNotificationCenter" xml:space="preserve">
<value>Receive notification</value>
<comment>Preferences | Features | Notification Center | Receive notification</comment>
</data>
<data name="PreferencesViewNotificationCenter" xml:space="preserve">
<value>Notification Center</value>
<comment>Preferences | Features | Notification Center</comment>
</data>
</root>
20 changes: 18 additions & 2 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
using Dynamo.Wpf.Properties;
using Dynamo.Wpf.ViewModels;
using DynamoUnits;
using PythonNodeModels;
using SharpDX.DXGI;
using Color = System.Windows.Media.Color;
using FlowDirection = System.Windows.FlowDirection;
using HorizontalAlignment = System.Windows.HorizontalAlignment;
Expand Down Expand Up @@ -1300,6 +1298,24 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

/// <summary>
/// Converter for Notification Bell updates based on feature enabled or not
/// </summary>
public class BoolToFAIconNameConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ((bool)value)
return nameof(FontAwesome.WPF.FontAwesomeIcon.BellOutline);
return nameof(FontAwesome.WPF.FontAwesomeIcon.BellSlashOutline);
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

public class BoolToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/UI/GuidedTour/GuidesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ private void Popup_StepClosed(string name, Step.StepTypes stepType)
/// and display message passed as param
/// </summary>
/// <param name="content">The target content to display.</param>
/// <param name="stayOpen">boolean indicates if the popup will stay open untill user dismiss it.</param>
QilongTang marked this conversation as resolved.
Show resolved Hide resolved
/// TODO: Make this API out of guide manager to a more generic place
internal void CreateRealTimeInfoWindow(string content, bool stayOpen = false)
{
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<controls:LacingToTooltipConverter x:Key="LacingToTooltipConverter" />
<controls:NodeWarningConverter x:Key="NodeWarningConverter"/>
<controls:NodeOriginalNameToMarginConverter x:Key="NodeOriginalNameToMarginConverter" />
<controls:BoolToFAIconNameConverter x:Key="BoolToFAIconNameConverter" />
<controls:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
<controls:BoolToVisibilityCollapsedConverter x:Key="BooleanToVisibilityCollapsedConverter" />
<controls:InverseBooleanToVisibilityCollapsedConverter x:Key="InverseBoolToVisibilityCollapsedConverter" />
Expand Down
62 changes: 31 additions & 31 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,35 @@ public class PreferencesViewModel : ViewModelBase, INotifyPropertyChanged
#region Private Properties
private string savedChangesLabel;
private string savedChangesTooltip;
private string currentWarningMessage;
private string selectedPackagePathForInstall;

private string selectedLanguage;
private string selectedFontSize;
private string selectedNumberFormat;
private string selectedPythonEngine;

private ObservableCollection<string> languagesList;
private ObservableCollection<string> packagePathsForInstall;
private ObservableCollection<string> fontSizeList;
private ObservableCollection<string> numberFormatList;
private StyleItem addStyleControl;
private ObservableCollection<string> pythonEngineList;

private string selectedLanguage;
private string selectedFontSize;
private string selectedNumberFormat;
private string selectedPythonEngine;
private bool runPreviewEnabled;
private bool runPreviewIsChecked;
private bool hideIronPAlerts;
private bool showWhitespace;
private bool nodeAutocomplete;
private bool enableTSpline;
private bool showEdges;
private bool isolateSelectedGeometry;
private bool showCodeBlockLineNumber;
private RunType runSettingsIsChecked;
private Dictionary<string, TabSettings> preferencesTabs;

private PreferenceSettings preferenceSettings;
private DynamoPythonScriptEditorTextOptions pythonScriptEditorTextOptions;
private HomeWorkspaceModel homeSpace;
private DynamoViewModel dynamoViewModel;
private readonly PreferenceSettings preferenceSettings;
private readonly DynamoPythonScriptEditorTextOptions pythonScriptEditorTextOptions;
private readonly DynamoViewModel dynamoViewModel;
private readonly InstalledPackagesViewModel installedPackagesViewModel;

private bool isWarningEnabled;
private string currentWarningMessage;
private bool isSaveButtonEnabled = true;
private GeometryScalingOptions optionsGeometryScale = null;

private InstalledPackagesViewModel installedPackagesViewModel;
private string selectedPackagePathForInstall;
private bool isVisibleAddStyleBorder;
private bool isEnabledAddStyleButton;
private GeometryScalingOptions optionsGeometryScale = null;

#endregion Private Properties

public GeometryScaleSize ScaleSize { get; set; }
Expand Down Expand Up @@ -536,7 +529,6 @@ public bool ShowEdges
}
set
{
showEdges = value;
dynamoViewModel.RenderPackageFactoryViewModel.ShowEdges = value;
RaisePropertyChanged(nameof(ShowEdges));
}
Expand All @@ -553,7 +545,6 @@ public bool IsolateSelectedGeometry
}
set
{
isolateSelectedGeometry = value;
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we removing these setters here? Are these not used anymore?

Copy link
Contributor Author

@QilongTang QilongTang Aug 9, 2022

Choose a reason for hiding this comment

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

@zeusongit Only removing the private value setter since these private values are not used. Suggested by VS

dynamoViewModel.BackgroundPreviewViewModel.IsolationMode = value;
RaisePropertyChanged(nameof(IsolateSelectedGeometry));
}
Expand Down Expand Up @@ -603,7 +594,6 @@ public bool ShowCodeBlockLineNumber
set
{
preferenceSettings.ShowCodeBlockLineNumber = value;
showCodeBlockLineNumber = value;
RaisePropertyChanged(nameof(ShowCodeBlockLineNumber));
}
}
Expand Down Expand Up @@ -697,7 +687,6 @@ public bool HideIronPythonAlertsIsChecked
}
set
{
hideIronPAlerts = value;
preferenceSettings.IsIronPythonDialogDisabled = value;
RaisePropertyChanged(nameof(HideIronPythonAlertsIsChecked));
}
Expand All @@ -716,7 +705,6 @@ public bool ShowWhitespaceIsChecked
{
pythonScriptEditorTextOptions.ShowWhiteSpaceCharacters(value);
preferenceSettings.ShowTabsAndSpacesInScriptEditor = value;
showWhitespace = value;
RaisePropertyChanged(nameof(ShowWhitespaceIsChecked));
}
}
Expand All @@ -733,11 +721,26 @@ public bool NodeAutocompleteIsChecked
set
{
preferenceSettings.EnableNodeAutoComplete = value;
nodeAutocomplete = value;
RaisePropertyChanged(nameof(NodeAutocompleteIsChecked));
}
}

/// <summary>
/// Controls the IsChecked property in the "Notification Center" toogle button
/// </summary>
public bool NotificationCenterIsChecked
{
get
{
return preferenceSettings.EnableNotificationCenter;
}
set
{
preferenceSettings.EnableNotificationCenter = value;
RaisePropertyChanged(nameof(NotificationCenterIsChecked));
}
}

/// <summary>
/// Controls the IsChecked property in the "Enable T-spline nodes" toogle button
/// </summary>
Expand All @@ -750,7 +753,6 @@ public bool EnableTSplineIsChecked
}
set
{
enableTSpline = value;
HideUnhideNamespace(!value, "ProtoGeometry.dll", "Autodesk.DesignScript.Geometry.TSpline");
RaisePropertyChanged(nameof(EnableTSplineIsChecked));
}
Expand Down Expand Up @@ -810,8 +812,6 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
{
this.preferenceSettings = dynamoViewModel.PreferenceSettings;
this.pythonScriptEditorTextOptions = dynamoViewModel.PythonScriptEditorTextOptions;
this.runPreviewEnabled = dynamoViewModel.HomeSpaceViewModel.RunSettingsViewModel.RunButtonEnabled;
this.homeSpace = dynamoViewModel.HomeSpace;
this.dynamoViewModel = dynamoViewModel;
this.installedPackagesViewModel = new InstalledPackagesViewModel(dynamoViewModel,
dynamoViewModel.PackageManagerClientViewModel.PackageManagerExtension.PackageLoader);
Expand Down
Loading