diff --git a/Directory.Packages.props b/Directory.Packages.props
index 47b4882..94ea5dc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -6,28 +6,36 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
-
+
+
+
+
+
-
-
-
-
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
\ No newline at end of file
diff --git a/pgLabII.Desktop/Program.cs b/pgLabII.Desktop/Program.cs
index d3aa818..d75f54b 100644
--- a/pgLabII.Desktop/Program.cs
+++ b/pgLabII.Desktop/Program.cs
@@ -4,7 +4,7 @@ using Avalonia.ReactiveUI;
namespace pgLabII.Desktop;
-sealed class Program
+public sealed class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
diff --git a/pgLabII.Desktop/pgLabII.Desktop.csproj b/pgLabII.Desktop/pgLabII.Desktop.csproj
index 67d4d62..b997c85 100644
--- a/pgLabII.Desktop/pgLabII.Desktop.csproj
+++ b/pgLabII.Desktop/pgLabII.Desktop.csproj
@@ -6,6 +6,7 @@
net8.0
enable
true
+ AnyCPU;x64
@@ -15,7 +16,7 @@
-
+
None
All
diff --git a/pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj b/pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj
index cf88fa9..a99e569 100644
--- a/pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj
+++ b/pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj
@@ -5,6 +5,7 @@
enable
enable
false
+ AnyCPU;x64
diff --git a/pgLabII.PgUtils/ConnectionStrings/Pq/IPqConnectionStringTokenizer.cs b/pgLabII.PgUtils/ConnectionStrings/Pq/IPqConnectionStringTokenizer.cs
index a2bef86..98c42a6 100644
--- a/pgLabII.PgUtils/ConnectionStrings/Pq/IPqConnectionStringTokenizer.cs
+++ b/pgLabII.PgUtils/ConnectionStrings/Pq/IPqConnectionStringTokenizer.cs
@@ -3,7 +3,6 @@
public interface IPqConnectionStringTokenizer
{
bool Eof { get; }
- //PqToken NextToken(out string? text);
string GetKeyword();
void ConsumeEquals();
string GetValue();
diff --git a/pgLabII.PgUtils/ConnectionStrings/Pq/KeywordMapping.cs b/pgLabII.PgUtils/ConnectionStrings/Pq/KeywordMapping.cs
new file mode 100644
index 0000000..995134e
--- /dev/null
+++ b/pgLabII.PgUtils/ConnectionStrings/Pq/KeywordMapping.cs
@@ -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,
+}
+
diff --git a/pgLabII.PgUtils/ConnectionStrings/Pq/PqConnectionStringParser.cs b/pgLabII.PgUtils/ConnectionStrings/Pq/PqConnectionStringParser.cs
index d1c2228..1cd51a8 100644
--- a/pgLabII.PgUtils/ConnectionStrings/Pq/PqConnectionStringParser.cs
+++ b/pgLabII.PgUtils/ConnectionStrings/Pq/PqConnectionStringParser.cs
@@ -1,8 +1,9 @@
using System.Collections.ObjectModel;
+using Npgsql;
namespace pgLabII.PgUtils.ConnectionStrings;
-public class PqConnectionStringParser
+public ref struct PqConnectionStringParser
{
// Note possible keywords
// host
@@ -74,5 +75,52 @@ public class PqConnectionStringParser
tokenizer.ConsumeEquals();
string v = tokenizer.GetValue();
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 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"),
+ };
+
}
diff --git a/pgLabII.PgUtils/pgLabII.PgUtils.csproj b/pgLabII.PgUtils/pgLabII.PgUtils.csproj
index 17b910f..d44f26c 100644
--- a/pgLabII.PgUtils/pgLabII.PgUtils.csproj
+++ b/pgLabII.PgUtils/pgLabII.PgUtils.csproj
@@ -4,6 +4,11 @@
net9.0
enable
enable
+ AnyCPU;x64
+
+
+
+
diff --git a/pgLabII.sln b/pgLabII.sln
index 26bc6ef..f519b85 100644
--- a/pgLabII.sln
+++ b/pgLabII.sln
@@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII", "pgLabII\pgLabII.
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "pgLabII.Desktop", "pgLabII.Desktop\pgLabII.Desktop.csproj", "{ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}"
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}"
ProjectSection(SolutionItems) = preProject
Directory.Packages.props = Directory.Packages.props
@@ -25,42 +21,49 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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|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.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.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.Build.0 = Release|Any CPU
- {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {EBD9022F-BC83-4846-9A11-6F7F3772DC64}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {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
+ {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|x64.ActiveCfg = Release|x64
+ {ABC31E74-02FF-46EB-B3B2-4E6AE43B456C}.Release|x64.Build.0 = Release|x64
{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|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.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.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.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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{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
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {83CB65B8-011F-4ED7-BCD3-A6CFA935EF7E}
diff --git a/pgLabII/Contracts/IViewItem.cs b/pgLabII/Contracts/IViewItem.cs
new file mode 100644
index 0000000..39074b3
--- /dev/null
+++ b/pgLabII/Contracts/IViewItem.cs
@@ -0,0 +1,8 @@
+namespace pgLabII;
+
+public interface IViewItem
+{
+ string Caption { get; }
+
+
+}
diff --git a/pgLabII/Model/ServerConfiguration.cs b/pgLabII/Model/ServerConfiguration.cs
index fd275f3..b251880 100644
--- a/pgLabII/Model/ServerConfiguration.cs
+++ b/pgLabII/Model/ServerConfiguration.cs
@@ -4,6 +4,7 @@ using System.Diagnostics;
using System.Reactive;
using Avalonia.Media;
using Npgsql;
+using pgLabII.ViewModels;
using pgLabII.Views;
using ReactiveUI;
@@ -13,6 +14,8 @@ public class ServerConfiguration : ReactiveObject
{
private Color _color;
private bool _colorEnabled = true;
+ private string initialDatabase = "";
+
public Guid Id { get; set; } = Guid.NewGuid();
///
/// For the user to help him identify the item
@@ -49,13 +52,26 @@ public class ServerConfiguration : ReactiveObject
public string Host { get; set; } = "";
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 IBrush? BackgroundBrush => ColorEnabled ? new SolidColorBrush(Color) : null;
public ServerUser User { get; set; } = new();
public ReactiveCommand EditCommand { get; }
+
+ public ReactiveCommand ExploreCommand { get; }
public ServerConfiguration()
{
@@ -66,6 +82,11 @@ public class ServerConfiguration : ReactiveObject
{ New = false };
window.Show();
});
+ ExploreCommand = ReactiveCommand.Create(() =>
+ {
+ SingleDatabaseWindow window = new() { DataContext = new ViewListViewModel() };
+ window.Show();
+ });
}
public ServerConfiguration(ServerConfiguration src)
diff --git a/pgLabII/ViewModels/QueryToolViewModel.cs b/pgLabII/ViewModels/QueryToolViewModel.cs
new file mode 100644
index 0000000..a2a1854
--- /dev/null
+++ b/pgLabII/ViewModels/QueryToolViewModel.cs
@@ -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 EditCommand { get; }
+
+ public QueryToolViewModel()
+ {
+ EditCommand = ReactiveCommand.Create(() =>
+ {
+ Query += " test";
+ });
+ }
+}
diff --git a/pgLabII/ViewModels/ViewListViewModel.cs b/pgLabII/ViewModels/ViewListViewModel.cs
new file mode 100644
index 0000000..01125dc
--- /dev/null
+++ b/pgLabII/ViewModels/ViewListViewModel.cs
@@ -0,0 +1,15 @@
+using System.Collections.ObjectModel;
+
+namespace pgLabII.ViewModels;
+
+///
+/// ViewModel for maintaining a list of views displayed for instance in a TabControl
+///
+public class ViewListViewModel : ViewModelBase
+{
+ public ObservableCollection Views { get; } = [
+ new QueryToolViewModel() { Caption = "Abc" },
+ new QueryToolViewModel() { Caption = "Test" } ,
+ ];
+}
+
diff --git a/pgLabII/Views/EditServerConfigurationWindow.axaml b/pgLabII/Views/EditServerConfigurationWindow.axaml
index e1b34a4..4b636e2 100644
--- a/pgLabII/Views/EditServerConfigurationWindow.axaml
+++ b/pgLabII/Views/EditServerConfigurationWindow.axaml
@@ -8,25 +8,31 @@
x:Class="pgLabII.Views.EditServerConfigurationWindow"
Title="EditServerConfiguration"
SizeToContent="WidthAndHeight">
-
-
-
-
+
+
+
+
-
- Name:
-
-
- Color:
-
-
-
-
-
- Host:
-
+
+ Name:
+
+ Color:
+
+
+
+
+ Host:
+
+
+ Port:
+
+
+ Database:
+
+
+
diff --git a/pgLabII/Views/EditServerConfigurationWindow.axaml.cs b/pgLabII/Views/EditServerConfigurationWindow.axaml.cs
index 361b5c9..17dbac0 100644
--- a/pgLabII/Views/EditServerConfigurationWindow.axaml.cs
+++ b/pgLabII/Views/EditServerConfigurationWindow.axaml.cs
@@ -7,7 +7,13 @@ namespace pgLabII.Views;
public partial class EditServerConfigurationWindow : Window
{
- public EditServerConfigurationWindow(EditServerConfigurationViewModel? viewModel = null)
+ public EditServerConfigurationWindow()
+ : this(null)
+ {
+
+ }
+
+ public EditServerConfigurationWindow(EditServerConfigurationViewModel? viewModel)
{
InitializeComponent();
diff --git a/pgLabII/Views/ServerListView.axaml b/pgLabII/Views/ServerListView.axaml
index 211c3f3..f7c3f21 100644
--- a/pgLabII/Views/ServerListView.axaml
+++ b/pgLabII/Views/ServerListView.axaml
@@ -30,9 +30,11 @@
Grid.Column="0">
-
-
-
+
+
+
+
+
@@ -42,7 +44,9 @@
HorizontalAlignment="Right"
Grid.Row="0"
Grid.Column="1">
-
+