2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 16:33:43 -04:00

[Observatory Core] New UI tweaks round 1 (#128) Plus merging #119 from main onto this branch

* [Framework] Add a DateTime property for CarrierJumpRequest DepartureTime (#119)

Refactored out the logic backing the JournalBase TimestampDateTime property so it can be used for any DateTime type property, providing a standardized json String -> DateTime conversion for any date-time property. Implemented as an `internal static` method on JournalBase so journal objects which inherit from JournalBase or don't inherit from it can use it.

Used this to provide a DepatureTimeDateTime on CarrierJumpRequest (this property was added in Update 14) and to implement the existing ExpiryDateTime on CurrentGoal.

From a quick search in the journal documentation, I don't see any other applications for this.

* [ObservatoryCore] UI tweaks

Polishing a few rough edges:
* Enable scrolling on the Plugin List view. It only fit 6 or 7. I have 13.
* I fiddled a bit with column auto-sizing (left it commented out, see comment).
* A whole bunch of tweaks to the settings view:
  * first row of controls was cut off at the top (under the window title bar)
  * fixing that revealed uneven spacing between columns
  * action buttons were teensy tiny and unreadable
  * settings view columns were too narrow (200 px).
  * added some spacing to help with readability
  * settings windows now start in center of current screen rather than some random place.
This commit is contained in:
F K
2024-01-22 18:59:31 -05:00
committed by GitHub
parent d061275e36
commit dce2516414
7 changed files with 57 additions and 34 deletions

View File

@ -1,4 +1,6 @@
namespace Observatory.Framework.Files.Journal
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Journal
{
public class CarrierJumpRequest : JournalBase
{
@ -9,5 +11,10 @@
public string SystemName { get; init; }
public ulong SystemID { get; init; }
public string DepartureTime { get; init; }
[JsonIgnore]
public DateTime DepartureTimeDateTime {
get => ParseDateTime(DepartureTime);
}
}
}

View File

@ -12,10 +12,7 @@ namespace Observatory.Framework.Files.Journal
[JsonIgnore]
public DateTime TimestampDateTime
{
get
{
return DateTime.ParseExact(Timestamp, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal);
}
get => ParseDateTime(Timestamp);
}
[JsonPropertyName("event")]
@ -43,5 +40,17 @@ namespace Observatory.Framework.Files.Journal
private string json;
// For use by Journal object classes for .*DateTime properties, like TimestampeDateTime, above.
internal static DateTime ParseDateTime(string value)
{
if (DateTime.TryParseExact(value, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal, out DateTime dateTimeValue))
{
return dateTimeValue;
}
else
{
return new DateTime();
}
}
}
}

View File

@ -1,4 +1,5 @@
using Microsoft.VisualBasic.CompilerServices;
using Observatory.Framework.Files.Journal;
using System;
using System.Numerics;
@ -13,17 +14,7 @@ namespace Observatory.Framework.Files.ParameterTypes
public string Expiry { get; init; }
public DateTime ExpiryDateTime
{
get
{
if (DateTime.TryParseExact(Expiry, "yyyy-MM-ddTHH:mm:ssZ", null, System.Globalization.DateTimeStyles.AssumeUniversal, out DateTime expiryDateTime))
{
return expiryDateTime;
}
else
{
return new DateTime();
}
}
get => JournalBase.ParseDateTime(Expiry);
}
public bool IsComplete { get; init; }
public long CurrentTotal { get; init; }