WIP expirementation
This commit is contained in:
parent
fb7dac642a
commit
29a141a971
20 changed files with 307 additions and 62 deletions
|
|
@ -6,28 +6,36 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- Avalonia packages -->
|
<!-- Avalonia packages -->
|
||||||
<!-- Important: keep version in sync! -->
|
<!-- Important: keep version in sync! -->
|
||||||
<PackageVersion Include="Avalonia" Version="11.2.1" />
|
<PackageVersion Include="Avalonia" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Themes.Fluent" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Fonts.Inter" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Diagnostics" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.Desktop" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Desktop" Version="11.3.3" />
|
||||||
<PackageVersion Include="Avalonia.iOS" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.iOS" Version="11.2.1" />
|
||||||
<PackageVersion Include="Avalonia.Browser" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Browser" Version="11.2.1" />
|
||||||
<PackageVersion Include="Avalonia.Android" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.Android" Version="11.2.1" />
|
||||||
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.2.1" />
|
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.3.3" />
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageVersion>
|
</PackageVersion>
|
||||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.0" />
|
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.8" />
|
||||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
|
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.8" />
|
||||||
<PackageVersion Include="Npgsql" Version="8.0.5" />
|
<PackageVersion Include="Npgsql" Version="9.0.3" />
|
||||||
<PackageVersion Include="Pure.DI" Version="2.1.38" />
|
<PackageVersion Include="Pure.DI" Version="2.1.38" />
|
||||||
|
<PackageVersion Include="ReactiveUI.SourceGenerators" Version="2.3.1" />
|
||||||
|
<PackageVersion Include="ReactiveUI.SourceGenerators.Analyzers.CodeFixes" Version="2.3.1" />
|
||||||
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />
|
<PackageVersion Include="Xamarin.AndroidX.Core.SplashScreen" Version="1.0.1.1" />
|
||||||
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
|
<PackageVersion Include="coverlet.collector" Version="6.0.4">
|
||||||
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<PackageVersion Include="xunit" Version="2.9.2" />
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
|
</PackageVersion>
|
||||||
|
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
|
<PackageVersion Include="xunit" Version="2.9.3" />
|
||||||
|
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.3">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageVersion>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -4,7 +4,7 @@ using Avalonia.ReactiveUI;
|
||||||
|
|
||||||
namespace pgLabII.Desktop;
|
namespace pgLabII.Desktop;
|
||||||
|
|
||||||
sealed class Program
|
public sealed class Program
|
||||||
{
|
{
|
||||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
public interface IPqConnectionStringTokenizer
|
public interface IPqConnectionStringTokenizer
|
||||||
{
|
{
|
||||||
bool Eof { get; }
|
bool Eof { get; }
|
||||||
//PqToken NextToken(out string? text);
|
|
||||||
string GetKeyword();
|
string GetKeyword();
|
||||||
void ConsumeEquals();
|
void ConsumeEquals();
|
||||||
string GetValue();
|
string GetValue();
|
||||||
|
|
|
||||||
18
pgLabII.PgUtils/ConnectionStrings/Pq/KeywordMapping.cs
Normal file
18
pgLabII.PgUtils/ConnectionStrings/Pq/KeywordMapping.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace pgLabII.PgUtils.ConnectionStrings.Pq;
|
||||||
|
|
||||||
|
enum Keyword
|
||||||
|
{
|
||||||
|
Host,
|
||||||
|
HostAddr,
|
||||||
|
Port,
|
||||||
|
DatabaseName,
|
||||||
|
UserName,
|
||||||
|
Password,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using Npgsql;
|
||||||
|
|
||||||
namespace pgLabII.PgUtils.ConnectionStrings;
|
namespace pgLabII.PgUtils.ConnectionStrings;
|
||||||
|
|
||||||
public class PqConnectionStringParser
|
public ref struct PqConnectionStringParser
|
||||||
{
|
{
|
||||||
// Note possible keywords
|
// Note possible keywords
|
||||||
// host
|
// host
|
||||||
|
|
@ -74,5 +75,52 @@ public class PqConnectionStringParser
|
||||||
tokenizer.ConsumeEquals();
|
tokenizer.ConsumeEquals();
|
||||||
string v = tokenizer.GetValue();
|
string v = tokenizer.GetValue();
|
||||||
result.Add(kw, v);
|
result.Add(kw, v);
|
||||||
|
//switch (kw)
|
||||||
|
//{
|
||||||
|
// case "host":
|
||||||
|
// case "hostaddr":
|
||||||
|
// result.Host = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "port":
|
||||||
|
// result.Port = int.Parse(v);
|
||||||
|
// break;
|
||||||
|
// case "dbname":
|
||||||
|
// result.Database = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "user":
|
||||||
|
// result.Username = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "password":
|
||||||
|
// result.Password = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "connect_timeout":
|
||||||
|
// result.Timeout = int.Parse(v);
|
||||||
|
// break;
|
||||||
|
// case "application_name":
|
||||||
|
// result.ApplicationName = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "options":
|
||||||
|
// result.Options = v.ToString();
|
||||||
|
// break;
|
||||||
|
// case "sslmode":
|
||||||
|
// result.SslMode = ToSslMode(v);
|
||||||
|
// break;
|
||||||
|
// default:
|
||||||
|
// // Todo what do we do with values we do not support/recognize?
|
||||||
|
// break;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SslMode ToSslMode(ReadOnlySpan<char> v)
|
||||||
|
=> v switch
|
||||||
|
{
|
||||||
|
"disable" => SslMode.Disable,
|
||||||
|
"allow" => SslMode.Allow,
|
||||||
|
"prefer" => SslMode.Prefer,
|
||||||
|
"require" => SslMode.Require,
|
||||||
|
"verify-ca" => SslMode.VerifyCA,
|
||||||
|
"verify-full" => SslMode.VerifyFull,
|
||||||
|
_ => throw new ArgumentException("Not a valid SSL mode"),
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,11 @@
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Npgsql" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
33
pgLabII.sln
33
pgLabII.sln
|
|
@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII", "pgLabII\pgLabII.
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Desktop", "pgLabII.Desktop\pgLabII.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Desktop", "pgLabII.Desktop\pgLabII.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.iOS", "pgLabII.iOS\pgLabII.iOS.csproj", "{EBD9022F-BC83-4846-9A11-6F7F3772DC64}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Android", "pgLabII.Android\pgLabII.Android.csproj", "{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3DA99C4E-89E3-4049-9C22-0A7EC60D83D8}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3DA99C4E-89E3-4049-9C22-0A7EC60D83D8}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
Directory.Packages.props = Directory.Packages.props
|
Directory.Packages.props = Directory.Packages.props
|
||||||
|
|
@ -25,42 +21,49 @@ EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
|
Release|x64 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Debug|x64.Build.0 = Debug|x64
|
||||||
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.Build.0 = Release|Any CPU
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{EBFA8512-1EA5-4D8C-B4AC-AB5B48A6D568}.Release|x64.Build.0 = Release|x64
|
||||||
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Debug|x64.Build.0 = Debug|x64
|
||||||
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.Build.0 = Release|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|x64.ActiveCfg = Release|x64
|
||||||
{EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|x64.Build.0 = Release|x64
|
||||||
{EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Debug|x64.Build.0 = Debug|x64
|
||||||
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{6694EE99-3AEA-4823-B2C3-02F28F575D14}.Release|x64.Build.0 = Release|x64
|
||||||
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Debug|x64.Build.0 = Debug|x64
|
||||||
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|Any CPU.Build.0 = Release|Any CPU
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{915C5439-4CF5-4625-AB7B-24F0E34E5B5F}.Release|x64.Build.0 = Release|x64
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C} = {EBBC2081-5061-4843-B420-AB4C48A5C283}
|
{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C} = {EBBC2081-5061-4843-B420-AB4C48A5C283}
|
||||||
{EBD9022F-BC83-4846-9A11-6F7F3772DC64} = {EBBC2081-5061-4843-B420-AB4C48A5C283}
|
|
||||||
{7AD1DAC8-7FBE-49D5-8614-7321233DB82E} = {EBBC2081-5061-4843-B420-AB4C48A5C283}
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
|
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
|
||||||
|
|
|
||||||
8
pgLabII/Contracts/IViewItem.cs
Normal file
8
pgLabII/Contracts/IViewItem.cs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace pgLabII;
|
||||||
|
|
||||||
|
public interface IViewItem
|
||||||
|
{
|
||||||
|
string Caption { get; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Diagnostics;
|
||||||
using System.Reactive;
|
using System.Reactive;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Npgsql;
|
using Npgsql;
|
||||||
|
using pgLabII.ViewModels;
|
||||||
using pgLabII.Views;
|
using pgLabII.Views;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
|
|
@ -13,6 +14,8 @@ public class ServerConfiguration : ReactiveObject
|
||||||
{
|
{
|
||||||
private Color _color;
|
private Color _color;
|
||||||
private bool _colorEnabled = true;
|
private bool _colorEnabled = true;
|
||||||
|
private string initialDatabase = "";
|
||||||
|
|
||||||
public Guid Id { get; set; } = Guid.NewGuid();
|
public Guid Id { get; set; } = Guid.NewGuid();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For the user to help him identify the item
|
/// For the user to help him identify the item
|
||||||
|
|
@ -49,7 +52,18 @@ public class ServerConfiguration : ReactiveObject
|
||||||
|
|
||||||
public string Host { get; set; } = "";
|
public string Host { get; set; } = "";
|
||||||
public ushort Port { get; set; } = 5432;
|
public ushort Port { get; set; } = 5432;
|
||||||
public string InitialDatabase { get; set; } = "";
|
public string InitialDatabase
|
||||||
|
{
|
||||||
|
get => initialDatabase;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (initialDatabase != value)
|
||||||
|
{
|
||||||
|
initialDatabase = value;
|
||||||
|
this.RaisePropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public SslMode DefaultSslMode { get; set; } = SslMode.Prefer;
|
public SslMode DefaultSslMode { get; set; } = SslMode.Prefer;
|
||||||
public IBrush? BackgroundBrush => ColorEnabled ? new SolidColorBrush(Color) : null;
|
public IBrush? BackgroundBrush => ColorEnabled ? new SolidColorBrush(Color) : null;
|
||||||
|
|
||||||
|
|
@ -57,6 +71,8 @@ public class ServerConfiguration : ReactiveObject
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> EditCommand { get; }
|
public ReactiveCommand<Unit, Unit> EditCommand { get; }
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> ExploreCommand { get; }
|
||||||
|
|
||||||
public ServerConfiguration()
|
public ServerConfiguration()
|
||||||
{
|
{
|
||||||
EditCommand = ReactiveCommand.Create(() =>
|
EditCommand = ReactiveCommand.Create(() =>
|
||||||
|
|
@ -66,6 +82,11 @@ public class ServerConfiguration : ReactiveObject
|
||||||
{ New = false };
|
{ New = false };
|
||||||
window.Show();
|
window.Show();
|
||||||
});
|
});
|
||||||
|
ExploreCommand = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
SingleDatabaseWindow window = new() { DataContext = new ViewListViewModel() };
|
||||||
|
window.Show();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ServerConfiguration(ServerConfiguration src)
|
public ServerConfiguration(ServerConfiguration src)
|
||||||
|
|
|
||||||
22
pgLabII/ViewModels/QueryToolViewModel.cs
Normal file
22
pgLabII/ViewModels/QueryToolViewModel.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
using System.Reactive;
|
||||||
|
using ReactiveUI;
|
||||||
|
using ReactiveUI.SourceGenerators;
|
||||||
|
|
||||||
|
namespace pgLabII.ViewModels;
|
||||||
|
|
||||||
|
public partial class QueryToolViewModel : ViewModelBase, IViewItem
|
||||||
|
{
|
||||||
|
[Reactive] private string _caption = "Cap";
|
||||||
|
|
||||||
|
[Reactive] private string _query = "";
|
||||||
|
|
||||||
|
public ReactiveCommand<Unit, Unit> EditCommand { get; }
|
||||||
|
|
||||||
|
public QueryToolViewModel()
|
||||||
|
{
|
||||||
|
EditCommand = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
Query += " test";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
15
pgLabII/ViewModels/ViewListViewModel.cs
Normal file
15
pgLabII/ViewModels/ViewListViewModel.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
|
namespace pgLabII.ViewModels;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ViewModel for maintaining a list of views displayed for instance in a TabControl
|
||||||
|
/// </summary>
|
||||||
|
public class ViewListViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
public ObservableCollection<IViewItem> Views { get; } = [
|
||||||
|
new QueryToolViewModel() { Caption = "Abc" },
|
||||||
|
new QueryToolViewModel() { Caption = "Test" } ,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -28,5 +28,11 @@
|
||||||
<TextBlock>Host:</TextBlock>
|
<TextBlock>Host:</TextBlock>
|
||||||
<TextBox Text="{Binding Configuration.Host}"/>
|
<TextBox Text="{Binding Configuration.Host}"/>
|
||||||
|
|
||||||
|
<TextBlock>Port:</TextBlock>
|
||||||
|
<NumericUpDown Value="{Binding Configuration.Port}" Minimum="0" Maximum="65535" Increment="1"/>
|
||||||
|
|
||||||
|
<TextBlock>Database:</TextBlock>
|
||||||
|
<TextBox Text="{Binding Configuration.InitialDatabase}"/>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,13 @@ namespace pgLabII.Views;
|
||||||
|
|
||||||
public partial class EditServerConfigurationWindow : Window
|
public partial class EditServerConfigurationWindow : Window
|
||||||
{
|
{
|
||||||
public EditServerConfigurationWindow(EditServerConfigurationViewModel? viewModel = null)
|
public EditServerConfigurationWindow()
|
||||||
|
: this(null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EditServerConfigurationWindow(EditServerConfigurationViewModel? viewModel)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@
|
||||||
<TextBlock Text="{Binding Host}" />
|
<TextBlock Text="{Binding Host}" />
|
||||||
<TextBlock Text=":" />
|
<TextBlock Text=":" />
|
||||||
<TextBlock Text="{Binding Port}" />
|
<TextBlock Text="{Binding Port}" />
|
||||||
|
<TextBlock Text="/" />
|
||||||
|
<TextBlock Text="{Binding InitialDatabase}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
@ -42,7 +44,9 @@
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="1">
|
Grid.Column="1">
|
||||||
<Button>DB</Button>
|
<Button Command="{Binding ExploreCommand}">
|
||||||
|
DB
|
||||||
|
</Button>
|
||||||
<Button>Server</Button>
|
<Button>Server</Button>
|
||||||
<Button Content="...">
|
<Button Content="...">
|
||||||
<Button.Flyout>
|
<Button.Flyout>
|
||||||
|
|
|
||||||
58
pgLabII/Views/SingleDatabaseWindow.axaml
Normal file
58
pgLabII/Views/SingleDatabaseWindow.axaml
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:viewModels="clr-namespace:pgLabII.ViewModels"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
|
x:Class="pgLabII.Views.SingleDatabaseWindow"
|
||||||
|
Title="SingleDatabaseWindow"
|
||||||
|
x:DataType="viewModels:ViewListViewModel">
|
||||||
|
<Design.DataContext>
|
||||||
|
<!-- This only sets the DataContext for the previewer in an IDE,
|
||||||
|
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
||||||
|
<viewModels:ViewListViewModel />
|
||||||
|
</Design.DataContext>
|
||||||
|
<DockPanel>
|
||||||
|
<Menu DockPanel.Dock="Top">
|
||||||
|
<MenuItem Header="_File">
|
||||||
|
<MenuItem Header="_Open..."/>
|
||||||
|
<Separator/>
|
||||||
|
<MenuItem Header="_Exit"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="_Edit">
|
||||||
|
<MenuItem Header="Copy"/>
|
||||||
|
<MenuItem Header="Paste"/>
|
||||||
|
</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
<TabControl ItemsSource="{Binding Views}">
|
||||||
|
<!-- Main TabControl template -->
|
||||||
|
|
||||||
|
<TabControl.Styles>
|
||||||
|
<Style Selector="TabItem">
|
||||||
|
<Setter Property="Padding" Value="4,2"/> <!-- smaller inner space -->
|
||||||
|
<Setter Property="MinHeight" Value="20"/> <!-- lower height -->
|
||||||
|
<Setter Property="FontSize" Value="12"/> <!-- smaller text -->
|
||||||
|
</Style>
|
||||||
|
</TabControl.Styles>
|
||||||
|
|
||||||
|
<TabControl.ItemTemplate>
|
||||||
|
<!-- This controls the tab *headers* -->
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Caption, Mode=OneWay}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ItemTemplate>
|
||||||
|
|
||||||
|
<TabControl.ContentTemplate>
|
||||||
|
<DataTemplate DataType="viewModels:QueryToolViewModel">
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<TextBox Text="{Binding Query, Mode=TwoWay}" />
|
||||||
|
<Button Command="{Binding EditCommand}">TEST</Button>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ContentTemplate>
|
||||||
|
|
||||||
|
</TabControl>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
15
pgLabII/Views/SingleDatabaseWindow.axaml.cs
Normal file
15
pgLabII/Views/SingleDatabaseWindow.axaml.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
|
||||||
|
namespace pgLabII.Views;
|
||||||
|
|
||||||
|
public partial class SingleDatabaseWindow : Window
|
||||||
|
{
|
||||||
|
|
||||||
|
public SingleDatabaseWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
|
<Platforms>AnyCPU;x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -28,9 +29,13 @@
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
|
||||||
<PackageReference Include="Npgsql" />
|
<PackageReference Include="Npgsql" />
|
||||||
</ItemGroup>
|
<PackageReference Include="ReactiveUI.SourceGenerators">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<ItemGroup>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
<Folder Include="Contracts\" />
|
</PackageReference>
|
||||||
|
<PackageReference Include="ReactiveUI.SourceGenerators.Analyzers.CodeFixes">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
2
pgLabII/pgLabII.csproj.DotSettings
Normal file
2
pgLabII/pgLabII.csproj.DotSettings
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=contracts/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue