Skip to content

Commit

Permalink
Update DynamoView.xaml.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pinzart90 committed Feb 26, 2024
1 parent 4353d2e commit cfbdb87
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
Expand All @@ -16,7 +15,6 @@
using System.Windows.Media.Imaging;
using System.Windows.Threading;
using Dynamo.Configuration;
using Dynamo.Core;
using Dynamo.Graph;
using Dynamo.Graph.Nodes;
using Dynamo.Graph.Notes;
Expand All @@ -25,7 +23,6 @@
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Nodes;
using Dynamo.Nodes.Prompts;
using Dynamo.PackageManager;
using Dynamo.PackageManager.UI;
using Dynamo.Search.SearchElements;
Expand Down Expand Up @@ -76,7 +73,6 @@ public partial class DynamoView : Window, IDisposable
private readonly Stopwatch _timer;

#region Open Workspace performance tools
private static int idleCounter;
private Stopwatch WorkspaceRenderedTimer;
#endregion

Expand Down Expand Up @@ -378,22 +374,10 @@ private void OnWorkspaceOpened(WorkspaceModel workspace)
DynamoModel.RaiseIExtensionStorageAccessWorkspaceOpened(hws, extension, dynamoViewModel.Model.Logger);
}

void Hooks_DispatcherInactive(object sender, EventArgs e)
{
if (idleCounter < 10)
{
Interlocked.Increment(ref idleCounter);
return;
}

Interlocked.Exchange(ref idleCounter, 0);
Dispatcher.BeginInvoke(new Action(() => {
dynamoViewModel.Model.Logger.Log($"Opened workspace found at {workspace.FileName} in {WorkspaceRenderedTimer.Elapsed}");
WorkspaceRenderedTimer.Reset();

Dispatcher.Hooks.DispatcherInactive -= Hooks_DispatcherInactive;
}

Dispatcher.Hooks.DispatcherInactive += Hooks_DispatcherInactive;
}), DispatcherPriority.Background);
}

private void OnWorkspaceSaving(WorkspaceModel workspace, Graph.SaveContext saveContext)
Expand Down

0 comments on commit cfbdb87

Please sign in to comment.