Add project files
This commit is contained in:
commit
97cafcfa18
16 files changed
+1540
No files matched your search
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using NexvaneHub.Models;
|
||||
|
||||
namespace NexvaneHub.ViewModels;
|
||||
|
||||
/// <summary>
|
||||
/// Editable wrapper around a ProjectModel. Every property here is a live,
|
||||
/// bindable field that writes straight back onto the wrapped Model when
|
||||
/// changed - except Directory, which stays read-only since it's tied to the
|
||||
/// project's location on disk rather than something you'd retype.
|
||||
/// </summary>
|
||||
public partial class ProjectItemViewModel : ViewModelBase
|
||||
{
|
||||
public ProjectItemViewModel(ProjectModel model)
|
||||
{
|
||||
Model = model;
|
||||
|
||||
_name = model.Name;
|
||||
_lastModified = model.LastModified;
|
||||
_directory = model.Directory;
|
||||
_thumbnailPath = model.ThumbnailPath;
|
||||
_projectVersion = model.ProjectVersion;
|
||||
_sdkVersion = model.SdkVersion;
|
||||
_defaultCompiler = model.DefaultCompiler;
|
||||
_defaultArchitecture = model.DefaultArchitecture;
|
||||
}
|
||||
|
||||
public ProjectModel Model { get; }
|
||||
|
||||
public string LastModifiedDisplay => LastModified.ToString("dd-MM-yyyy");
|
||||
|
||||
[ObservableProperty]
|
||||
[NotifyPropertyChangedFor(nameof(LastModifiedDisplay))]
|
||||
private DateTime _lastModified;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _name;
|
||||
|
||||
/// <summary>Read-only in the UI - displayed via a plain field, not a TextBox.</summary>
|
||||
[ObservableProperty]
|
||||
private string _directory;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _thumbnailPath;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _projectVersion;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _sdkVersion;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _defaultCompiler;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _defaultArchitecture;
|
||||
|
||||
partial void OnNameChanged(string value) => Model.Name = value;
|
||||
partial void OnThumbnailPathChanged(string value) => Model.ThumbnailPath = value;
|
||||
partial void OnProjectVersionChanged(string value) => Model.ProjectVersion = value;
|
||||
partial void OnSdkVersionChanged(string value) => Model.SdkVersion = value;
|
||||
partial void OnDefaultCompilerChanged(string value) => Model.DefaultCompiler = value;
|
||||
partial void OnDefaultArchitectureChanged(string value) => Model.DefaultArchitecture = value;
|
||||
}
|
||||
Reference in new issue
Block a user