diff --git a/.editorconfig b/.editorconfig index 8f46b46..eb765ae 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,7 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true diff --git a/Directory.Build.props b/Directory.Build.props index 3a82054..17bc977 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,9 @@ + 0.1.0 + GalaxyViewer + Galaxy Littlepaws enable 11.0.10 - + \ No newline at end of file diff --git a/GalaxyViewer.sln b/GalaxyViewer.sln index d6733f9..16110a8 100644 --- a/GalaxyViewer.sln +++ b/GalaxyViewer.sln @@ -9,10 +9,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.Desktop", "Gal EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.Browser", "GalaxyViewer.Browser\GalaxyViewer.Browser.csproj", "{1C1A049E-235C-4CD0-B6FA-D53AC418F4DA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.iOS", "GalaxyViewer.iOS\GalaxyViewer.iOS.csproj", "{EBD9022F-BC83-4846-9A11-6F7F3772DC64}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.Android", "GalaxyViewer.Android\GalaxyViewer.Android.csproj", "{7AD1DAC8-7FBE-49D5-8614-7321233DB82E}" -EndProject +# Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.iOS", "GalaxyViewer.iOS\GalaxyViewer.iOS.csproj", "{EBD9022F-BC83-4846-9A11-6F7F3772DC64}" +# EndProject +# Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GalaxyViewer.Android", "GalaxyViewer.Android\GalaxyViewer.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.Build.props = Directory.Build.props diff --git a/GalaxyViewer/Assets/grids.xml b/GalaxyViewer/Assets/grids.xml new file mode 100644 index 0000000..f08a750 --- /dev/null +++ b/GalaxyViewer/Assets/grids.xml @@ -0,0 +1,57 @@ + + + + + + gridnick + agni + gridname + Second Life (agni) + platform + SecondLife + loginuri + https://login.agni.lindenlab.com/cgi-bin/login.cgi + loginpage + http://secondlife.com/app/login/?channel=Second+Life+Release + helperuri + https://secondlife.com/helpers/ + website + http://secondlife.com/ + support + http://secondlife.com/support/ + register + http://secondlife.com/registration/ + password + http://secondlife.com/account/request.php + version + 0 + + + + + gridnick + aditi + gridname + Second Life Beta (aditi) + platform + SecondLife + loginuri + https://login.aditi.lindenlab.com/cgi-bin/login.cgi + loginpage + http://secondlife.com/app/login/?channel=Second+Life+Beta + helperuri + http://aditi-secondlife.webdev.lindenlab.com/helpers/ + website + http://secondlife.com/ + support + http://secondlife.com/support/ + register + http://secondlife.com/registration/ + password + http://secondlife.com/account/request.php + version + 1 + + + + \ No newline at end of file diff --git a/GalaxyViewer/GalaxyViewer.csproj b/GalaxyViewer/GalaxyViewer.csproj index ac840e0..040641a 100644 --- a/GalaxyViewer/GalaxyViewer.csproj +++ b/GalaxyViewer/GalaxyViewer.csproj @@ -5,7 +5,7 @@ latest true - + @@ -17,5 +17,6 @@ + diff --git a/GalaxyViewer/Models/Grid.cs b/GalaxyViewer/Models/Grid.cs new file mode 100644 index 0000000..af48ec9 --- /dev/null +++ b/GalaxyViewer/Models/Grid.cs @@ -0,0 +1,34 @@ +using System; + +namespace GalaxyViewer.Models +{ + public class Grid + { + public string GridNick { get; set; } + public string GridName { get; set; } + public string Platform { get; set; } + public string LoginUri { get; set; } + public string LoginPage { get; set; } + public string HelperUri { get; set; } + public string Website { get; set; } + public string Support { get; set; } + public string Register { get; set; } + public string Password { get; set; } + public string Version { get; set; } + + public Grid(string gridNick, string gridName, string platform, string loginUri, string loginPage, string helperUri, string website, string support, string register, string password, string version) + { + GridNick = !string.IsNullOrEmpty(gridNick) ? gridNick : throw new ArgumentNullException(nameof(gridNick)); + GridName = !string.IsNullOrEmpty(gridName) ? gridName : throw new ArgumentNullException(nameof(gridName)); + Platform = !string.IsNullOrEmpty(platform) ? platform : throw new ArgumentNullException(nameof(platform)); + LoginUri = !string.IsNullOrEmpty(loginUri) ? loginUri : throw new ArgumentNullException(nameof(loginUri)); + LoginPage = !string.IsNullOrEmpty(loginPage) ? loginPage : throw new ArgumentNullException(nameof(loginPage)); + HelperUri = !string.IsNullOrEmpty(helperUri) ? helperUri : throw new ArgumentNullException(nameof(helperUri)); + Website = !string.IsNullOrEmpty(website) ? website : throw new ArgumentNullException(nameof(website)); + Support = !string.IsNullOrEmpty(support) ? support : throw new ArgumentNullException(nameof(support)); + Register = !string.IsNullOrEmpty(register) ? register : throw new ArgumentNullException(nameof(register)); + Password = !string.IsNullOrEmpty(password) ? password : throw new ArgumentNullException(nameof(password)); + Version = !string.IsNullOrEmpty(version) ? version : throw new ArgumentNullException(nameof(version)); + } + } +} \ No newline at end of file diff --git a/GalaxyViewer/Services/GridService.cs b/GalaxyViewer/Services/GridService.cs new file mode 100644 index 0000000..9c35fe8 --- /dev/null +++ b/GalaxyViewer/Services/GridService.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.Linq; +using GalaxyViewer.Models; + +namespace GalaxyViewer.Services +{ + public class GridService + { + public List ParseGridsFromXml() + { + string xmlFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Assets", "grids.xml"); + var xdoc = XDocument.Load(xmlFilePath); + var grids = new List(); + + if (xdoc.Root != null) + { + foreach (var gridElement in xdoc.Root.Elements("grid")) + { + var grid = new Grid( + gridElement.Element("gridnick")?.Value ?? string.Empty, + gridElement.Element("gridname")?.Value ?? string.Empty, + gridElement.Element("platform")?.Value ?? string.Empty, + gridElement.Element("loginuri")?.Value ?? string.Empty, + gridElement.Element("loginpage")?.Value ?? string.Empty, + gridElement.Element("helperuri")?.Value ?? string.Empty, + gridElement.Element("website")?.Value ?? string.Empty, + gridElement.Element("support")?.Value ?? string.Empty, + gridElement.Element("register")?.Value ?? string.Empty, + gridElement.Element("password")?.Value ?? string.Empty, + gridElement.Element("version")?.Value ?? string.Empty + ); + + grids.Add(grid); + } + } + + return grids; + } + } +} \ No newline at end of file diff --git a/GalaxyViewer/ViewModels/MainViewModel.cs b/GalaxyViewer/ViewModels/MainViewModel.cs index cba6c52..6169093 100644 --- a/GalaxyViewer/ViewModels/MainViewModel.cs +++ b/GalaxyViewer/ViewModels/MainViewModel.cs @@ -1,8 +1,44 @@ -namespace GalaxyViewer.ViewModels; +using Avalonia.Controls; +using GalaxyViewer.Views; +using ReactiveUI; +using System.Reactive; -public class MainViewModel : ViewModelBase +namespace GalaxyViewer.ViewModels { -#pragma warning disable CA1822 // Mark members as static - public string Greeting => "Welcome to Avalonia!"; -#pragma warning restore CA1822 // Mark members as static -} + public class MainViewModel : ViewModelBase + { + private UserControl? _currentView; + private bool _isLoggedIn; + + public UserControl? CurrentView + { + get => _currentView; + set => this.RaiseAndSetIfChanged(ref _currentView, value); + } + + public bool IsLoggedIn + { + get => _isLoggedIn; + set + { + this.RaiseAndSetIfChanged(ref _isLoggedIn, value); + CurrentView = value ? (UserControl)new LoggedInView() : new LoginView(); + } + } + + public ReactiveCommand LogoutCommand { get; } + + public MainViewModel() + { + _currentView = new LoginView(); + IsLoggedIn = false; // Set this to true when the user logs in + + LogoutCommand = ReactiveCommand.Create(Logout); + } + + private void Logout() + { + IsLoggedIn = false; + } + } +} \ No newline at end of file diff --git a/GalaxyViewer/Views/LoggedInView.axaml b/GalaxyViewer/Views/LoggedInView.axaml new file mode 100644 index 0000000..f1226c2 --- /dev/null +++ b/GalaxyViewer/Views/LoggedInView.axaml @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/GalaxyViewer/Views/LoggedInView.axaml.cs b/GalaxyViewer/Views/LoggedInView.axaml.cs new file mode 100644 index 0000000..887e771 --- /dev/null +++ b/GalaxyViewer/Views/LoggedInView.axaml.cs @@ -0,0 +1,18 @@ +using Avalonia.Controls; +using Avalonia.Markup.Xaml; + +namespace GalaxyViewer.Views +{ + public partial class LoggedInView : UserControl + { + public LoggedInView() + { + InitializeComponent(); + } + + private void InitializeComponent() + { + AvaloniaXamlLoader.Load(this); + } + } +} \ No newline at end of file diff --git a/GalaxyViewer/Views/LoginView.axaml b/GalaxyViewer/Views/LoginView.axaml new file mode 100644 index 0000000..76fb0e3 --- /dev/null +++ b/GalaxyViewer/Views/LoginView.axaml @@ -0,0 +1,9 @@ + + + + +