Skip to content

Commit

Permalink
Merge pull request #34 from InRule/Add_RuleAppMetricsExtension
Browse files Browse the repository at this point in the history
Add rule app metrics extension
  • Loading branch information
dagardiner authored Aug 8, 2022
2 parents e9880a9 + 19e7610 commit 2a376a6
Show file tree
Hide file tree
Showing 27 changed files with 2,267 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ These extensions are not officially supported by InRule Technology, but the sour
|[GenerateSDKCode](GenerateSDKCode)|Generates SDK Code to programmatically author elements using irSDK via the right-click menu
|[NavigationToolWindows](NavigationToolWindows)|Allows navigation panes to be converted to tool windows and vice versa
|[RefreshTemplateEngine](RefreshTemplateEngine)|Adds a ribbon button to refresh the template engine
|[RuleAppMetrics](RuleAppMetrics)|Generates a variety of telemetry about the currently open Rule Application
|[RuleFlowVisualizer](RuleFlowVisualizer)|Builds a visualization of the rule flow logic
|[TestUsingSampleData](TestUsingSampleData)|Allows irVerify to be launched with pre-filled data from JSON files on the local disk
|[TitleVersion](TitleVersion)|Adds the current version of irAuthor to the title bar of the application
Expand Down
25 changes: 25 additions & 0 deletions RuleAppMetrics/RuleAppMetrics.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RuleAppMetrics", "RuleAppMetrics\RuleAppMetrics.csproj", "{61796E87-E095-49B2-9284-361DEEB1644B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{61796E87-E095-49B2-9284-361DEEB1644B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61796E87-E095-49B2-9284-361DEEB1644B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61796E87-E095-49B2-9284-361DEEB1644B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61796E87-E095-49B2-9284-361DEEB1644B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {65432DB5-F456-40A9-AF22-F2EFA4A90184}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions RuleAppMetrics/RuleAppMetrics/App.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
47 changes: 47 additions & 0 deletions RuleAppMetrics/RuleAppMetrics/Controls/BooleanToHiddenConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace InRuleLabs.AuthoringExtensions.RuleAppMetrics.Controls
{
public class BooleanToHiddenConverter : IValueConverter
{
public virtual object Convert(object o, Type targetType, object parameter, CultureInfo culture)
{
bool value;

if (o is bool? || o is bool)
{
value = (bool)o;
}
else
{
throw new NotSupportedException("Only bool and nullable bool are supported.");
}

Visibility trueValue, falseValue;

if (!(parameter is string && Enum.TryParse((string)parameter, out trueValue)))
{
trueValue = Visibility.Collapsed;
}

if (trueValue == Visibility.Collapsed)
{
falseValue = Visibility.Visible;
}
else
{
falseValue = Visibility.Collapsed;
}

return value ? trueValue : falseValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace InRuleLabs.AuthoringExtensions.RuleAppMetrics.Controls
{
public class BooleanToVisibilityConverter : IValueConverter
{
public virtual object Convert(object o, Type targetType, object parameter, CultureInfo culture)
{
bool value;

if (o is bool? || o is bool)
{
value = (bool)o;
}
else
{
throw new NotSupportedException("Only bool and nullable bool are supported.");
}

Visibility trueValue, falseValue;

if (!(parameter is string && Enum.TryParse((string)parameter, out trueValue)))
{
trueValue = Visibility.Visible;
}

if (trueValue == Visibility.Visible)
{
falseValue = Visibility.Collapsed;
}
else
{
falseValue = Visibility.Visible;
}

return value ? trueValue : falseValue;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace InRuleLabs.AuthoringExtensions.RuleAppMetrics.Controls
{
public class DoubleToGridLengthConverter : IValueConverter
{
public virtual object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double)
{
return new GridLength((double)value, GridUnitType.Pixel);
}

if (value == null)
{
return new GridLength(0);
}

return new GridLength(0);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
Loading

0 comments on commit 2a376a6

Please sign in to comment.