Merge pull request 'models-swap' (#5) from models-swap into master

Tested. LGTM!

Reviewed-on: #5
This commit is contained in:
Wyatt J. Miller 2022-07-02 13:36:04 -05:00
commit 95bfaae592
28 changed files with 257 additions and 680 deletions

View File

@ -2,6 +2,8 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeskHubSharpRevised", "DeskHubSharpRevised\DeskHubSharpRevised.csproj", "{4A987749-B593-4051-A55C-F011080AFC78}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "ModelsLib", "ModelsLib\ModelsLib.fsproj", "{3E51ADA6-475A-4A27-B0D3-93BB319B761D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -12,5 +14,9 @@ Global
{4A987749-B593-4051-A55C-F011080AFC78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A987749-B593-4051-A55C-F011080AFC78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A987749-B593-4051-A55C-F011080AFC78}.Release|Any CPU.Build.0 = Release|Any CPU
{3E51ADA6-475A-4A27-B0D3-93BB319B761D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3E51ADA6-475A-4A27-B0D3-93BB319B761D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3E51ADA6-475A-4A27-B0D3-93BB319B761D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3E51ADA6-475A-4A27-B0D3-93BB319B761D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using DeskHubSharpRevised.DAL;
using DeskHubSharpRevised.Models;
@ -63,8 +64,6 @@ public class Request
public List<string> PerformGetSort()
{
Sort sort = new Sort();
var sortTerms = sort.GetSortTerms();
return sortTerms;
return new Sort().GetSortTerms;
}
}

View File

@ -24,7 +24,7 @@ public class JsonDataService : IDataService
{
string jsonString = sr.ReadToEnd();
Search.ItemsItem users = JsonConvert.DeserializeObject<Search.ItemsItem>(_dataConfig);
ItemsItem users = JsonConvert.DeserializeObject<ItemsItem>(_dataConfig);
//user = users.items;
}

View File

@ -29,4 +29,7 @@
<PackageReference Include="RestSharp" Version="108.0.1" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ModelsLib\ModelsLib.fsproj" />
</ItemGroup>
</Project>

View File

@ -42,6 +42,7 @@ public partial class DetailWindow : Window
_repoDetail = repoDetail;
_request = new Request(_repoDetail.name);
_owner = new Owner();
_cmbbox_branches_items = this.Find<ComboBox>("cmbbox_branches");
_txtblk_language_text = this.Find<TextBlock>("txtblk_language");
_txtblk_watchers_text = this.Find<TextBlock>("txtblk_watchers");
@ -86,7 +87,7 @@ public partial class DetailWindow : Window
else
{
_owner = new Owner();
string link = "https://github.com/" + _repoDetail.owner.login + "/" + _repoDetail.name + "/archive/" + cmbbox_branches.SelectedItem + ".zip";
string link = "https://github.com/" + _owner.login + "/" + _repoDetail.name + "/archive/" + cmbbox_branches.SelectedItem + ".zip";
Process.Start(link);
}

View File

@ -1,14 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class Branch
{
public string name { get; set; }
public Commit commit { get; set; }
public class Commit
{
public string sha { get; set; }
public string url { get; set; }
}
}

View File

@ -1,34 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class Email
{
private string _toEmail = "wjmiller2016@gmail.com";
private string _fromEmail = "wjmiller2016@gmail.com";
private string _passwordEmail = "password";
public string Password
{
get { return _passwordEmail; }
set { _passwordEmail = value; }
}
public string FromEmail
{
get { return _fromEmail; }
set { _fromEmail = value; }
}
public string ToEmail
{
get { return _toEmail; }
set { _toEmail = value; }
}
/// <summary>
/// Constructor for the Email class
/// </summary>
public Email()
{
}
}

View File

@ -1,25 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class License
{
/// <summary>
///
/// </summary>
public string key { get; set; }
/// <summary>
///
/// </summary>
public string name { get; set; }
/// <summary>
///
/// </summary>
public string spdx_id { get; set; }
/// <summary>
///
/// </summary>
public string url { get; set; }
/// <summary>
///
/// </summary>
public string node_id { get; set; }
}

View File

@ -1,77 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class Owner
{
/// <summary>
///
/// </summary>
public string login { get; set; }
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
///
/// </summary>
public string node_id { get; set; }
/// <summary>
///
/// </summary>
public string avatar_url { get; set; }
/// <summary>
///
/// </summary>
public string gravatar_id { get; set; }
/// <summary>
///
/// </summary>
public string url { get; set; }
/// <summary>
///
/// </summary>
public string html_url { get; set; }
/// <summary>
///
/// </summary>
public string followers_url { get; set; }
/// <summary>
///
/// </summary>
public string following_url { get; set; }
/// <summary>
///
/// </summary>
public string gists_url { get; set; }
/// <summary>
///
/// </summary>
public string starred_url { get; set; }
/// <summary>
///
/// </summary>
public string subscriptions_url { get; set; }
/// <summary>
///
/// </summary>
public string organizations_url { get; set; }
/// <summary>
///
/// </summary>
public string repos_url { get; set; }
/// <summary>
///
/// </summary>
public string events_url { get; set; }
/// <summary>
///
/// </summary>
public string received_events_url { get; set; }
/// <summary>
///
/// </summary>
public string type { get; set; }
/// <summary>
///
/// </summary>
public string site_admin { get; set; }
}

View File

@ -1,294 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class RepoDetail
{
public Owner Owner { get; set; }
public License License { get; set; }
public int id { get; set; }
/// <summary>
///
/// </summary>
public string node_id { get; set; }
/// <summary>
///
/// </summary>
public string name { get; set; }
/// <summary>
///
/// </summary>
public string full_name { get; set; }
/// <summary>
///
/// </summary>
//public string private { get; set; }
/// <summary>
///
/// </summary>
public Owner owner { get; set; }
/// <summary>
///
/// </summary>
public string html_url { get; set; }
/// <summary>
///
/// </summary>
public string description { get; set; }
/// <summary>
///
/// </summary>
public string fork { get; set; }
/// <summary>
///
/// </summary>
public string url { get; set; }
/// <summary>
///
/// </summary>
public string forks_url { get; set; }
/// <summary>
///
/// </summary>
public string keys_url { get; set; }
/// <summary>
///
/// </summary>
public string collaborators_url { get; set; }
/// <summary>
///
/// </summary>
public string teams_url { get; set; }
/// <summary>
///
/// </summary>
public string hooks_url { get; set; }
/// <summary>
///
/// </summary>
public string issue_events_url { get; set; }
/// <summary>
///
/// </summary>
public string events_url { get; set; }
/// <summary>
///
/// </summary>
public string assignees_url { get; set; }
/// <summary>
///
/// </summary>
public string branches_url { get; set; }
/// <summary>
///
/// </summary>
public string tags_url { get; set; }
/// <summary>
///
/// </summary>
public string blobs_url { get; set; }
/// <summary>
///
/// </summary>
public string git_tags_url { get; set; }
/// <summary>
///
/// </summary>
public string git_refs_url { get; set; }
/// <summary>
///
/// </summary>
public string trees_url { get; set; }
/// <summary>
///
/// </summary>
public string statuses_url { get; set; }
/// <summary>
///
/// </summary>
public string languages_url { get; set; }
/// <summary>
///
/// </summary>
public string stargazers_url { get; set; }
/// <summary>
///
/// </summary>
public string contributors_url { get; set; }
/// <summary>
///
/// </summary>
public string subscribers_url { get; set; }
/// <summary>
///
/// </summary>
public string subscription_url { get; set; }
/// <summary>
///
/// </summary>
public string commits_url { get; set; }
/// <summary>
///
/// </summary>
public string git_commits_url { get; set; }
/// <summary>
///
/// </summary>
public string comments_url { get; set; }
/// <summary>
///
/// </summary>
public string issue_comment_url { get; set; }
/// <summary>
///
/// </summary>
public string contents_url { get; set; }
/// <summary>
///
/// </summary>
public string compare_url { get; set; }
/// <summary>
///
/// </summary>
public string merges_url { get; set; }
/// <summary>
///
/// </summary>
public string archive_url { get; set; }
/// <summary>
///
/// </summary>
public string downloads_url { get; set; }
/// <summary>
///
/// </summary>
public string issues_url { get; set; }
/// <summary>
///
/// </summary>
public string pulls_url { get; set; }
/// <summary>
///
/// </summary>
public string milestones_url { get; set; }
/// <summary>
///
/// </summary>
public string notifications_url { get; set; }
/// <summary>
///
/// </summary>
public string labels_url { get; set; }
/// <summary>
///
/// </summary>
public string releases_url { get; set; }
/// <summary>
///
/// </summary>
public string deployments_url { get; set; }
/// <summary>
///
/// </summary>
public string created_at { get; set; }
/// <summary>
///
/// </summary>
public string updated_at { get; set; }
/// <summary>
///
/// </summary>
public string pushed_at { get; set; }
/// <summary>
///
/// </summary>
public string git_url { get; set; }
/// <summary>
///
/// </summary>
public string ssh_url { get; set; }
/// <summary>
///
/// </summary>
public string clone_url { get; set; }
/// <summary>
///
/// </summary>
public string svn_url { get; set; }
/// <summary>
///
/// </summary>
public string homepage { get; set; }
/// <summary>
///
/// </summary>
public int size { get; set; }
/// <summary>
///
/// </summary>
public int stargazers_count { get; set; }
/// <summary>
///
/// </summary>
public int watchers_count { get; set; }
/// <summary>
///
/// </summary>
public string? language { get; set; }
/// <summary>
///
/// </summary>
public string has_issues { get; set; }
/// <summary>
///
/// </summary>
public string has_projects { get; set; }
/// <summary>
///
/// </summary>
public string has_downloads { get; set; }
/// <summary>
///
/// </summary>
public string has_wiki { get; set; }
/// <summary>
///
/// </summary>
public string has_pages { get; set; }
/// <summary>
///
/// </summary>
public int forks_count { get; set; }
/// <summary>
///
/// </summary>
public string mirror_url { get; set; }
/// <summary>
///
/// </summary>
public string archived { get; set; }
/// <summary>
///
/// </summary>
public int open_issues_count { get; set; }
/// <summary>
///
/// </summary>
public License license { get; set; }
/// <summary>
///
/// </summary>
public int forks { get; set; }
/// <summary>
///
/// </summary>
public int open_issues { get; set; }
/// <summary>
///
/// </summary>
public int watchers { get; set; }
/// <summary>
///
/// </summary>
public string default_branch { get; set; }
}

View File

@ -1,21 +0,0 @@
using System.Collections.ObjectModel;
namespace DeskHubSharpRevised.Models;
public class RequestList
{
/// <summary>
/// Stores everything in User, typically from the request
/// </summary>
public static User userDetail { get; set; }
/// <summary>
/// Stores everything sent in Branch, typically from request
/// </summary>
public static ObservableCollection<Branch> branchDetail { get; set; }
/// <summary>
/// Stores everything sent in RepoDetail, typically from request
/// </summary>
public static ObservableCollection<RepoDetail> repoDetail { get; set; }
}

View File

@ -1,151 +0,0 @@
using System.Collections.Generic;
namespace DeskHubSharpRevised.Models;
public class Search
{
public class Owner
{
/// <summary>
///
/// </summary>
public string login { get; set; }
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
///
/// </summary>
public string node_id { get; set; }
/// <summary>
///
/// </summary>
public string avatar_url { get; set; }
/// <summary>
///
/// </summary>
public string gravatar_id { get; set; }
/// <summary>
///
/// </summary>
public string url { get; set; }
/// <summary>
///
/// </summary>
public string received_events_url { get; set; }
/// <summary>
///
/// </summary>
public string type { get; set; }
}
public class ItemsItem
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
///
/// </summary>
public string node_id { get; set; }
/// <summary>
///
/// </summary>
public string name { get; set; }
/// <summary>
///
/// </summary>
public string full_name { get; set; }
/// <summary>
///
/// </summary>
public Owner owner { get; set; }
/// <summary>
///
/// </summary>
public string privates { get; set; }
/// <summary>
///
/// </summary>
public string html_url { get; set; }
/// <summary>
///
/// </summary>
public string description { get; set; }
/// <summary>
///
/// </summary>
public string fork { get; set; }
/// <summary>
///
/// </summary>
public string url { get; set; }
/// <summary>
///
/// </summary>
public string created_at { get; set; }
/// <summary>
///
/// </summary>
public string updated_at { get; set; }
/// <summary>
///
/// </summary>
public string pushed_at { get; set; }
/// <summary>
///
/// </summary>
public string homepage { get; set; }
/// <summary>
///
/// </summary>
public int size { get; set; }
/// <summary>
///
/// </summary>
public int stargazers_count { get; set; }
/// <summary>
///
/// </summary>
public int watchers_count { get; set; }
/// <summary>
///
/// </summary>
public string language { get; set; }
/// <summary>
///
/// </summary>
public int forks_count { get; set; }
/// <summary>
///
/// </summary>
public int open_issues_count { get; set; }
/// <summary>
///
/// </summary>
public string master_branch { get; set; }
/// <summary>
///
/// </summary>
public string default_branch { get; set; }
/// <summary>
///
/// </summary>
public double score { get; set; }
}
/// <summary>
///
/// </summary>
public int total_count { get; set; }
/// <summary>
///
/// </summary>
public string incomplete_results { get; set; }
/// <summary>
///
/// </summary>
public List<ItemsItem> items { get; set; }
}

View File

@ -1,22 +0,0 @@
using System.Collections.Generic;
namespace DeskHubSharpRevised.Models;
public class Sort
{
public Sort()
{
}
public List<string> GetSortTerms()
{
List<string> sortTerms = new List<string>();
sortTerms.Add("A - Z");
sortTerms.Add("Least to most Stars");
sortTerms.Add("Least to most Forks");
sortTerms.Add("Least to most Watchers");
return sortTerms;
}
}

View File

@ -1,36 +0,0 @@
namespace DeskHubSharpRevised.Models;
public class User
{
public string login { get; set; }
public int id { get; set; }
public string node_id { get; set; }
public string avatar_url { get; set; }
public string gravatar_id { get; set; }
public string url { get; set; }
public string html_url { get; set; }
public string followers_url { get; set; }
public string following_url { get; set; }
public string gists_url { get; set; }
public string starred_url { get; set; }
public string subscriptions_url { get; set; }
public string organizations_url { get; set; }
public string repos_url { get; set; }
public string events_url { get; set; }
public string received_events_url { get; set; }
public string type { get; set; }
public string site_admin { get; set; }
public string name { get; set; }
public string company { get; set; }
public string blog { get; set; }
public string location { get; set; }
public string email { get; set; }
public string hireable { get; set; }
public string bio { get; set; }
public int public_repos { get; set; }
public int public_gists { get; set; }
public int followers { get; set; }
public int following { get; set; }
public string created_at { get; set; }
public string updated_at { get; set; }
}

8
ModelsLib/Branch.fs Normal file
View File

@ -0,0 +1,8 @@
namespace DeskHubSharpRevised.Models
type Branch() =
member val name: string = null
with get, set
member val commit = new Commit()
with get, set

5
ModelsLib/Commit.fs Normal file
View File

@ -0,0 +1,5 @@
namespace DeskHubSharpRevised.Models
type Commit() =
member this.sha with get(): string = null
member this.url with get(): string = null

15
ModelsLib/Email.fs Normal file
View File

@ -0,0 +1,15 @@
namespace DeskHubSharpRevised.Models
type Email() =
let mutable _toEmail: string = "wjmiller2016@gmail.com"
let mutable _fromEmail: string = "wjmiller2016@gmail.com"
let mutable _password: string = "password"
member this.ToEmail
with get() = _toEmail
and set(value: string) = _toEmail <- value
member this.FromEmail
with get() = _fromEmail
and set(value: string) = _fromEmail <- value
member this.Password
with get() = _password

8
ModelsLib/License.fs Normal file
View File

@ -0,0 +1,8 @@
namespace DeskHubSharpRevised.Models
type License() =
member this.key with get() = null
member this.name with get() = null
member this.spdx_id with get() = null
member this.url with get() = null
member this.node_id with get() = null

View File

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RootNamespace>DeskHubSharpRevised.Models</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="Commit.fs" />
<Compile Include="Branch.fs" />
<Compile Include="Email.fs" />
<Compile Include="License.fs" />
<Compile Include="Owner.fs" />
<Compile Include="Search.fs" />
<Compile Include="User.fs" />
<Compile Include="Sort.fs" />
<Compile Include="RepoDetail.fs" />
<Compile Include="RequestList.fs" />
<Content Include="README.md" />
</ItemGroup>
<!--ItemGroup>
<ProjectReference Include="..\DeskHubSharpRevised\DeskHubSharpRevised.csproj" />
</ItemGroup-->
</Project>

21
ModelsLib/Owner.fs Normal file
View File

@ -0,0 +1,21 @@
namespace DeskHubSharpRevised.Models
type Owner() =
member this.login with get() = null
member this.id with get() = null
member this.node_id with get() = null
member this.avatar_url with get() = null
member this.gravatar_url with get() = null
member this.html_url with get() = null
member this.followers_url with get() = null
member this.following_url with get() = null
member this.gists_url with get() = null
member this.starred_url with get() = null
member this.subscriptions_url with get() = null
member this.organizations_url with get() = null
member this.repos_url with get() = null
member this.events_url with get() = null
member this.received_events_url with get() = null
member this.types with get() = null
member this.site_admin with get() = null

19
ModelsLib/README.md Normal file
View File

@ -0,0 +1,19 @@
# Models Library
Written by Wyatt J. Miller, 2022
Licensed by the Mozilla Public License version 2
## Ehh?
I decided to rip out the existing models that were written in C# and replace them with the exact same models. The only difference is that these models are written in F#.
## Why F#?
1. .NET
1. I didn't have to move forward and learn how everything worked
2. Curiosity
1. Never messed with F#
2. Messed with it's functional cousins (i.e. Kotlin, Rust, etc.)
# I HAD TO WRITE ALL THESE FILES BY HAND

27
ModelsLib/RepoDetail.fs Normal file
View File

@ -0,0 +1,27 @@
namespace DeskHubSharpRevised.Models
type RepoDetail() =
member val owner: Owner = new Owner()
with get, set
member val license: License = new License()
with get, set
member val id: int = 0
with get, set
member val node_id: string = null
with get, set
member val name: string = null
with get, set
member val full_name: string = null
with get, set
member val html_url: string = null
with get, set
member val description: string = null
with get, set
member val stargazers_count: int = 0
with get, set
member val forks_count: int = 0
with get, set
member val watchers_count: int = 0
with get, set
member val language: string = null
with get, set

11
ModelsLib/RequestList.fs Normal file
View File

@ -0,0 +1,11 @@
namespace DeskHubSharpRevised.Models
open System.Collections.ObjectModel
type RequestList() =
static member val userDetail = new User()
with get, set
static member val branchDetail = new ObservableCollection<Branch>()
with get, set
static member val repoDetail = new ObservableCollection<RepoDetail>()
with get, set

52
ModelsLib/Search.fs Normal file
View File

@ -0,0 +1,52 @@
namespace DeskHubSharpRevised.Models
open System.Collections.Generic
type Search() =
member this.total_count with get(): int = 0
member this.incomplete_results with get(): int = 0
member this.items with get(): List<obj> = null
type SearchOwner() =
member this.login
with get(): string = null
and set(value: string) = this.login <- value
member this.id
with get(): int = 0
and set(value: int) = this.id <- value
member this.node_id
with get(): string = null
member this.avatar_url
with get(): string = null
member this.gravatar_url
with get(): string = null
member this.url
with get(): string = null
member this.received_events_url
with get(): string = null
member this.types
with get(): string = null
type ItemsItem() =
member this.id with get(): int = 0
member this.node_id with get(): string = null
member this.name with get(): string = null
member this.full_name with get(): string = null
member this.owner with get(): obj = null
member this.privates with get(): string = null
member this.url with get(): string = null
member this.created_at with get(): string = null
member this.updated_at with get(): string = null
member this.pushed_at: string = null
member this.homepage: string = null
member this.size: int = 0
member this.stargazers_count: int = 0
member this.watchers_count: int = 0
member this.language: string = null
member this.forks_count: string = null
member this.open_issues_count: int = 0
member this.master_branch: string = null
member this.default_branch: string = null
member this.score: double = 0.0

7
ModelsLib/Sort.fs Normal file
View File

@ -0,0 +1,7 @@
namespace DeskHubSharpRevised.Models
type public Sort() =
let terms =
["A - Z"; "Least to Most Stars"; "Least to Most Forks"; "Least to Most Watchers"]
member this.GetSortTerms = ResizeArray<string> terms

32
ModelsLib/User.fs Normal file
View File

@ -0,0 +1,32 @@
namespace DeskHubSharpRevised.Models
type User() =
member val login = ""
with get, set
member val id = 0
with get, set
member val node_id = ""
with get, set
member val avatar_url = ""
with get, set
member val gravatar_url = ""
with get, set
member val url = ""
with get, set
member val html_url = ""
with get, set
member val followers_url = ""
with get, set
member val following_url = ""
with get, set
member val gists_url = ""
with get, set
member val blog = ""
with get, set
member val bio = ""
with get, set
member val name = ""
with get, set
member val public_repos = ""
with get, set

View File

@ -28,6 +28,10 @@ I also ripped out the legacy .NET Framework and put .NET 6 in it's place, which
Think WPF but cross platform. Avalonia still runs your favorite declarative language, XAML, but applies a different drawing library, Skia (SkiaSharp). What Skia allows Avalonia to do is draw windows, buttons, and other widgets on not just Windows, but macOS, Linux, Android, and iOS. Even Web Assembly! Learn more [here](http://avaloniaui.net/).
###### 🚧👷‍♂️ All developers! Wear your hard hats! 🚧👷‍♂️
This application is still in the porting process. Don't worry though! It's being worked on. Please file an [issue]() if find anything that shouldn't be happening.
## Building
### Requirements
@ -46,6 +50,8 @@ Clone using the following command:
### Deployment
All build tasks go through the `dotnet` command.
If you want to build for development, run:
`dotnet run --project DeskHubSharpRevised/DeskHubSharpRevised.csproj`
@ -58,6 +64,8 @@ If you want to build for production for Windows, run:
`dotnet publish DeskHubSharpRevised/DeskHubSharpRevised.csproj --configuration Release --framework net6.0 --output publish --self-contained True --runtime win-x64 --verbosity Normal /property:PublishTrimmed=True /property:PublishSingleFile=True /property:IncludeNativeLibrariesForSelfExtract=True /property:DebugType=None /property:DebugSymbols=False`
These tasks are supposed to be replaced with Cake in the near future.
## Documentation
To see the developer documentation, please run the following command in Powershell/bash:
@ -73,3 +81,5 @@ Also note that this step is optional. This step only generates documentation, wh
## Contribution
Issues and pull requests are more than welcome.
I don't have a style guide yet.