Skip to content

Commit

Permalink
Added displaying the list of servers [#3]
Browse files Browse the repository at this point in the history
  • Loading branch information
mcpierce committed Nov 23, 2023
1 parent a0a437c commit 749e5b2
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ jobs:
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"comixed_prestige" /o:"comixed" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner --version 4.8.0
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
9 changes: 4 additions & 5 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Application
x:Class="prestige.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:prestige">
<Application x:Class="prestige.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:prestige">

</Application>
53 changes: 43 additions & 10 deletions MainPage.xaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
<Page
x:Class="prestige.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:prestige"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page x:Class="prestige.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:prestige"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

<ListView ItemsSource="{x:Bind ServerEntries}"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:OPDSServerEntry">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Grid.Row="0"
Text="{x:Bind Name}"
Style="{ThemeResource SubtitleTextBlockStyle}" />
<TextBlock Grid.Column="0"
Grid.Row="1"
Text="{x:Bind Url}"
Style="{ThemeResource BodyTextBlockStyle}" />
<TextBlock Grid.Column="0"
Grid.Row="2"
Text="{x:Bind Username}"
Style="{ThemeResource BodyTextBlockStyle}" />
<TextBlock Grid.Column="0"
Grid.Row="3"
Text="{x:Bind DisplayableLastAccessedOn}"
Style="{ThemeResource BodyTextBlockStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Page>
15 changes: 15 additions & 0 deletions MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

using System;
using System.Collections.ObjectModel;
using Windows.UI.Xaml.Controls;

namespace prestige
{
public sealed partial class MainPage : Page
{
public ObservableCollection<OPDSServerEntry> ServerEntries { get; }
= new ObservableCollection<OPDSServerEntry>();

public MainPage()
{
this.InitializeComponent();

this.ServerEntries.Add(new OPDSServerEntry("My First Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Second Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Third Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Fourth Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Fifth Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Sixth Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Seventh Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));
this.ServerEntries.Add(new OPDSServerEntry("My Eighth Server", "https://localhost:7171/opds", "comixedreader@localhost", "comixedreader"));

}
}
}
63 changes: 63 additions & 0 deletions OPDSServerEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Prestige - A digital comic book reader application.
* Copyright (C) 2023, The ComiXed Project
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses>
*/

using System;
using System.Globalization;

namespace prestige
{
public class OPDSServerEntry
{
public OPDSServerEntry(string name, string url, string username, string password)
{
this.Name = name;
this.Url = url;
this.Username = username;
this.Password = password;
this.LastAccessedOn = DateTime.Now;
}

public string Name { get; set; }

public string Url { get; set; }

public string Username { get; set; }

public string Password { get; set; }

public DateTime CreatedOn { get; set; }

public Nullable<DateTime> LastAccessedOn { get; set; }

public string DisplayableLastAccessedOn
{
get
{
if (this.LastAccessedOn.HasValue)
{
return this.LastAccessedOn.Value.ToString("G", CultureInfo.CurrentCulture.DateTimeFormat);
}
else
{
return "Never";
}
}
}
}
}

1 change: 1 addition & 0 deletions prestige.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="OPDSServerEntry.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
Expand Down

0 comments on commit 749e5b2

Please sign in to comment.