forked from deephaven/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
3,668 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System.Diagnostics; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Deephaven.ExcelAddIn.ExcelDna; | ||
using Deephaven.ExcelAddIn.Factories; | ||
using Deephaven.ExcelAddIn.Models; | ||
using Deephaven.ExcelAddIn.Operations; | ||
using Deephaven.ExcelAddIn.Providers; | ||
using Deephaven.ExcelAddIn.Viewmodels; | ||
using Deephaven.ExcelAddIn.Views; | ||
using ExcelDna.Integration; | ||
|
||
namespace Deephaven.ExcelAddIn; | ||
|
||
public static class DeephavenExcelFunctions { | ||
private static readonly StateManager StateManager = new(); | ||
|
||
[ExcelCommand(MenuName = "Deephaven", MenuText = "Connections")] | ||
public static void ShowConnectionsDialog() { | ||
ConnectionManagerDialogFactory.CreateAndShow(StateManager); | ||
} | ||
|
||
[ExcelFunction(Description = "Snapshots a table", IsThreadSafe = true)] | ||
public static object DEEPHAVEN_SNAPSHOT(string tableDescriptor, object filter, object wantHeaders) { | ||
if (!TryInterpretCommonArgs(tableDescriptor, filter, wantHeaders, out var td, out var filt, out var wh, out var errorText)) { | ||
return errorText; | ||
} | ||
|
||
// These two are used by ExcelDNA to share results for identical invocations. The functionName is arbitary but unique. | ||
const string functionName = "Deephaven.ExcelAddIn.DeephavenExcelFunctions.DEEPHAVEN_SNAPSHOT"; | ||
var parms = new[] { tableDescriptor, filter, wantHeaders }; | ||
ExcelObservableSource eos = () => new SnapshotOperation(td!, filt, wh, StateManager); | ||
return ExcelAsyncUtil.Observe(functionName, parms, eos); | ||
} | ||
|
||
[ExcelFunction(Description = "Subscribes to a table", IsThreadSafe = true)] | ||
public static object DEEPHAVEN_SUBSCRIBE(string tableDescriptor, object filter, object wantHeaders) { | ||
if (!TryInterpretCommonArgs(tableDescriptor, filter, wantHeaders, out var td, out var filt, out var wh, out string errorText)) { | ||
return errorText; | ||
} | ||
// These two are used by ExcelDNA to share results for identical invocations. The functionName is arbitary but unique. | ||
const string functionName = "Deephaven.ExcelAddIn.DeephavenExcelFunctions.DEEPHAVEN_SUBSCRIBE"; | ||
var parms = new[] { tableDescriptor, filter, wantHeaders }; | ||
ExcelObservableSource eos = () => new SubscribeOperation(td, filt, wh, StateManager); | ||
return ExcelAsyncUtil.Observe(functionName, parms, eos); | ||
} | ||
|
||
private static bool TryInterpretCommonArgs(string tableDescriptor, object filter, object wantHeaders, | ||
[NotNullWhen(true)]out TableTriple? tableDescriptorResult, out string filterResult, out bool wantHeadersResult, out string errorText) { | ||
filterResult = ""; | ||
wantHeadersResult = false; | ||
if (!TableTriple.TryParse(tableDescriptor, out tableDescriptorResult, out errorText)) { | ||
return false; | ||
} | ||
|
||
if (!ExcelDnaHelpers.TryInterpretAs(filter, "", out filterResult)) { | ||
errorText = "Can't interpret FILTER argument"; | ||
return false; | ||
} | ||
|
||
|
||
if (!ExcelDnaHelpers.TryInterpretAs(wantHeaders, false, out wantHeadersResult)) { | ||
errorText = "Can't interpret WANT_HEADERS argument"; | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="ExcelDna.Addin" Version="*-*" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\client\DeephavenClient\DeephavenClient.csproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup /> | ||
<ItemGroup> | ||
<Compile Update="views\ConnectionManagerDialog.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Update="views\CredentialsDialog.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34221.43 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ExcelAddIn", "ExcelAddIn.csproj", "{08852A0D-DB96-404E-B3CE-BF30F2AD3F74}" | ||
EndProject | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeephavenClient", "..\client\DeephavenClient\DeephavenClient.csproj", "{6848407D-1CEF-4433-92F4-6047AE3D2C52}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{08852A0D-DB96-404E-B3CE-BF30F2AD3F74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{08852A0D-DB96-404E-B3CE-BF30F2AD3F74}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{08852A0D-DB96-404E-B3CE-BF30F2AD3F74}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{08852A0D-DB96-404E-B3CE-BF30F2AD3F74}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{6848407D-1CEF-4433-92F4-6047AE3D2C52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6848407D-1CEF-4433-92F4-6047AE3D2C52}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6848407D-1CEF-4433-92F4-6047AE3D2C52}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6848407D-1CEF-4433-92F4-6047AE3D2C52}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {A22A4DB3-DD84-46EB-96A6-7935E9E59356} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"profiles": { | ||
"Excel": { | ||
"commandName": "Executable", | ||
"executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE", | ||
"commandLineArgs": "/x \"ExcelAddIn-AddIn64.xll\"" | ||
} | ||
} | ||
} |
Oops, something went wrong.