Skip to content

Commit

Permalink
Merge pull request #459 from joecare99/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
joecare99 authored Jul 11, 2024
2 parents b8b0c79 + 9531013 commit b6edcd1
Show file tree
Hide file tree
Showing 117 changed files with 1,783 additions and 488 deletions.

This file was deleted.

12 changes: 12 additions & 0 deletions CSharpBible/Graphics/Graphics.sln
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolySpline", "PolySpline\Po
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolySpline_net", "PolySpline\PolySpline_net.csproj", "{EF90C4A7-DB44-4672-A4A5-E7D9996587BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_ImageHandling_netTests", "MVVM_ImageHandlingTests\MVVM_ImageHandling_netTests.csproj", "{74702CB8-336B-4AE0-990C-4E1914F720E2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MVVM_ImageHandlingTests", "MVVM_ImageHandlingTests\MVVM_ImageHandlingTests.csproj", "{B1FCD6F4-2DBF-4AC7-AD62-64E830E83764}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -249,6 +253,14 @@ Global
{EF90C4A7-DB44-4672-A4A5-E7D9996587BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF90C4A7-DB44-4672-A4A5-E7D9996587BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF90C4A7-DB44-4672-A4A5-E7D9996587BC}.Release|Any CPU.Build.0 = Release|Any CPU
{74702CB8-336B-4AE0-990C-4E1914F720E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74702CB8-336B-4AE0-990C-4E1914F720E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74702CB8-336B-4AE0-990C-4E1914F720E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74702CB8-336B-4AE0-990C-4E1914F720E2}.Release|Any CPU.Build.0 = Release|Any CPU
{B1FCD6F4-2DBF-4AC7-AD62-64E830E83764}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1FCD6F4-2DBF-4AC7-AD62-64E830E83764}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1FCD6F4-2DBF-4AC7-AD62-64E830E83764}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1FCD6F4-2DBF-4AC7-AD62-64E830E83764}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
11 changes: 5 additions & 6 deletions CSharpBible/Graphics/MVVM_ImageHandlingTests/AppTests.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
using CommunityToolkit.Mvvm.DependencyInjection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVVM.View.Extension;
using MVVM_ImageHandling.Models;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MVVM.View.Extension;
using MVVM_ImageHandling.Models;

namespace MVVM_ImageHandling.Tests
{
Expand Down Expand Up @@ -53,7 +52,7 @@ public void AppTest()
public void AppTest2()
{
app.DoStartUp();
Assert.IsNotNull(IoC.GetReqSrv(typeof(IUserRepository)));
Assert.IsNotNull(IoC.GetReqSrv(typeof(ITemplateModel)));
Assert.IsNull(IoC.GetSrv(typeof(App)));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project>
<Import Project="..\MVVM_Tutorial.props" />
<Import Project="..\Graphics.props" />
<PropertyGroup>
<TargetFrameworks>net462-windows;net472-windows;net48-windows;net481-windows</TargetFrameworks>
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
<Project>
<Import Project="..\MVVM_Tutorial_net.props" />
<Import Project="..\Graphics_net.props" />
<PropertyGroup>
<TargetFrameworks>net6.0-windows;net7.0-windows</TargetFrameworks>
<TargetFrameworks>net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
<IsTestProject>true</IsTestProject>
<IsPackable>false</IsPackable>
</PropertyGroup>
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.1" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.4" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TemplateViewModelTests:BaseTestViewModel
/// The test model
/// </summary>
/// <autogeneratedoc />
TemplateViewModel testModel;
ImageViewModel testModel;
#pragma warning restore CS8618 // Ein Non-Nullable-Feld muss beim Beenden des Konstruktors einen Wert ungleich NULL enthalten. Erwägen Sie die Deklaration als Nullable.

/// <summary>
Expand All @@ -58,7 +58,7 @@ public void Init()
public void SetupTest()
{
Assert.IsNotNull(testModel);
Assert.IsInstanceOfType(testModel, typeof(TemplateViewModel));
Assert.IsInstanceOfType(testModel, typeof(ImageViewModel));
Assert.IsInstanceOfType(testModel, typeof(BaseViewModelCT));
Assert.IsInstanceOfType(testModel, typeof(INotifyPropertyChanged));
}
Expand Down
4 changes: 0 additions & 4 deletions CSharpBible/Graphics/Polyline/Polyline2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand All @@ -111,8 +110,5 @@
<Name>MVVM_BaseLib</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
5 changes: 3 additions & 2 deletions CSharpBible/Libraries/MVVM_BaseLib/Helper/MVVM/CRandom.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using BaseLib.Interfaces;
using System;

namespace BaseLib.Helper.MVVM;

Expand All @@ -11,7 +12,7 @@ public CRandom()
_random = new Random();
}

public int Next(int v1, int v2) => _random.Next(v1, v2);
public int Next(int v1, int v2) => v2 !=-1 || v1<v2? _random.Next(v1, v2): _random.Next(v1);

public double NextDouble() => _random.NextDouble();

Expand Down
9 changes: 0 additions & 9 deletions CSharpBible/Libraries/MVVM_BaseLib/Helper/MVVM/IRandom.cs

This file was deleted.

6 changes: 3 additions & 3 deletions CSharpBible/Libraries/MVVM_BaseLib/Helper/StreamHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,18 @@ public static void EnumerateToStream(this Stream stream, IEnumerable<(string, ob
streamBytes = new byte[sizeof(int)];
stream.Read(streamBytes, 0, sizeof(int));
var count32 = BitConverter.ToInt32(streamBytes, 0);
var result = new IPersistence[count32];
var result = new IPersistence?[count32];
if (t2.IsClass && t2.GetConstructors().FirstOrDefault(c => c.IsPublic)!=null)
for (var i =0;i<count32; i++)
{
result[i] = (IPersistence)Activator.CreateInstance(t2);
result[i] = (IPersistence?)Activator.CreateInstance(t2);
}
else
for (var i = 0; i < count32; i++)
{
result[i] = IoC.GetRequiredService<IPersistence>();
}
yield return (e.Item1, result.Select(b => b.ReadFromEnumerable(stream.StreamToEnumerable(b.PropTypes))?b:null).ToList());
yield return (e.Item1, result.Select(b => b?.ReadFromEnumerable(stream.StreamToEnumerable(b!.PropTypes))??false?b:null).ToList());
break;
}
}
Expand Down
46 changes: 46 additions & 0 deletions CSharpBible/Libraries/MVVM_BaseLib/Interfaces/IRandom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// ***********************************************************************
// Assembly : MVVM_BaseLib
// Author : Mir
// Created : 07-01-2024
//
// Last Modified By : Mir
// Last Modified On : 07-01-2024
// ***********************************************************************
// <copyright file="IRandom.cs" company="JC-Soft">
// Copyright © JC-Soft 2023
// </copyright>
// <summary></summary>
// ***********************************************************************
/// <summary>
/// The Interfaces namespace.
/// </summary>
namespace BaseLib.Interfaces;

/// <summary>
/// Interface IRandom
/// </summary>
public interface IRandom
{
/// <summary>
/// Gets the next random number between v1 and v2 if v2 is set, between 0 and v1 if v2 is not set.
/// </summary>
/// <param name="v1">The first boarder</param>
/// <param name="v2">The second boarder</param>
/// <returns>System.Int32.</returns>
int Next(int v1, int v2=-1);
/// <summary>
/// Gets the next random number as double between ]0 and 1[.
/// </summary>
/// <returns>System.Double.</returns>
double NextDouble();
/// <summary>
/// Gets the next random number as int.
/// </summary>
/// <returns>System.Int32.</returns>
int NextInt();
/// <summary>
/// Specifies the seed-value.
/// </summary>
/// <param name="value">The value.</param>
void Seed(int value);
}
6 changes: 3 additions & 3 deletions CSharpBible/Libraries/MVVM_BaseLib/ViewModel/BaseViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ namespace MVVM.ViewModel;

/// <summary>
/// Class BaseViewModel.
/// Implements the <see cref="MVVM.ViewModel.NotificationObject" />
/// Implements the <see cref="NotificationObject" />
/// </summary>
/// <seealso cref="MVVM.ViewModel.NotificationObject" />
/// <seealso cref="NotificationObject" />
public abstract class BaseViewModel : NotificationObject, IPropertyBinding
{
#region Properties
Expand Down Expand Up @@ -125,7 +125,7 @@ public bool AddPropertyDependency(string prop1, string prop2,bool xForce=false )

public bool RemovePropertyDependency(string prop1, string prop2)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public bool AddPropertyDependency(string prop1, string prop2,bool xForce=false )

public bool RemovePropertyDependency(string prop1, string prop2)
{
throw new System.NotImplementedException();
throw new NotImplementedException();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,5 @@ private void ExecuteAction(Action action)
/// </summary>
/// <param name="action">The action.</param>
/// <remarks>An extension point for subclasses to customize how property change notifications are handled.</remarks>
protected virtual void OnUIThread(System.Action action) => action.Invoke();
protected virtual void OnUIThread(Action action) => action.Invoke();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BaseLib.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using static BaseLib.Helper.TestHelper;

namespace BaseLib.Helper.MVVM.Tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private IServiceScope GetScope()
{
DoLog($"GetScope()");
IServiceScope serviceScope = Substitute.For<IServiceScope>();
serviceScope.ServiceProvider.GetService(typeof(IServiceScopeFactory)).Returns<object>( _f);
serviceScope.ServiceProvider.GetService(typeof(IServiceScopeFactory)).Returns( _f);
return serviceScope;
}

Expand Down Expand Up @@ -106,10 +106,10 @@ public void SetCurrentScopeTest()
var s = IoC.GetNewScope();
Assert.AreEqual("GetScope()\r\n", DebugLog);
Assert.AreEqual(s,IoC.Scope);
s.ServiceProvider.GetService(typeof(object)).Returns<object>(null);
s.ServiceProvider.GetService(typeof(object)).Returns(null);
var s2 = IoC.GetNewScope(s);
Assert.AreEqual(s2, IoC.Scope);
s2.ServiceProvider.GetService(typeof(object)).Returns<object>(this);
s2.ServiceProvider.GetService(typeof(object)).Returns(this);
IoC.SetCurrentScope(s2);
Assert.AreEqual(s2, IoC.Scope);
Assert.IsNotNull(IoC.GetRequiredService<Object>());
Expand All @@ -123,7 +123,7 @@ public void SetCurrentScopeTest()
public void ConfigureTest()
{
var sp = Substitute.For<IServiceProvider>();
sp.GetService(typeof(IServiceScopeFactory)).Returns<object>(_f);
sp.GetService(typeof(IServiceScopeFactory)).Returns(_f);
sp.GetService(typeof(object)).Returns(this);
IoC.Configure(sp);
Assert.AreEqual(sp.GetService, IoC.GetSrv);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ namespace MVVM.ViewModel;

/// <summary>
/// Class BaseTestViewModel.
/// Implements the <see cref="MVVM.ViewModel.BaseTestViewModel" />
/// Implements the <see cref="BaseTestViewModel" />
/// </summary>
/// <typeparam name="T"></typeparam>
/// <seealso cref="MVVM.ViewModel.BaseTestViewModel" />
/// <seealso cref="BaseTestViewModel" />
public abstract class BaseTestViewModel<T> : BaseTestViewModel where T : class, INotifyPropertyChanged, new()
{
/// <summary>
Expand Down Expand Up @@ -86,9 +86,9 @@ public virtual void TestModelProperiesTest(string sPropName, TypeCode tPropType,

/// <summary>
/// Class BaseTestViewModel.
/// Implements the <see cref="MVVM.ViewModel.BaseTestViewModel" />
/// Implements the <see cref="BaseTestViewModel" />
/// </summary>
/// <seealso cref="MVVM.ViewModel.BaseTestViewModel" />
/// <seealso cref="BaseTestViewModel" />
public class BaseTestViewModel
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ public enum eValidReact
/// </summary>
/// <param name="arg1">The arg1.</param>
/// <param name="arg2">The arg2.</param>
/// <exception cref="System.Exception">A general exception occurred</exception>
/// <exception cref="System.ArgumentException">Argument ({arg2}) not valid!</exception>
/// <exception cref="Exception">A general exception occurred</exception>
/// <exception cref="ArgumentException">Argument ({arg2}) not valid!</exception>
/// <autogeneratedoc />
private void StringAct(string arg1, string arg2)
{
Expand All @@ -166,8 +166,8 @@ private void StringAct(string arg1, string arg2)
/// </summary>
/// <param name="arg1">The arg1.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
/// <exception cref="System.Exception">A general exception occurred</exception>
/// <exception cref="System.ArgumentException">Argument ({arg1}) not valid!</exception>
/// <exception cref="Exception">A general exception occurred</exception>
/// <exception cref="ArgumentException">Argument ({arg1}) not valid!</exception>
/// <autogeneratedoc />
private bool ValidateString(string arg1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ namespace MVVM_00a_CTTemplate.Models;
/// <summary>
/// Class TemplateModel.
/// Implements the <see cref="ObservableObject" />
/// Implements the <see cref="MVVM_00a_CTTemplate.Models.ITemplateModel" />
/// Implements the <see cref="ITemplateModel" />
/// </summary>
/// <seealso cref="ObservableObject" />
/// <seealso cref="MVVM_00a_CTTemplate.Models.ITemplateModel" />
/// <seealso cref="ITemplateModel" />
/// <autogeneratedoc />
public partial class TemplateModel :ObservableObject, ITemplateModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project>
<Import Project="..\MVVM_Tutorial.props" />
<PropertyGroup>
<TargetFrameworks>net462-windows;net472-windows;net48-windows;net481-windows</TargetFrameworks>
Expand Down
Loading

0 comments on commit b6edcd1

Please sign in to comment.