Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from speckleworks/Matteo/dev
Browse files Browse the repository at this point in the history
Matteo/dev
  • Loading branch information
teocomi authored Jan 29, 2020
2 parents 68864ca + 6ffa073 commit 05aa7d2
Show file tree
Hide file tree
Showing 14 changed files with 287 additions and 98 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Netlify Status](https://api.netlify.com/api/v1/badges/e4824a5c-a6df-4670-b242-4873d26901ba/deploy-status)](https://app.netlify.com/sites/distracted-jones-770c28/deploys)

# SpeckleUi
Base speckle ui for embedding in .net apps. It consists of two parts, a .NET scaffold (this repo), and vuejs web app (can be found [here](https://github.com/speckleworks/SpeckleUiApp)).

Expand Down
25 changes: 12 additions & 13 deletions SpeckleUi.sln
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2048
# Visual Studio Version 16
VisualStudioVersion = 16.0.29001.49
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeckleUiBase", "SpeckleUiBase\SpeckleUiBase.csproj", "{CE40C576-3B05-443A-A1BA-CB3A796D0084}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeckleUiTester", "SpeckleUiTester\SpeckleUiTester.csproj", "{BBEF9956-108C-42B7-B03D-7A426114324B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D8589006-2100-430D-A313-EF0704D40CAB}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
SpeckleUi.nuspec = SpeckleUi.nuspec
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeckleUiBase", "SpeckleUiBase\SpeckleUiBase.csproj", "{CE40C576-3B05-443A-A1BA-CB3A796D0084}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,14 +20,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|Any CPU.ActiveCfg = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|Any CPU.Build.0 = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|x64.ActiveCfg = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|x64.Build.0 = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|Any CPU.ActiveCfg = Release|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|Any CPU.Build.0 = Release|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|x64.ActiveCfg = Release|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|x64.Build.0 = Release|x64
{BBEF9956-108C-42B7-B03D-7A426114324B}.Debug|Any CPU.ActiveCfg = Debug|x64
{BBEF9956-108C-42B7-B03D-7A426114324B}.Debug|Any CPU.Build.0 = Debug|x64
{BBEF9956-108C-42B7-B03D-7A426114324B}.Debug|x64.ActiveCfg = Debug|x64
Expand All @@ -37,6 +28,14 @@ Global
{BBEF9956-108C-42B7-B03D-7A426114324B}.Release|Any CPU.Build.0 = Release|x64
{BBEF9956-108C-42B7-B03D-7A426114324B}.Release|x64.ActiveCfg = Release|x64
{BBEF9956-108C-42B7-B03D-7A426114324B}.Release|x64.Build.0 = Release|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|x64.ActiveCfg = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Debug|x64.Build.0 = Debug|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|Any CPU.Build.0 = Release|Any CPU
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|x64.ActiveCfg = Release|x64
{CE40C576-3B05-443A-A1BA-CB3A796D0084}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions SpeckleUiBase/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
54 changes: 54 additions & 0 deletions SpeckleUiBase/SelectionFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpeckleUiBase
{
public interface ISelectionFilter
{
string Name { get; set; }
string Icon { get; set; }
string Type { get; }
}

public class ElementsSelectionFilter : ISelectionFilter
{
public string Name { get; set; }
public string Icon { get; set; }
public string Type { get { return typeof(ElementsSelectionFilter).ToString(); } }

public List<string> Selection = new List<string>();
}

public class ListSelectionFilter : ISelectionFilter
{
public string Name { get; set; }
public string Icon { get; set; }
public string Type { get { return typeof(ListSelectionFilter).ToString(); } }

public List<string> Values { get; set; }
public List<string> Selection = new List<string>();
}

public class PropertySelectionFilter : ISelectionFilter
{
public string Name { get; set; }
public string Icon { get; set; }
public string Type { get { return typeof(PropertySelectionFilter).ToString(); } }

public List<string> Values { get; set; }
public List<string> Operators { get; set; }
public string PropertyName { get; set; }
public string PropertyValue { get; set; }
public string PropertyOperator { get; set; }
public bool HasCustomProperty { get; set; }
}






}
39 changes: 33 additions & 6 deletions SpeckleUiBase/SpeckleUiBase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<DebugType>portable</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
Expand All @@ -52,22 +52,38 @@
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<DebugType>portable</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Countly, Version=19.8.0.0, Culture=neutral, PublicKeyToken=30fd2b3d8bfe4882, processorArchitecture=MSIL">
<HintPath>..\packages\Countly.19.8.0\lib\net40-client\Countly.dll</HintPath>
</Reference>
<Reference Include="DeviceId, Version=4.3.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DeviceId.4.3.0\lib\net40\DeviceId.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop, Version=1.0.168.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="SpeckleCore, Version=1.5.2.343, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\SpeckleCore.1.5.2.343\lib\net45\SpeckleCore.dll</HintPath>
<Reference Include="SpeckleCore, Version=1.6.9.0, Culture=neutral, processorArchitecture=AMD64">
<HintPath>..\packages\SpeckleCore.1.6.9\lib\net45\SpeckleCore.dll</HintPath>
</Reference>
<Reference Include="SpecklePopup, Version=1.6.8.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SpecklePopup.1.6.8\lib\net45\SpecklePopup.dll</HintPath>
<Reference Include="SpecklePopup, Version=1.6.13.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SpecklePopup.1.6.13\lib\net45\SpecklePopup.dll</HintPath>
</Reference>
<Reference Include="SQLite-net, Version=1.5.231.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll</HintPath>
Expand Down Expand Up @@ -95,6 +111,8 @@
<HintPath>..\packages\System.IO.Compression.ZipFile.4.0.1\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Management" />
<Reference Include="System.Net" />
<Reference Include="System.Xaml">
<HintPath>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Xaml.dll</HintPath>
</Reference>
Expand All @@ -111,6 +129,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="SelectionFilter.cs" />
<Compile Include="SpeckleUiBindings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SpeckleUiWindow.xaml.cs">
Expand All @@ -126,6 +145,7 @@
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="SpeckleUiBase.nuspec" />
</ItemGroup>
<ItemGroup>
<Resource Include="Assets\speckle.ico" />
Expand All @@ -152,4 +172,11 @@
<Import Project="..\packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets" Condition="Exists('..\packages\cef.redist.x86.3.2987.1601\build\cef.redist.x86.targets')" />
<Import Project="..\packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets" Condition="Exists('..\packages\CefSharp.Common.57.0.0\build\CefSharp.Common.targets')" />
<Import Project="..\packages\CefSharp.Wpf.57.0.0\build\CefSharp.Wpf.targets" Condition="Exists('..\packages\CefSharp.Wpf.57.0.0\build\CefSharp.Wpf.targets')" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions SpeckleUiBase/SpeckleUiBase.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<copyright>$copyright$</copyright>
<tags>speckle ui base package</tags>
<dependencies>
<dependency id="SpeckleCore" version="1.5.2" />
<dependency id="SpeckleCore" version="1.6.9" />
<dependency id="Newtonsoft.Json" version="12.0.2" />
<dependency id="CefSharp.Wpf" version="57.0.0" />
<dependency id="SpecklePopup" version="1.6.8" />
<dependency id="SpecklePopup" version="1.6.13" />
</dependencies>
</metadata>
</package>
61 changes: 53 additions & 8 deletions SpeckleUiBase/SpeckleUiBindings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -11,7 +12,7 @@ namespace SpeckleUiBase
{
public abstract class SpeckleUIBindings
{
public ChromiumWebBrowser Browser { get; set; }
public IWebBrowser Browser { get; set; }
public SpeckleUiWindow Window { get; set; }

public SpeckleUIBindings()
Expand All @@ -25,7 +26,7 @@ public SpeckleUIBindings()
/// </summary>
/// <param name="eventName">The event's name.</param>
/// <param name="eventInfo">The event args, which will be serialised to a string.</param>
public void NotifyUi( string eventName, dynamic eventInfo )
public virtual void NotifyUi( string eventName, dynamic eventInfo )
{
var script = string.Format( "window.EventBus.$emit('{0}', {1})", eventName, JsonConvert.SerializeObject( eventInfo ) );
Browser.GetMainFrame().EvaluateScriptAsync( script );
Expand All @@ -36,7 +37,7 @@ public void NotifyUi( string eventName, dynamic eventInfo )
/// </summary>
/// <param name="storeActionName"></param>
/// <param name="args"></param>
public void DispatchStoreActionUi( string storeActionName, string args = null )
public virtual void DispatchStoreActionUi( string storeActionName, string args = null )
{
var script = string.Format( "window.Store.dispatch('{0}', '{1}')", storeActionName, args );
Browser.GetMainFrame().EvaluateScriptAsync( script );
Expand All @@ -45,12 +46,12 @@ public void DispatchStoreActionUi( string storeActionName, string args = null )
/// <summary>
/// Pops open the dev tools.
/// </summary>
public void ShowDev()
public virtual void ShowDev()
{
Browser.ShowDevTools();
}

public void ShowAccountsPopup( )
public virtual void ShowAccountsPopup( )
{
Window.Dispatcher.Invoke( ( ) =>
{
Expand All @@ -68,16 +69,47 @@ public void ShowAccountsPopup( )
/// Gets the current accounts.
/// </summary>
/// <returns></returns>
public string GetAccounts()
public virtual string GetAccounts()
{
return JsonConvert.SerializeObject( SpeckleCore.LocalContext.GetAllAccounts() );
}

public virtual string GetFilters()
{
return JsonConvert.SerializeObject(GetSelectionFilters());
}

public virtual void StartProcess(string args)
{
try
{
Process.Start(args);
}
catch (Exception e)
{

}

}

public virtual bool CanSelectObjects()
{
return false;
}

public virtual bool CanTogglePreview()
{
return false;
}

#region abstract methods

public abstract string GetApplicationHostName();
public abstract string GetFileName();
public abstract string GetDocumentId();
public abstract string GetDocumentLocation();


/// <summary>
/// Returns the serialised clients present in the current open host file.
/// </summary>
Expand All @@ -89,6 +121,16 @@ public string GetAccounts()
/// </summary>
public abstract void AddSender( string args );

/// <summary>
/// Updates a sender and persits the info to the host file
/// </summary>
public abstract void UpdateSender(string args);

/// <summary>
/// Pushes a sender's stream
/// </summary>
public abstract void PushSender(string args);

/// <summary>
/// Adds the current selection to the provided client.
/// </summary>
Expand Down Expand Up @@ -117,8 +159,6 @@ public string GetAccounts()
/// <param name="args"></param>
public abstract void BakeReceiver( string args );

public abstract void UpdateSender( string args );

// TODO: See how we go about this
public abstract void AddObjectsToSender( string args );
public abstract void RemoveObjectsFromSender( string args );
Expand All @@ -128,5 +168,10 @@ public string GetAccounts()
/// </summary>
/// <param name="args"></param>
public abstract void SelectClientObjects( string args );

public abstract List<ISelectionFilter> GetSelectionFilters();

#endregion

}
}
2 changes: 1 addition & 1 deletion SpeckleUiBase/SpeckleUiWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class SpeckleUiWindow : Window
/// </summary>
/// <param name="baseBindings">Your implementation of the SpeckleUiBindings class.</param>
/// <param name="address">Defaults to the master branch release of the web ui app. Change it to where you're running your local server when debugging!</param>
public SpeckleUiWindow( SpeckleUIBindings baseBindings, string address = "https://appui.speckle.systems/#/" )
public SpeckleUiWindow( SpeckleUIBindings baseBindings, string address = "https://matteo-dev.appui.speckle.systems/#/" )
{
InitializeComponent();

Expand Down
4 changes: 4 additions & 0 deletions SpeckleUiBase/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<assemblyIdentity name="websocket-sharp" publicKeyToken="5660b08a1845a91e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.2.32519" newVersion="1.0.2.32519" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
9 changes: 7 additions & 2 deletions SpeckleUiBase/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
<package id="cef.redist.x86" version="3.2987.1601" targetFramework="net471" />
<package id="CefSharp.Common" version="57.0.0" targetFramework="net471" />
<package id="CefSharp.Wpf" version="57.0.0" targetFramework="net471" />
<package id="Countly" version="19.8.0" targetFramework="net452" />
<package id="DeviceId" version="4.3.0" targetFramework="net452" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net452" />
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net452" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net452" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net452" />
<package id="SpeckleCore" version="1.5.2.343" targetFramework="net452" />
<package id="SpecklePopup" version="1.6.8" targetFramework="net452" />
<package id="SpeckleCore" version="1.6.9" targetFramework="net452" />
<package id="SpecklePopup" version="1.6.13" targetFramework="net452" />
<package id="sqlite-net-pcl" version="1.5.231" targetFramework="net45" />
<package id="SQLitePCLRaw.bundle_green" version="1.1.11" targetFramework="net45" />
<package id="SQLitePCLRaw.core" version="1.1.11" targetFramework="net45" />
Expand Down
Loading

0 comments on commit 05aa7d2

Please sign in to comment.