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

DYN-6839 Dynamo Home Analytics #15218

Merged
merged 5 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
22 changes: 14 additions & 8 deletions src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ public HomePage()
InitializeComponent();
InitializeGuideTourItems();

dynWebView = new DynamoWebView2();
dynWebView = new DynamoWebView2
{
Margin = new System.Windows.Thickness(0), // Set margin to zero
ZoomFactor = 1.0 // Set zoom factor (optional)
};

dynWebView.Margin = new System.Windows.Thickness(0); // Set margin to zero
dynWebView.ZoomFactor = 1.0; // Set zoom factor (optional)

HostGrid.Children.Add(dynWebView);

// Bind event handlers
Expand All @@ -81,7 +82,7 @@ public HomePage()
RequestNewCustomNodeWorkspace = NewCustomNodeWorkspace;
RequestShowSampleFilesInFolder = ShowSampleFilesInFolder;
RequestShowBackupFilesInFolder = ShowBackupFilesInFolder;
RequestShowTemplate = ShowTemplate;
RequestShowTemplate = OpenTemplate;
RequestApplicationLoaded = ApplicationLoaded;

DataContextChanged += OnDataContextChanged;
Expand Down Expand Up @@ -127,7 +128,7 @@ private void DynamoViewModel_PropertyChanged(object sender, System.ComponentMode
/// This is used before DynamoModel initialization specifically to get user data dir
/// </summary>
/// <returns></returns>
private string GetUserDirectory()
private static string GetUserDirectory()
{
var version = AssemblyHelper.GetDynamoVersion();

Expand Down Expand Up @@ -408,6 +409,7 @@ internal void StartGuidedTour(string path)
internal void NewWorkspace()
{
this.startPage?.DynamoViewModel?.NewHomeWorkspaceCommand.Execute(null);
Logging.Analytics.TrackEvent(Logging.Actions.New, Logging.Categories.DynamoHomeOperations, "Workspace");
}

internal void OpenWorkspace()
Expand All @@ -419,6 +421,7 @@ internal void OpenWorkspace()
}

this.startPage?.DynamoViewModel?.ShowOpenDialogAndOpenResultCommand.Execute(null);
Logging.Analytics.TrackEvent(Logging.Actions.Open, Logging.Categories.DynamoHomeOperations);
}

internal void NewCustomNodeWorkspace()
Expand All @@ -430,6 +433,7 @@ internal void NewCustomNodeWorkspace()
}

this.startPage?.DynamoViewModel?.ShowNewFunctionDialogCommand.Execute(null);
Logging.Analytics.TrackEvent(Logging.Actions.New, Logging.Categories.DynamoHomeOperations, "Custom Node Workspace");
}

internal void ShowSampleFilesInFolder()
Expand Down Expand Up @@ -457,9 +461,10 @@ internal void ShowBackupFilesInFolder()

Process.Start(new ProcessStartInfo("explorer.exe", this.startPage.DynamoViewModel.Model.PathManager.BackupDirectory)
{ UseShellExecute = true });
Logging.Analytics.TrackEvent(Logging.Actions.Show, Logging.Categories.DynamoHomeOperations, "Backup Files");
}

internal void ShowTemplate()
internal void OpenTemplate()
{
if (DynamoModel.IsTestMode)
{
Expand All @@ -468,7 +473,8 @@ internal void ShowTemplate()
}

// Equivalent to CommandParameter="Template"
this.startPage?.DynamoViewModel?.ShowOpenTemplateDialogCommand.Execute("Template");
this.startPage?.DynamoViewModel?.ShowOpenTemplateDialogCommand.Execute("Template");
Logging.Analytics.TrackEvent(Logging.Actions.Open, Logging.Categories.DynamoHomeOperations, "Template");
}

internal void ApplicationLoaded()
Expand Down
10 changes: 9 additions & 1 deletion src/NodeServices/IAnalyticsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ namespace Dynamo.Logging
/// </summary>
public enum Categories
{
/// XXXOperations usually means actions from Dynamo users
/// v.s. XXX usually means actions from the Dynamo component itself

/// <summary>
/// Events Category related to application lifecycle
/// </summary>
Expand Down Expand Up @@ -142,7 +145,12 @@ public enum Categories
/// <summary>
/// Events Category related to DynamoMLDataPipeline
/// </summary>
DynamoMLDataPipelineOperations
DynamoMLDataPipelineOperations,

/// <summary>
/// Events Category related to DynamoHome
/// </summary>
DynamoHomeOperations
}

/// <summary>
Expand Down
Loading