feature(BuildCalc) Added reset button, can change micro delay, and can alter timing interval again
This commit is contained in:
@@ -22,7 +22,6 @@ public class DocumentationService : IDocumentationService
|
||||
public List<DocConnectionModel> DocConnectionModels { get; set; } = new();
|
||||
|
||||
|
||||
|
||||
public void Subscribe(Action? action)
|
||||
{
|
||||
OnChange += action;
|
||||
@@ -54,7 +53,7 @@ public class DocumentationService : IDocumentationService
|
||||
DocSectionModels =
|
||||
(await httpClient.GetFromJsonAsync<DocSectionModel[]>("generated/DocSectionModels.json") ??
|
||||
Array.Empty<DocSectionModel>()).ToList();
|
||||
|
||||
|
||||
SortSql();
|
||||
|
||||
isLoaded = true;
|
||||
@@ -88,28 +87,20 @@ public class DocumentationService : IDocumentationService
|
||||
}
|
||||
|
||||
foreach (var content in DocContentModels)
|
||||
{
|
||||
if (content.DocSectionModelId != null)
|
||||
{
|
||||
foreach (var section in DocSectionModels)
|
||||
{
|
||||
if (section.Id == content.DocSectionModelId)
|
||||
{
|
||||
section.DocumentationModels.Add(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ByPageOrder();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ByPageOrder()
|
||||
{
|
||||
DocContentModelsByPageOrder = new List<DocContentModel>();
|
||||
|
||||
int order = 1;
|
||||
var order = 1;
|
||||
foreach (var documentation in DocContentModels)
|
||||
{
|
||||
if (documentation.Parent != null) continue;
|
||||
|
||||
@@ -10,15 +10,17 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Services.Development;
|
||||
|
||||
public class GitService : IGitService {
|
||||
public class GitService : IGitService
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
private bool isLoaded;
|
||||
|
||||
private event Action OnChange = default!;
|
||||
|
||||
|
||||
public GitService(HttpClient httpClient) {
|
||||
|
||||
public GitService(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
@@ -32,30 +34,32 @@ public class GitService : IGitService {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
public void Subscribe(Action action) {
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action action) {
|
||||
public void Unsubscribe(Action action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public bool IsLoaded() {
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if NO_SQL
|
||||
|
||||
public async Task Load() {
|
||||
public async Task Load()
|
||||
{
|
||||
if (isLoaded) return;
|
||||
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
GitChangeModels = (await httpClient.GetFromJsonAsync<GitChangeModel[]>("generated/GitChangeModels.json") ?? Array.Empty<GitChangeModel>()).ToList();
|
||||
GitPatchModels = (await httpClient.GetFromJsonAsync<GitPatchModel[]>("generated/GitPatchModels.json") ?? Array.Empty<GitPatchModel>()).ToList();
|
||||
GitChangeModels = (await httpClient.GetFromJsonAsync<GitChangeModel[]>("generated/GitChangeModels.json") ??
|
||||
Array.Empty<GitChangeModel>()).ToList();
|
||||
GitPatchModels = (await httpClient.GetFromJsonAsync<GitPatchModel[]>("generated/GitPatchModels.json") ??
|
||||
Array.Empty<GitPatchModel>()).ToList();
|
||||
|
||||
|
||||
isLoaded = true;
|
||||
@@ -64,7 +68,6 @@ public class GitService : IGitService {
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
public async Task Load(DatabaseContext database) {
|
||||
Database = database;
|
||||
|
||||
@@ -84,12 +87,14 @@ public class GitService : IGitService {
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
public void Update() {
|
||||
|
||||
public void Update()
|
||||
{
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
private void NotifyDataChanged() {
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
}
|
||||
@@ -10,57 +10,73 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Services.Development;
|
||||
|
||||
public class NoteService : INoteService {
|
||||
public class NoteService : INoteService
|
||||
{
|
||||
private readonly HttpClient httpClient;
|
||||
|
||||
private bool isLoaded;
|
||||
|
||||
|
||||
private event Action OnChange = default!;
|
||||
|
||||
private void NotifyDataChanged() {
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
|
||||
public NoteService(HttpClient httpClient) {
|
||||
public NoteService(HttpClient httpClient)
|
||||
{
|
||||
this.httpClient = httpClient;
|
||||
}
|
||||
|
||||
public List<NoteContentModel> NoteContentModelsByPageOrder { get; set; } = new();
|
||||
|
||||
public List<NoteContentModel> NoteContentModels { get; set; } = default!;
|
||||
public List<NoteConnectionModel> NoteConnectionModels { get; set; } = null!;
|
||||
public List<NoteSectionModel> NoteSectionModels { get; set; } = null!;
|
||||
|
||||
public List<NoteContentModel> NoteContentModelsByPageOrder { get; set; } = new();
|
||||
|
||||
|
||||
public void Subscribe(Action action) {
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
OnChange += action;
|
||||
}
|
||||
|
||||
public void Unsubscribe(Action action) {
|
||||
public void Unsubscribe(Action action)
|
||||
{
|
||||
OnChange -= action;
|
||||
}
|
||||
|
||||
public bool IsLoaded() {
|
||||
public bool IsLoaded()
|
||||
{
|
||||
return isLoaded;
|
||||
}
|
||||
|
||||
public async Task Load() {
|
||||
if (isLoaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
NoteContentModels = (await httpClient.GetFromJsonAsync<NoteContentModel[]>("generated/NoteContentModels.json") ?? Array.Empty<NoteContentModel>()).ToList();
|
||||
NoteConnectionModels = (await httpClient.GetFromJsonAsync<NoteConnectionModel[]>("generated/NoteConnectionModels.json") ?? Array.Empty<NoteConnectionModel>()).ToList();
|
||||
NoteSectionModels = (await httpClient.GetFromJsonAsync<NoteSectionModel[]>("generated/NoteSectionModels.json") ?? Array.Empty<NoteSectionModel>()).ToList();
|
||||
|
||||
public async Task Load()
|
||||
{
|
||||
if (isLoaded) return;
|
||||
|
||||
NoteContentModels =
|
||||
(await httpClient.GetFromJsonAsync<NoteContentModel[]>("generated/NoteContentModels.json") ??
|
||||
Array.Empty<NoteContentModel>()).ToList();
|
||||
NoteConnectionModels =
|
||||
(await httpClient.GetFromJsonAsync<NoteConnectionModel[]>("generated/NoteConnectionModels.json") ??
|
||||
Array.Empty<NoteConnectionModel>()).ToList();
|
||||
NoteSectionModels =
|
||||
(await httpClient.GetFromJsonAsync<NoteSectionModel[]>("generated/NoteSectionModels.json") ??
|
||||
Array.Empty<NoteSectionModel>()).ToList();
|
||||
|
||||
isLoaded = true;
|
||||
|
||||
|
||||
SortSQL();
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
public void Update()
|
||||
{
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
private event Action OnChange = default!;
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange?.Invoke();
|
||||
}
|
||||
|
||||
private NoteContentModel? ContentById(int id)
|
||||
{
|
||||
foreach (var data in NoteContentModels!)
|
||||
@@ -69,7 +85,7 @@ public class NoteService : INoteService {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private void SortSQL()
|
||||
{
|
||||
foreach (var connection in NoteConnectionModels)
|
||||
@@ -79,27 +95,19 @@ public class NoteService : INoteService {
|
||||
}
|
||||
|
||||
foreach (var content in NoteContentModels)
|
||||
{
|
||||
if (content.NoteSectionModelId != null)
|
||||
{
|
||||
foreach (var section in NoteSectionModels)
|
||||
{
|
||||
if (section.Id == content.NoteSectionModelId)
|
||||
{
|
||||
section.NoteContentModels.Add(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ByPageOrder();
|
||||
}
|
||||
|
||||
|
||||
private void ByPageOrder()
|
||||
{
|
||||
NoteContentModelsByPageOrder = new List<NoteContentModel>();
|
||||
|
||||
int order = 1;
|
||||
var order = 1;
|
||||
foreach (var note in NoteContentModels)
|
||||
{
|
||||
if (note.Parent != null) continue;
|
||||
@@ -121,10 +129,7 @@ public class NoteService : INoteService {
|
||||
GetAllChildren(note);
|
||||
}
|
||||
|
||||
NoteContentModelsByPageOrder = NoteContentModelsByPageOrder.OrderBy(noteContent => noteContent.PageOrder).ToList();
|
||||
}
|
||||
|
||||
public void Update() {
|
||||
NotifyDataChanged();
|
||||
NoteContentModelsByPageOrder =
|
||||
NoteContentModelsByPageOrder.OrderBy(noteContent => noteContent.PageOrder).ToList();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user