Skip to content

Commit

Permalink
Merge pull request #39 from reddyashish/master
Browse files Browse the repository at this point in the history
TuneUp menu item should be under Extensions menu.
  • Loading branch information
reddyashish authored Aug 3, 2021
2 parents 8d5026b + 482674a commit 5e74307
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 deletions.
10 changes: 5 additions & 5 deletions TuneUp/TuneUp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TuneUp</RootNamespace>
<AssemblyName>TuneUp</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files\Dynamo\Dynamo Core\2\DynamoSandbox.exe</StartProgram>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -65,17 +65,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.Core">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.DynamoServices">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.WpfUILibrary">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
<ExcludeAssets>runtime</ExcludeAssets>
<IncludeAssets>compile; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand All @@ -93,7 +93,7 @@
</Target>
-->
<PropertyGroup>
<DynamoVersion>2.5</DynamoVersion>
<DynamoVersion>2.12</DynamoVersion>
<PackageName>TuneUp</PackageName>
<PackageFolder>$(ProjectDir)dist\$(PackageName)\</PackageFolder>
<BinFolder>$(PackageFolder)bin\</BinFolder>
Expand Down
40 changes: 31 additions & 9 deletions TuneUp/TuneUpViewExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System.Linq;
using System.Windows.Controls;
using Dynamo.Wpf.Extensions;

Expand All @@ -9,24 +9,27 @@ namespace TuneUp
/// which allows Dynamo users to analyze the performance of graphs
/// and diagnose bottlenecks and problem areas.
/// </summary>
public class TuneUpViewExtension : IViewExtension
public class TuneUpViewExtension : ViewExtensionBase, IViewExtension
{
internal MenuItem TuneUpMenuItem;
private TuneUpWindow TuneUpView;
internal TuneUpWindowViewModel ViewModel;

public void Dispose()
public override void Dispose()
{
TuneUpView.Dispose();
}

public void Startup(ViewStartupParams p)
public override void Startup(ViewStartupParams p)
{
}

public void Loaded(ViewLoadedParams p)
public override void Loaded(ViewLoadedParams p)
{
// Use dynamic object type of ViewLoadedParams to dynamically call its methods.
dynamic dp = (dynamic) p;
ViewModel = new TuneUpWindowViewModel(p);

TuneUpView = new TuneUpWindow(p, UniqueId)
{
// Set the data context for the main grid in the window.
Expand All @@ -47,9 +50,20 @@ public void Loaded(ViewLoadedParams p)
{
p.CloseExtensioninInSideBar(this);
}

};
p.AddMenuItem(MenuBarType.View, TuneUpMenuItem);

// Add this view extension's menu item to the Extensions tab or View tab accordingly.
var dynamoMenuItems = p.dynamoMenu.Items.OfType<MenuItem>();
var extensionsMenuItem = dynamoMenuItems.Where(item => item.Header.ToString() == "_Extensions");

if (extensionsMenuItem.Count() > 0)
{
dp.AddExtensionMenuItem(TuneUpMenuItem);
}
else
{
dp.AddMenuItem(MenuBarType.View, TuneUpMenuItem);
}
}

/// <summary>
Expand All @@ -63,7 +77,7 @@ public void Shutdown()
/// <summary>
/// ID for the TuneUp extension
/// </summary>
public string UniqueId
public override string UniqueId
{
get
{
Expand All @@ -74,12 +88,20 @@ public string UniqueId
/// <summary>
/// Name of this extension
/// </summary>
public string Name
public override string Name
{
get
{
return "TuneUp";
}
}

public override void Closed()
{
if (this.TuneUpMenuItem != null)
{
this.TuneUpMenuItem.IsChecked = false;
}
}
}
}
10 changes: 5 additions & 5 deletions TuneUpTests/TuneUpTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TuneUpTests</RootNamespace>
<AssemblyName>TuneUpTests</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
Expand Down Expand Up @@ -65,16 +65,16 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.Core">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.DynamoServices">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.Tests">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
</PackageReference>
<PackageReference Include="DynamoVisualProgramming.ZeroTouchLibrary">
<Version>2.5.0.7432</Version>
<Version>2.12.0.5650</Version>
</PackageReference>
<PackageReference Include="MSTest.TestAdapter">
<Version>1.3.2</Version>
Expand Down

0 comments on commit 5e74307

Please sign in to comment.