forked from morganstanley/ComposeUI
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://github.com/morganstanley/ComposeUI/issues/47
Create code skeleton for UICompse project and plugin prototypes
- Loading branch information
Showing
93 changed files
with
8,206 additions
and
0 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
27 changes: 27 additions & 0 deletions
27
...ey.ComposeUI.Playground.BasicModels/MorganStanley.ComposeUI.Playground.BasicModels.csproj
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,27 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Common\MorganStanley.ComposeUI.Common.BasicModels\MorganStanley.ComposeUI.Common.BasicModels.csproj" /> | ||
<ProjectReference Include="..\MorganStanley.ComposeUI.Playground.Interfaces\MorganStanley.ComposeUI.Playground.Interfaces.csproj" /> | ||
<ProjectReference Include="..\MorganStanley.ComposeUI.Playground.Utilities\MorganStanley.ComposeUI.Playground.Utilities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
20 changes: 20 additions & 0 deletions
20
Playground/MorganStanley.ComposeUI.Playground.Interfaces/ITextService.cs
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,20 @@ | ||
/// ******************************************************************************************************** | ||
/// | ||
/// Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
/// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
/// See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
/// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
/// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and limitations under the License. | ||
/// | ||
/// ******************************************************************************************************** | ||
|
||
namespace MorganStanley.ComposeUI.Playground.Interfaces | ||
{ | ||
public interface ITextService | ||
{ | ||
public void Send(string text); | ||
|
||
public event Action<string> SentTextEvent; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Playground/MorganStanley.ComposeUI.Playground.Interfaces/ITimeService.cs
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,7 @@ | ||
namespace MorganStanley.ComposeUI.Playground.Interfaces | ||
{ | ||
public interface ITimeService | ||
{ | ||
IObservable<DateTime> TimeObservable { get; } | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Playground/MorganStanley.ComposeUI.Playground.Interfaces/IoCNames.cs
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,18 @@ | ||
/// ******************************************************************************************************** | ||
/// | ||
/// Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
/// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
/// See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
/// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
/// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and limitations under the License. | ||
/// | ||
/// ******************************************************************************************************** | ||
|
||
namespace MorganStanley.ComposeUI.Playground.Interfaces | ||
{ | ||
public static class IoCNames | ||
{ | ||
public const string TimeServiceName = "TimeService"; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...nley.ComposeUI.Playground.Interfaces/MorganStanley.ComposeUI.Playground.Interfaces.csproj
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,29 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="ITimeService.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Common\MorganStanley.ComposeUI.Common.Interfaces\MorganStanley.ComposeUI.Common.Interfaces.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
23 changes: 23 additions & 0 deletions
23
...tanley.ComposeUI.Playground.Utilities/MorganStanley.ComposeUI.Playground.Utilities.csproj
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,23 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Common\MorganStanley.ComposeUI.Common.Utilities\MorganStanley.ComposeUI.Common.Utilities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
...ey.ComposeUI.Playground.VisualUtils/MorganStanley.ComposeUI.Playground.VisualUtils.csproj
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 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Common\MorganStanley.ComposeUI.Common.VisualUtils\MorganStanley.ComposeUI.Common.VisualUtils.csproj" /> | ||
<ProjectReference Include="..\MorganStanley.ComposeUI.Playground.Utilities\MorganStanley.ComposeUI.Playground.Utilities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
31 changes: 31 additions & 0 deletions
31
Playground/Plugins/Services/MockAuthentication/MockAuthentication.csproj
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 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Exec Command="xcopy "$(OutDir)\$(AssemblyName).dll" "$(SolutionDir)\bin\$(Configuration)\net6.0\Plugins\Services\$(ProjectName)\" /R /Y /I" /> | ||
<Exec Command="xcopy "$(OutDir)\$(AssemblyName).pdb" "$(SolutionDir)\bin\$(Configuration)\net6.0\Plugins\Services\$(ProjectName)\" /R /Y /I" /> | ||
</Target> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\MorganStanley.ComposeUI.Playground.Interfaces\MorganStanley.ComposeUI.Playground.Interfaces.csproj" /> | ||
<ProjectReference Include="..\..\..\MorganStanley.ComposeUI.Playground.Utilities\MorganStanley.ComposeUI.Playground.Utilities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
75 changes: 75 additions & 0 deletions
75
Playground/Plugins/Services/MockAuthentication/MockAuthenticationService.cs
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,75 @@ | ||
/// ******************************************************************************************************** | ||
/// | ||
/// Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
/// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
/// See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
/// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
/// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and limitations under the License. | ||
/// | ||
/// ******************************************************************************************************** | ||
|
||
using NP.Utilities; | ||
using NP.Utilities.Attributes; | ||
using NP.Utilities.BasicServices; | ||
|
||
namespace MockAuthentication; | ||
|
||
[Implements(typeof(IAuthenticationService), IsSingleton = true)] | ||
public class MockAuthenticationService : VMBase, IAuthenticationService | ||
{ | ||
[Part] | ||
private ILog? Log { get; set; } | ||
|
||
private string? _currentUserName; | ||
public string? CurrentUserName | ||
{ | ||
get => _currentUserName; | ||
private set | ||
{ | ||
if (_currentUserName == value) | ||
return; | ||
|
||
_currentUserName = value; | ||
|
||
OnPropertyChanged(nameof(CurrentUserName)); | ||
OnPropertyChanged(nameof(IsAuthenticated)); | ||
} | ||
} | ||
|
||
// Is authenticated is true if and only if the CurrentUserName is not zero | ||
public bool IsAuthenticated => CurrentUserName != null; | ||
|
||
public bool Authenticate(string userName, string password) | ||
{ | ||
if (IsAuthenticated) | ||
{ | ||
throw new Exception("Already Authenticated"); | ||
} | ||
|
||
CurrentUserName = | ||
(userName == "nick" && password == "1234") ? userName : null; | ||
|
||
if (IsAuthenticated) | ||
{ | ||
Log?.Log | ||
( | ||
LogKind.Info, | ||
nameof(IAuthenticationService), | ||
$"Authenticated user '{userName}'"); | ||
} | ||
|
||
return IsAuthenticated; | ||
} | ||
|
||
public void Logout() | ||
{ | ||
if (!IsAuthenticated) | ||
{ | ||
throw new Exception("Already logged out"); | ||
} | ||
|
||
CurrentUserName = null; | ||
} | ||
} | ||
|
39 changes: 39 additions & 0 deletions
39
...nStanley.ComposeUI.Plugins.TimeService/MorganStanley.ComposeUI.Plugins.TimeService.csproj
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,39 @@ | ||
<!-- | ||
******************************************************************************************************** | ||
Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
Unless required by applicable law or agreed to in writing, software distributed under the License | ||
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
******************************************************************************************************** | ||
--> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Remove="TimeService.cs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.Reactive" Version="5.0.0" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Exec Command="xcopy "$(OutDir)\$(AssemblyName).dll" "$(SolutionDir)\bin\$(Configuration)\net6.0\Plugins\Services\$(ProjectName)\" /R /Y /I" /> | ||
<Exec Command="xcopy "$(OutDir)\$(AssemblyName).pdb" "$(SolutionDir)\bin\$(Configuration)\net6.0\Plugins\Services\$(ProjectName)\" /R /Y /I" /> | ||
</Target> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\MorganStanley.ComposeUI.Playground.Interfaces\MorganStanley.ComposeUI.Playground.Interfaces.csproj" /> | ||
<ProjectReference Include="..\..\..\MorganStanley.ComposeUI.Playground.Utilities\MorganStanley.ComposeUI.Playground.Utilities.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
24 changes: 24 additions & 0 deletions
24
Playground/Plugins/Services/MorganStanley.ComposeUI.Plugins.TimeService/TimeService.cs
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 @@ | ||
using MorganStanley.ComposeUI.Playground.Interfaces; | ||
using NP.Utilities.Attributes; | ||
using System.Reactive.Linq; | ||
|
||
namespace MorganStanley.ComposeUI.Plugins.TimeService | ||
{ | ||
[Implements(typeof(ITimeService), IsSingleton = true)] | ||
public class TimeService : ITimeService | ||
{ | ||
public IObservable<DateTime> TimeObservable | ||
{ | ||
get | ||
{ | ||
int delaySeconds = 5 - DateTime.Now.Second % 5; | ||
|
||
return | ||
Observable | ||
.Interval(TimeSpan.FromSeconds(5)) | ||
.Delay(TimeSpan.FromSeconds(delaySeconds)) | ||
.Select(l => DateTime.Now); | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...round/Plugins/Services/MorganStanley.ComposeUI.Plugins.TimeService/TimeServicesFactory.cs
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,34 @@ | ||
/// ******************************************************************************************************** | ||
/// | ||
/// Morgan Stanley makes this available to you under the Apache License, Version 2.0 (the "License"). | ||
/// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. | ||
/// See the NOTICE file distributed with this work for additional information regarding copyright ownership. | ||
/// Unless required by applicable law or agreed to in writing, software distributed under the License | ||
/// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and limitations under the License. | ||
/// | ||
/// ******************************************************************************************************** | ||
|
||
using NP.Utilities.Attributes; | ||
using MorganStanley.ComposeUI.Playground.Interfaces; | ||
using System.Reactive.Linq; | ||
|
||
namespace MorganStanley.ComposeUI.Plugins.TimeService | ||
{ | ||
[HasFactoryMethods] | ||
public static class TimeServicesFactory | ||
{ | ||
[FactoryMethod(isSingleton:true, partKey:IoCNames.TimeServiceName)] | ||
public static IObservable<DateTime> CreateTimeService() | ||
{ | ||
var dateTime = DateTime.Now; | ||
|
||
int delaySeconds = 5 - DateTime.Now.Second % 5; | ||
|
||
return Observable | ||
.Interval(TimeSpan.FromSeconds(5)) | ||
.Delay(TimeSpan.FromSeconds(delaySeconds)) | ||
.Select(l => DateTime.Now); | ||
} | ||
} | ||
} |
Oops, something went wrong.