Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'upstream/master' into LiveChart…
Browse files Browse the repository at this point in the history
…Implementation"

This reverts commit 321a326, reversing
changes made to 1023291.
  • Loading branch information
dnenov committed Jan 18, 2023
1 parent 571cd5d commit cc95adf
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 97 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
min-width:300px;
max-width:450px;
width:100%;
background-color: white;
}
</style>

Expand Down
16 changes: 2 additions & 14 deletions src/DynamoCore/Models/DynamoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,20 +703,8 @@ protected DynamoModel(IStartConfiguration config)
// or the feature flags client.
if (!areAnalyticsDisabledFromConfig && !Dynamo.Logging.Analytics.DisableAnalytics)
{
// Start the Analytics service only when a session is not present.
// In an integrator host, as splash screen can be closed without shutting down the ViewModel, the analytics service is not stopped.
// So we don't want to start it when splash screen or dynamo window is launched again.
if (Analytics.client == null)
{
AnalyticsService.Start(this, IsHeadless, IsTestMode);
}
else if (Analytics.client is DynamoAnalyticsClient dac)
{
if (dac.Session == null)
{
AnalyticsService.Start(this, IsHeadless, IsTestMode);
}
}
AnalyticsService.Start(this, IsHeadless, IsTestMode);


//run process startup/reading on another thread so we don't block dynamo startup.
//if we end up needing to control aspects of dynamo model or view startup that we can't make
Expand Down
23 changes: 4 additions & 19 deletions src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Threading;
using Dynamo.Graph.Nodes.ZeroTouch;
using Dynamo.Graph.Workspaces;
using Dynamo.Logging;
using Dynamo.Models;
Expand Down Expand Up @@ -98,23 +97,10 @@ private void ExecuteSearchElement(ListBoxItem listBoxItem)
if (searchElement.CreateAndConnectCommand.CanExecute(port.PortModel))
{
searchElement.CreateAndConnectCommand.Execute(port.PortModel);
var selectedNodeName = (searchElement.Model is Search.SearchElements.ZeroTouchSearchElement) ?
searchElement.Model.CreationName :
// Same as NameTypeId.ToStrng() format
string.Format("{0}, {1}", searchElement.Model.CreationName, searchElement.Assembly.Split('\\').Last().Split('.').First());
var originalNodeName = (port.NodeViewModel.NodeModel is DSFunctionBase) ?
port.NodeViewModel.NodeModel.CreationName :
string.Format("{0}, {1}", port.NodeViewModel.NodeModel.GetType().FullName, port.NodeViewModel.NodeModel.GetType().Assembly.GetName().Name) ;
var searchElementInfo = ViewModel.IsDisplayingMLRecommendation ?
selectedNodeName + " " + port.PortModel.Index.ToString() + " " + port.PortName + " " + originalNodeName + " " +
searchElement.Model.AutoCompletionNodeElementInfo.PortToConnect.ToString() + " " +
searchElement.AutoCompletionNodeMachineLearningInfo.ConfidenceScore.ToString() + " " + ViewModel.ServiceVersion
: selectedNodeName;

Analytics.TrackEvent(
Dynamo.Logging.Actions.Select,
Dynamo.Logging.Categories.NodeAutoCompleteOperations,
searchElementInfo);
searchElement.FullName);
}
}
}
Expand Down Expand Up @@ -320,8 +306,7 @@ private void ShowLowConfidenceResults(object sender, RoutedEventArgs e)
Analytics.TrackEvent(
Actions.Expanded,
Categories.NodeAutoCompleteOperations,
"LowConfidenceResults",
ViewModel.dynamoViewModel.Model.PreferenceSettings.MLRecommendationConfidenceLevel);
"LowConfidenceResults");
}

private void OnSuggestion_Click(object sender, RoutedEventArgs e)
Expand All @@ -330,12 +315,12 @@ private void OnSuggestion_Click(object sender, RoutedEventArgs e)
if (selectedSuggestion.Name.Contains(nameof(Models.NodeAutocompleteSuggestion.MLRecommendation)))
{
ViewModel.dynamoViewModel.PreferenceSettings.DefaultNodeAutocompleteSuggestion = Models.NodeAutocompleteSuggestion.MLRecommendation;
Analytics.TrackEvent(Actions.Switch, Categories.Preferences, nameof(NodeAutocompleteSuggestion.MLRecommendation));
Analytics.TrackEvent(Actions.Select, Categories.Preferences, nameof(NodeAutocompleteSuggestion.MLRecommendation));
}
else
{
ViewModel.dynamoViewModel.PreferenceSettings.DefaultNodeAutocompleteSuggestion = Models.NodeAutocompleteSuggestion.ObjectType;
Analytics.TrackEvent(Actions.Switch, Categories.Preferences, nameof(NodeAutocompleteSuggestion.ObjectType));
Analytics.TrackEvent(Actions.Select, Categories.Preferences, nameof(NodeAutocompleteSuggestion.ObjectType));
}
ViewModel.PopulateAutoCompleteCandidates();
}
Expand Down
3 changes: 1 addition & 2 deletions src/DynamoCoreWpf/Services/UsageReportingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ public void CheckIsFirstRun(Window ownerWindow, IBrandingResourceProvider resour
{
resourceProvider = resource;
// First run of Dynamo
if (dynamoViewModel != null
&& dynamoViewModel.Model.PreferenceSettings.IsFirstRun
if (dynamoViewModel.Model.PreferenceSettings.IsFirstRun
&& !dynamoViewModel.HideReportOptions
&& !Analytics.DisableAnalytics
&& !DynamoModel.IsTestMode)
Expand Down
14 changes: 2 additions & 12 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -860,11 +860,13 @@ public bool NodeAutocompleteMachineLearningIsChecked
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.MLRecommendation;
Analytics.TrackEvent(Actions.Select,Categories.Preferences,nameof(NodeAutocompleteSuggestion.MLRecommendation));
}
else
{
preferenceSettings.DefaultNodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
nodeAutocompleteSuggestion = NodeAutocompleteSuggestion.ObjectType;
Analytics.TrackEvent(Actions.Select, Categories.Preferences, nameof(NodeAutocompleteSuggestion.ObjectType));
}

dynamoViewModel.HomeSpaceViewModel.NodeAutoCompleteSearchViewModel.ResetAutoCompleteSearchViewState();
Expand Down Expand Up @@ -1461,18 +1463,6 @@ private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
case nameof(DisableTrustWarnings):
description = Resources.ResourceManager.GetString(nameof(Res.PreferencesViewTrustWarningHeader), System.Globalization.CultureInfo.InvariantCulture);
goto default;
// We track these this in two places, one in preference panel,
// one where user make such switch in Node AutoComplete UI
case nameof(nodeAutocompleteSuggestion):
if (nodeAutocompleteSuggestion == NodeAutocompleteSuggestion.MLRecommendation)
description = nameof(NodeAutocompleteSuggestion.MLRecommendation);
else
description = nameof(NodeAutocompleteSuggestion.ObjectType);
goto default;
case nameof(MLRecommendationConfidenceLevel):
// Internal use only, no need to localize for now
description = "Confidence Level";
goto default;
default:
if (!string.IsNullOrEmpty(description))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ public class NodeAutoCompleteSearchViewModel : SearchViewModel
private bool displayLowConfidence;
private const string nodeAutocompleteMLEndpoint = "MLNodeAutocomplete";

/// <summary>
/// The Node AutoComplete ML service version, this could be empty if user has not used ML way
/// </summary>
internal string ServiceVersion { get; set; }

/// <summary>
/// Cache of default node suggestions, use it in case where
/// a. our algorithm does not return sufficient results
Expand Down Expand Up @@ -121,7 +116,6 @@ internal NodeAutoCompleteSearchViewModel(DynamoViewModel dynamoViewModel) : base
{
// Off load some time consuming operation here
InitializeDefaultAutoCompleteCandidates();
ServiceVersion = string.Empty;
}

/// <summary>
Expand Down Expand Up @@ -286,7 +280,7 @@ internal void DisplayMachineLearningResults()
Analytics.TrackEvent(Actions.View, Categories.NodeAutoCompleteOperations, "NoRecommendation");
return;
}
ServiceVersion = MLresults.Version;

var results = new List<NodeSearchElementViewModel>();

var zeroTouchSearchElements = Model.SearchEntries.OfType<ZeroTouchSearchElement>().Where(x => x.IsVisibleInSearch);
Expand Down
5 changes: 5 additions & 0 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,11 @@ int getExtraLeftSpace(int confidenceLevel)
private void sliderConfidenceLevel_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
displayConfidenceLevel();
//Tracking Analytics when changing the ML Confidence Level in the Preferences panel
Analytics.TrackEvent(
Actions.Set,
Categories.Preferences,
"ConfidendeLevel");
}

private void displayConfidenceLevel()
Expand Down
14 changes: 6 additions & 8 deletions src/DynamoCoreWpf/Views/Preview/WatchTree.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="Dynamo.Controls.WatchTree"
<UserControl x:Class="Dynamo.Controls.WatchTree"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Dynamo.Controls"
Expand Down Expand Up @@ -163,26 +163,24 @@
<!-- Vertical line -->

<Rectangle x:Name="VerLn"
Grid.RowSpan="1"
Grid.RowSpan="2"
Width="1"
Margin="9,0,0,3"
Margin="9,0,0,0"
HorizontalAlignment="Center"
Fill="Black"
SnapsToDevicePixels="True"
UseLayoutRounding="True"
SnapsToDevicePixels="true"
Stroke="#959595" />

<!-- Draw Ellipse at the bottom of each vertical line -->

<Ellipse x:Name="LnEnd"
Width="5"
Height="5"
Margin="9,0,0,0"
Margin="8,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Fill="#959595"
SnapsToDevicePixels="True"
UseLayoutRounding="True"
Stroke="#959595" />

</Grid>
Expand Down Expand Up @@ -469,4 +467,4 @@
</DockPanel>
</Border>
</Grid>
</UserControl>
</UserControl>
22 changes: 2 additions & 20 deletions src/DynamoCoreWpf/Views/SplashScreen/SplashScreen.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public DynamoView DynamoView
{
dynamoView = value;
viewModel = value.DataContext as DynamoViewModel;
// When view model is closed, we need to close the splash screen if it is displayed.
viewModel.RequestClose += SplashScreenRequestClose;
authManager = viewModel.Model.AuthenticationManager;
}
}
Expand Down Expand Up @@ -142,15 +140,6 @@ private void WebView_NavigationCompleted(object sender, CoreWebView2NavigationCo
OnRequestDynamicSplashScreen();
}

/// <summary>
/// Request to close SplashScreen.
/// </summary>
private void SplashScreenRequestClose(object sender, EventArgs e)
{
CloseWindow();
viewModel.RequestClose -= SplashScreenRequestClose;
}

/// <summary>
/// Import setting file from chosen path
/// </summary>
Expand Down Expand Up @@ -199,6 +188,7 @@ private bool SignOut()
private void LaunchDynamo(bool isCheckboxChecked)
{
viewModel.PreferenceSettings.EnableStaticSplashScreen = !isCheckboxChecked;
DynamoModel.RequestUpdateLoadBarStatus -= DynamoModel_RequestUpdateLoadBarStatus;
StaticSplashScreenReady -= OnStaticScreenReady;
Close();
dynamoView.Show();
Expand All @@ -212,6 +202,7 @@ private void OnStaticScreenReady()
{
// Stop the timer in any case
loadingTimer.Stop();
loadingTimer = null;

//When a xml preferences settings file is located at C:\ProgramData\Dynamo will be read and deserialized so the settings can be set correctly.
LoadPreferencesFileAtStartup();
Expand Down Expand Up @@ -453,21 +444,12 @@ private void CloseWindow()
Application.Current.Shutdown();
Analytics.TrackEvent(Actions.Close, Categories.SplashScreenOperations);
}
// If Dynamo is launched from an integrator host, user should be able to close the splash screen window.
// Additionally, we will have to shutdown the ViewModel which will close all the services and dispose the events.
// RequestUpdateLoadBarStatus event needs to be unsubscribed when the splash screen window is closed, to avoid populating the info on splash screen.
else if (this is SplashScreen)
{
this.Close();
viewModel.Model.ShutDown(false);
}
}

protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);

DynamoModel.RequestUpdateLoadBarStatus -= DynamoModel_RequestUpdateLoadBarStatus;
webView.Dispose();
webView = null;

Expand Down

0 comments on commit cc95adf

Please sign in to comment.