diff --git a/README.md b/README.md index d587279..5f5bc9e 100644 --- a/README.md +++ b/README.md @@ -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)). diff --git a/SpeckleUi.sln b/SpeckleUi.sln index a4397e1..fa561d2 100644 --- a/SpeckleUi.sln +++ b/SpeckleUi.sln @@ -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 @@ -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 @@ -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 diff --git a/SpeckleUiBase/Properties/AssemblyInfo.cs b/SpeckleUiBase/Properties/AssemblyInfo.cs index 9b44237..43ae7b3 100644 --- a/SpeckleUiBase/Properties/AssemblyInfo.cs +++ b/SpeckleUiBase/Properties/AssemblyInfo.cs @@ -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")] diff --git a/SpeckleUiBase/SelectionFilter.cs b/SpeckleUiBase/SelectionFilter.cs new file mode 100644 index 0000000..47913b8 --- /dev/null +++ b/SpeckleUiBase/SelectionFilter.cs @@ -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 Selection = new List(); + } + + public class ListSelectionFilter : ISelectionFilter + { + public string Name { get; set; } + public string Icon { get; set; } + public string Type { get { return typeof(ListSelectionFilter).ToString(); } } + + public List Values { get; set; } + public List Selection = new List(); + } + + public class PropertySelectionFilter : ISelectionFilter + { + public string Name { get; set; } + public string Icon { get; set; } + public string Type { get { return typeof(PropertySelectionFilter).ToString(); } } + + public List Values { get; set; } + public List Operators { get; set; } + public string PropertyName { get; set; } + public string PropertyValue { get; set; } + public string PropertyOperator { get; set; } + public bool HasCustomProperty { get; set; } + } + + + + + + +} diff --git a/SpeckleUiBase/SpeckleUiBase.csproj b/SpeckleUiBase/SpeckleUiBase.csproj index 035dbd2..50c49a3 100644 --- a/SpeckleUiBase/SpeckleUiBase.csproj +++ b/SpeckleUiBase/SpeckleUiBase.csproj @@ -43,7 +43,7 @@ true bin\Debug\ DEBUG;TRACE - full + portable x64 prompt MinimumRecommendedRules.ruleset @@ -52,22 +52,38 @@ bin\Release\ TRACE true - pdbonly + portable x64 prompt MinimumRecommendedRules.ruleset + true + + ..\packages\Countly.19.8.0\lib\net40-client\Countly.dll + + + ..\packages\DeviceId.4.3.0\lib\net40\DeviceId.dll + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll - - ..\packages\SpeckleCore.1.5.2.343\lib\net45\SpeckleCore.dll + + ..\packages\SpeckleCore.1.6.9\lib\net45\SpeckleCore.dll - - ..\packages\SpecklePopup.1.6.8\lib\net45\SpecklePopup.dll + + ..\packages\SpecklePopup.1.6.13\lib\net45\SpecklePopup.dll ..\packages\sqlite-net-pcl.1.5.231\lib\netstandard1.1\SQLite-net.dll @@ -95,6 +111,8 @@ ..\packages\System.IO.Compression.ZipFile.4.0.1\lib\net46\System.IO.Compression.ZipFile.dll True + + C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1\System.Xaml.dll @@ -111,6 +129,7 @@ + @@ -126,6 +145,7 @@ + @@ -152,4 +172,11 @@ + + + + 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}. + + + \ No newline at end of file diff --git a/SpeckleUiBase/SpeckleUiBase.nuspec b/SpeckleUiBase/SpeckleUiBase.nuspec index 0b82fee..2e849f0 100644 --- a/SpeckleUiBase/SpeckleUiBase.nuspec +++ b/SpeckleUiBase/SpeckleUiBase.nuspec @@ -15,10 +15,10 @@ $copyright$ speckle ui base package - + - + \ No newline at end of file diff --git a/SpeckleUiBase/SpeckleUiBindings.cs b/SpeckleUiBase/SpeckleUiBindings.cs index 4cd9825..1a3eaf5 100644 --- a/SpeckleUiBase/SpeckleUiBindings.cs +++ b/SpeckleUiBase/SpeckleUiBindings.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -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() @@ -25,7 +26,7 @@ public SpeckleUIBindings() /// /// The event's name. /// The event args, which will be serialised to a string. - 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 ); @@ -36,7 +37,7 @@ public void NotifyUi( string eventName, dynamic eventInfo ) /// /// /// - 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 ); @@ -45,12 +46,12 @@ public void DispatchStoreActionUi( string storeActionName, string args = null ) /// /// Pops open the dev tools. /// - public void ShowDev() + public virtual void ShowDev() { Browser.ShowDevTools(); } - public void ShowAccountsPopup( ) + public virtual void ShowAccountsPopup( ) { Window.Dispatcher.Invoke( ( ) => { @@ -68,16 +69,47 @@ public void ShowAccountsPopup( ) /// Gets the current accounts. /// /// - 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(); + /// /// Returns the serialised clients present in the current open host file. /// @@ -89,6 +121,16 @@ public string GetAccounts() /// public abstract void AddSender( string args ); + /// + /// Updates a sender and persits the info to the host file + /// + public abstract void UpdateSender(string args); + + /// + /// Pushes a sender's stream + /// + public abstract void PushSender(string args); + /// /// Adds the current selection to the provided client. /// @@ -117,8 +159,6 @@ public string GetAccounts() /// 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 ); @@ -128,5 +168,10 @@ public string GetAccounts() /// /// public abstract void SelectClientObjects( string args ); + + public abstract List GetSelectionFilters(); + + #endregion + } } diff --git a/SpeckleUiBase/SpeckleUiWindow.xaml.cs b/SpeckleUiBase/SpeckleUiWindow.xaml.cs index e2f229d..c9c7696 100644 --- a/SpeckleUiBase/SpeckleUiWindow.xaml.cs +++ b/SpeckleUiBase/SpeckleUiWindow.xaml.cs @@ -28,7 +28,7 @@ public partial class SpeckleUiWindow : Window /// /// Your implementation of the SpeckleUiBindings class. /// Defaults to the master branch release of the web ui app. Change it to where you're running your local server when debugging! - public SpeckleUiWindow( SpeckleUIBindings baseBindings, string address = "https://appui.speckle.systems/#/" ) + public SpeckleUiWindow( SpeckleUIBindings baseBindings, string address = "https://matteo-dev.appui.speckle.systems/#/" ) { InitializeComponent(); diff --git a/SpeckleUiBase/app.config b/SpeckleUiBase/app.config index a90565c..0de5600 100644 --- a/SpeckleUiBase/app.config +++ b/SpeckleUiBase/app.config @@ -6,6 +6,10 @@ + + + + \ No newline at end of file diff --git a/SpeckleUiBase/packages.config b/SpeckleUiBase/packages.config index e3ea080..b645989 100644 --- a/SpeckleUiBase/packages.config +++ b/SpeckleUiBase/packages.config @@ -4,9 +4,14 @@ + + + + + - - + + diff --git a/SpeckleUiTester/App.config b/SpeckleUiTester/App.config index 4bba09a..1329725 100644 --- a/SpeckleUiTester/App.config +++ b/SpeckleUiTester/App.config @@ -1,6 +1,14 @@ - + + + + + + + + + \ No newline at end of file diff --git a/SpeckleUiTester/App.xaml.cs b/SpeckleUiTester/App.xaml.cs index 11019dc..2a3cb4e 100644 --- a/SpeckleUiTester/App.xaml.cs +++ b/SpeckleUiTester/App.xaml.cs @@ -19,10 +19,10 @@ public partial class App : Application private void Application_Startup( object sender, StartupEventArgs e ) { -#if DEBUG - UiWindow = new SpeckleUiWindow( new TestBindings(), @"http://10.211.55.2:8080/#/" ); -#else - UiWindow = new SpeckleUiWindow( new TestBindings() ); // On release, default to the latest ci-ed version from https://appui.speckle.systems +#if DEBUG + UiWindow = new SpeckleUiWindow( new TestBindings(), @"https://matteo-dev.appui.speckle.systems/#/"); +#else + UiWindow = new SpeckleUiWindow( new TestBindings() ); // On release, default to the latest ci-ed version from https://appui.speckle.systems #endif UiWindow.Show(); @@ -55,7 +55,12 @@ public override void AddReceiver( string _args ) public override void AddSender( string args ) { - throw new NotImplementedException(); + //throw new NotImplementedException(); + } + + public override void UpdateSender(string args) + { + //throw new NotImplementedException(); } public override void BakeReceiver( string args ) @@ -116,12 +121,50 @@ public override void RemoveSelectionFromSender( string args ) throw new NotImplementedException(); } - public override void UpdateSender( string args ) + public override void SelectClientObjects( string args ) { throw new NotImplementedException(); } - public override void SelectClientObjects( string args ) + public override List GetSelectionFilters() + { + return new List + { + new ElementsSelectionFilter + { + Name = "Selection", + Icon = "mouse", + //Count = 99 + }, + new ListSelectionFilter + { + Name = "Category", + Icon = "category", + Values = new List + { + "Walls", + "Doors", + "Floors", + "Structural Elements", + "Dimitries", + "Lols" + } + }, + new PropertySelectionFilter + { + Name = "Property", + Icon = "filter_list", + HasCustomProperty = true, + Values = new List + { + "Family Name", + "Family Type" + } + } + }; + } + + public override void PushSender( string args ) { throw new NotImplementedException(); } diff --git a/SpeckleUiTester/SpeckleUiTester.csproj b/SpeckleUiTester/SpeckleUiTester.csproj index 886097c..c3f71de 100644 --- a/SpeckleUiTester/SpeckleUiTester.csproj +++ b/SpeckleUiTester/SpeckleUiTester.csproj @@ -52,11 +52,12 @@ bin\Release\ TRACE true - pdbonly + portable x64 prompt MinimumRecommendedRules.ruleset true + true @@ -143,11 +144,11 @@ - + + + diff --git a/appveyor.yml b/appveyor.yml index 4689e29..6e55f75 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,55 +1,55 @@ -version: '{build}' -image: Visual Studio 2019 - -init: - - ps: | - If($Env:APPVEYOR_REPO_TAG -eq "true") - { - Write-Host "We now have a tagged release. Proper." - Write-Host "Tag is $Env:APPVEYOR_REPO_TAG_NAME" +version: '{build}' +image: Visual Studio 2019 + +init: + - ps: | + If($Env:APPVEYOR_REPO_TAG -eq "true") + { + Write-Host "We now have a tagged release. Proper." + Write-Host "Tag is $Env:APPVEYOR_REPO_TAG_NAME" $env:APPVEYOR_BUILD_VERSION=$env:APPVEYOR_REPO_TAG_NAME Update-AppveyorBuild -Version "$Env:APPVEYOR_REPO_TAG_NAME" - } - else - { - $releases = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/releases" - $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name - $spl = $tag.Split("-")[0] + } + else + { + $releases = "https://api.github.com/repos/$env:APPVEYOR_REPO_NAME/releases" + $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name + $spl = $tag.Split("-")[0] Update-AppveyorBuild -Version "$spl.$Env:APPVEYOR_BUILD_VERSION-wip" - } - Write-Host "Hello. Build version for SpeckleUiBase is: $Env:APPVEYOR_BUILD_VERSION" - -before_build: -- cmd: >- - nuget restore -# version -assembly_info: - patch: true - file: AssemblyInfo.* - assembly_version: '{version}' - assembly_file_version: '{version}' - assembly_informational_version: '{version}' - -build: - publish_nuget: true - include_nuget_references: true - publish_nuget_symbols: true - use_snupkg_format: true - project: SpeckleUiBase\SpeckleUiBase.csproj - verbosity: minimal - -deploy: - - provider: NuGet - server: # remove to push to NuGet.org - api_key: - secure: n4EiHDLVSLjOzqT7OOOg3US3PWs6fNsOaGpyT/EFBKrTKl/1wMmmKt73MNuTngD+ - skip_symbols: false - symbol_server: # remove to push symbols to SymbolSource.org - on: - appveyor_repo_tag: true - -platform: - - x64 - -configuration: - - Release + } + Write-Host "Hello. Build version for SpeckleUiBase is: $Env:APPVEYOR_BUILD_VERSION" + +before_build: +- cmd: >- + nuget restore +# version +assembly_info: + patch: true + file: AssemblyInfo.* + assembly_version: '{version}' + assembly_file_version: '{version}' + assembly_informational_version: '{version}' + +build: + publish_nuget: true + include_nuget_references: true + publish_nuget_symbols: true + use_snupkg_format: true + project: SpeckleUiBase\SpeckleUiBase.csproj + verbosity: minimal + +deploy: + - provider: NuGet + server: # remove to push to NuGet.org + api_key: + secure: n4EiHDLVSLjOzqT7OOOg3US3PWs6fNsOaGpyT/EFBKrTKl/1wMmmKt73MNuTngD+ + skip_symbols: false + symbol_server: # remove to push symbols to SymbolSource.org + on: + appveyor_repo_tag: true + +platform: + - x64 + +configuration: + - Release