diff --git a/src/DynamoCoreWpf/Utilities/CompactBubbleHandler.cs b/src/DynamoCoreWpf/Utilities/CompactBubbleHandler.cs index 7e274e142f0..44d4e2f707b 100644 --- a/src/DynamoCoreWpf/Utilities/CompactBubbleHandler.cs +++ b/src/DynamoCoreWpf/Utilities/CompactBubbleHandler.cs @@ -25,7 +25,7 @@ public static CompactBubbleViewModel Process(MirrorData value) { items = 0; var viewModel = ProcessThing(value, true); - viewModel.SetObjectType(value.Data); + viewModel.SetObjectType(value?.Data); viewModel.NumberOfItems = items; return viewModel; diff --git a/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs index 578447dcdb7..ee95fe3f69b 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs @@ -642,7 +642,7 @@ public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationMode ViewModelBases = this.WorkspaceViewModel.GetViewModelsInternal(annotationModel.Nodes.Select(x => x.GUID)); - // Add all grouped AnnotaionModels to the CutGeometryDictionary. + // Add all grouped AnnotationModels to the CutGeometryDictionary. // And raise ZIndex changed to make sure nested groups have // a higher zIndex than the parent. using (NestedGroupsGeometries.DeferCollectionReset()) diff --git a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs index 0becc9ac897..d18d8d84bba 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs @@ -1842,6 +1842,8 @@ private void Open(object parameters) commandString, MessageBoxButton.OK, MessageBoxImage.Error); + + this.ShowStartPage = true; // Triggers start page change to notify the frontend } else { diff --git a/src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs b/src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs index 642dc0fc51a..c1828344520 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs @@ -761,7 +761,7 @@ internal bool HandleMouseRelease(object sender, MouseButtonEventArgs e) .ToList(); // AddModelsToGroupModelCommand adds models to the selected group - // therefor we add the dropGroup to the selection before calling + // therefore we add the dropGroup to the selection before calling // the command. DynamoSelection.Instance.Selection.AddUnique(dropGroup.AnnotationModel); @@ -794,7 +794,9 @@ internal bool HandleMouseRelease(object sender, MouseButtonEventArgs e) owningWorkspace.DynamoViewModel.AddModelsToGroupModelCommand.Execute(null); } dropGroup.NodeHoveringState = false; - dropGroup.SelectAll(); + //select only those models which were added to the group + DynamoSelection.Instance.ClearSelection(); + DynamoSelection.Instance.Selection.AddRange(modelsToAdd); } SetCurrentState(State.None); // Dragging operation ended. diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml index 44be7126d45..0ff852a84df 100644 --- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml +++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml @@ -1791,24 +1791,15 @@ + - - - - - - + Grid.ColumnSpan="5"/> diff --git a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs index 64506622f33..1ab626f2aa0 100644 --- a/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs @@ -108,6 +108,8 @@ internal PreferencesView PreferencesWindow { get { return preferencesWindow; } } + internal Dynamo.UI.Views.HomePage homePage; + /// /// Keeps the default value of the Window's MinWidth to calculate it again later /// @@ -1208,7 +1210,6 @@ private void InitializeStartPage(bool isFirstRun) startPage = new StartPageViewModel(dynamoViewModel, isFirstRun); startPageItemsControl.Items.Add(startPage); - homePage.DataContext = startPage; } } @@ -1383,9 +1384,36 @@ private void DynamoView_Loaded(object sender, EventArgs e) { this.Deactivated += (s, args) => { HidePopupWhenWindowDeactivated(null); }; } + + // Load the new HomePage + if (IsNewAppHomeEnabled) LoadHomePage(); + loaded = true; } + // Add the HomePage to the DynamoView once its loaded + private void LoadHomePage() + { + if (homePage == null && startPage != null) + { + homePage = new UI.Views.HomePage(); + homePage.DataContext = startPage; + + var visibilityBinding = new System.Windows.Data.Binding + { + RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DynamoView), 1), + Path = new PropertyPath("DataContext.ShowStartPage"), + Mode = BindingMode.OneWay, + Converter = new BooleanToVisibilityConverter(), + UpdateSourceTrigger = UpdateSourceTrigger.Explicit + }; + + BindingOperations.SetBinding(homePage, UIElement.VisibilityProperty, visibilityBinding); + + this.newHomePageContainer.Children.Add(homePage); + } + } + /// /// Assign the value to the toolBarRightMenuWidth when the ShortcutToolbar is loaded /// @@ -2021,7 +2049,10 @@ private void WindowClosed(object sender, EventArgs e) this.dynamoViewModel.RequestExportWorkSpaceAsImage -= OnRequestExportWorkSpaceAsImage; this.dynamoViewModel.RequestShorcutToolbarLoaded -= onRequestShorcutToolbarLoaded; - this.homePage.Dispose(); + if (homePage != null) + { + RemoveHomePage(); + } this.Dispose(); sharedViewExtensionLoadedParams?.Dispose(); @@ -2029,6 +2060,13 @@ private void WindowClosed(object sender, EventArgs e) this._pkgVM?.Dispose(); } + // Remove the HomePage from the visual tree and dispose of its resources + private void RemoveHomePage() + { + this.newHomePageContainer.Children.Remove(homePage); + this.homePage.Dispose(); + } + // the key press event is being intercepted before it can get to // the active workspace. This code simply grabs the key presses and // passes it to thecurrent workspace diff --git a/src/DynamoCoreWpf/Views/Core/NoteView.xaml.cs b/src/DynamoCoreWpf/Views/Core/NoteView.xaml.cs index 09a7592813d..ba7fb5523c9 100644 --- a/src/DynamoCoreWpf/Views/Core/NoteView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Core/NoteView.xaml.cs @@ -290,7 +290,7 @@ private string BulletDashHandler( string text, int caretIndex) // dont convert it to bullet bool lineContainsBullet = BULLETS_CHARS.Where(b => line.Contains(b)).Any(); var textBeforeCaret = line.Substring(0, caretAtLine); - if (!StringUtils.IsStringSpacesWithTabs(textBeforeCaret)&& !lineContainsBullet) + if (!StringUtils.IsStringSpacesWithTabs(textBeforeCaret) || lineContainsBullet) { line = line.Insert(caretAtLine, "-"); return StringUtils.ReplaceLineOfText(text, lineNumber, line); diff --git a/src/LibraryViewExtensionWebView2/LibraryViewController.cs b/src/LibraryViewExtensionWebView2/LibraryViewController.cs index b8d132015d5..e93720fe383 100644 --- a/src/LibraryViewExtensionWebView2/LibraryViewController.cs +++ b/src/LibraryViewExtensionWebView2/LibraryViewController.cs @@ -237,6 +237,7 @@ internal void RefreshLibraryView(WebView2 browser) /// text to be added to clipboard internal void OnCopyToClipboard(string text) { + dynamoViewModel.Model.ClipBoard.Clear(); Clipboard.SetText(text); } diff --git a/src/Notifications/NotificationCenterController.cs b/src/Notifications/NotificationCenterController.cs index 73d1cba72c5..cb7e7d9c959 100755 --- a/src/Notifications/NotificationCenterController.cs +++ b/src/Notifications/NotificationCenterController.cs @@ -140,6 +140,9 @@ private void WebView_NavigationCompleted(object sender, Microsoft.Web.WebView2.C string setBottomButtonText = String.Format("window.setBottomButtonText('{0}');", Properties.Resources.NotificationsCenterBottomButtonText); InvokeJS(setBottomButtonText); + + string setNoNotificationsTexts = String.Format("window.setNoNotificationsTexts('{{\"title\":\"{0}\", \"msg\":\"{1}\"}}');", Properties.Resources.NoNotificationsTitle, Properties.Resources.NoNotificationsMsg); + InvokeJS(setNoNotificationsTexts); } private void AddNotifications(List notifications) diff --git a/src/Notifications/Properties/Resources.Designer.cs b/src/Notifications/Properties/Resources.Designer.cs index 0a5f961668c..ce76085d545 100644 --- a/src/Notifications/Properties/Resources.Designer.cs +++ b/src/Notifications/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Dynamo.Notifications.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -114,6 +114,24 @@ public static string ExtensionName { } } + /// + /// Looks up a localized string similar to You currently have no notifications. New notifications will appear above. + /// + public static string NoNotificationsMsg { + get { + return ResourceManager.GetString("NoNotificationsMsg", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No notifications. + /// + public static string NoNotificationsTitle { + get { + return ResourceManager.GetString("NoNotificationsTitle", resourceCulture); + } + } + /// /// Looks up a localized string similar to Notification Center feature is disabled. Enable it in preference panel to see latest news.. /// diff --git a/src/Notifications/Properties/Resources.en-US.resx b/src/Notifications/Properties/Resources.en-US.resx index 29cf8f91d6d..54c101db48b 100644 --- a/src/Notifications/Properties/Resources.en-US.resx +++ b/src/Notifications/Properties/Resources.en-US.resx @@ -135,6 +135,12 @@ Notifications + + You currently have no notifications. New notifications will appear above + + + No notifications + Notification Center feature is disabled. Enable it in preference panel to see latest news. diff --git a/test/DynamoCoreWpfTests/HomePageTests.cs b/test/DynamoCoreWpfTests/HomePageTests.cs index d42f274fd53..b56d2d69abf 100644 --- a/test/DynamoCoreWpfTests/HomePageTests.cs +++ b/test/DynamoCoreWpfTests/HomePageTests.cs @@ -114,7 +114,9 @@ internal static string CONTAINER_ITEM_CLICK_SCRIPT(string elementId) }})();"; } + [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanClickRecentGraph() { // Arrange @@ -155,6 +157,7 @@ public void CanClickRecentGraph() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanClickSampleGraph() { // Arrange @@ -200,6 +203,7 @@ public void CanClickSampleGraph() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanClickTourGuide() { // Arrange @@ -234,6 +238,7 @@ public void CanClickTourGuide() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ReceiveCorrectNumberOfRecentGrphs() { // Arrange @@ -263,6 +268,7 @@ public void ReceiveCorrectNumberOfRecentGrphs() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ReceiveCorrectNumberOfSamples() { // Arrange @@ -299,6 +305,7 @@ public void ReceiveCorrectNumberOfSamples() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ReceiveCorrectNumberOfTourGuides() { // Arrange @@ -319,6 +326,7 @@ public void ReceiveCorrectNumberOfTourGuides() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ReceiveCorrectNumberOfCarouselVideos() { // Arrange @@ -339,6 +347,7 @@ public void ReceiveCorrectNumberOfCarouselVideos() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanRunNewHomeWorkspaceCommandFromHomePage() { // Arrange @@ -376,6 +385,7 @@ void Model_WorkspaceCleared(WorkspaceModel model) } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanRunNewCustomNodeCommandFromHomePage() { // Arrange @@ -408,6 +418,7 @@ public void CanRunNewCustomNodeCommandFromHomePage() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void CanOpenWorkspaceCommandFromHomePage() { // Arrange @@ -440,6 +451,7 @@ public void CanOpenWorkspaceCommandFromHomePage() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ShowTemplateCommandFromHomePage() { // Arrange @@ -473,6 +485,7 @@ public void ShowTemplateCommandFromHomePage() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ShowBackupFolderCommandFromHomePage() { // Arrange @@ -505,6 +518,7 @@ public void ShowBackupFolderCommandFromHomePage() } [Test] + [Ignore("IsNewAppHomeEnabled flag is set to false")] public void ShowSampleFilesFolderCommandFromHomePage() { // Arrange diff --git a/test/DynamoCoreWpfTests/ViewExtensions/NotificationsExtensionTests.cs b/test/DynamoCoreWpfTests/ViewExtensions/NotificationsExtensionTests.cs index 47b370d39be..54915f00909 100644 --- a/test/DynamoCoreWpfTests/ViewExtensions/NotificationsExtensionTests.cs +++ b/test/DynamoCoreWpfTests/ViewExtensions/NotificationsExtensionTests.cs @@ -1,6 +1,3 @@ -using Dynamo.Utilities; -using Dynamo.Notifications.View; -using NUnit.Framework; using System; using System.IO; using System.Linq; @@ -8,8 +5,10 @@ using System.Windows.Controls; using System.Windows.Controls.Primitives; using Dynamo.Notifications; -using Dynamo.DocumentationBrowser; +using Dynamo.Notifications.View; +using Dynamo.Utilities; using DynamoCoreWpfTests.Utility; +using NUnit.Framework; namespace DynamoCoreWpfTests.ViewExtensions { @@ -28,6 +27,7 @@ public void PressNotificationButtonAndShowPopup() { return notificationExtension.notificationCenterController.initState == DynamoUtilities.AsyncMethodState.Done; }); + Assert.AreEqual(DynamoUtilities.AsyncMethodState.Done, notificationExtension.notificationCenterController.initState); NotificationUI notificationUI = PresentationSource.CurrentSources.OfType() @@ -37,9 +37,9 @@ public void PressNotificationButtonAndShowPopup() .OfType() .FirstOrDefault(p => p.IsOpen); - Assert.NotNull(notificationUI); - var webView = notificationUI.FindName("dynWebView"); - Assert.NotNull(webView); + Assert.NotNull(notificationUI, "Notification popup not part of the dynamo visual tree"); + var webView = notificationUI.FindName("webView"); + Assert.NotNull(webView, "WebView framework element not found."); } [Test]