You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
1 year ago
|
using System;
|
||
|
using System.Text.Json.Serialization;
|
||
|
using Avalonia.Controls;
|
||
1 year ago
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||
1 year ago
|
using StabilityMatrix.Avalonia.Models;
|
||
1 year ago
|
using StabilityMatrix.Core.Models.FileInterfaces;
|
||
1 year ago
|
|
||
1 year ago
|
#pragma warning disable CS0657 // Not a valid attribute location for this declaration
|
||
|
|
||
1 year ago
|
namespace StabilityMatrix.Avalonia.ViewModels.Base;
|
||
1 year ago
|
|
||
1 year ago
|
public abstract partial class InferenceTabViewModelBase : LoadableViewModelBase, IDisposable, IPersistentViewProvider
|
||
1 year ago
|
{
|
||
|
/// <summary>
|
||
|
/// The title of the tab
|
||
|
/// </summary>
|
||
1 year ago
|
public virtual string TabTitle => ProjectFile?.NameWithoutExtension ?? "New Project";
|
||
1 year ago
|
|
||
|
/// <summary>
|
||
|
/// Whether there are unsaved changes
|
||
|
/// </summary>
|
||
|
[ObservableProperty]
|
||
|
[property: JsonIgnore]
|
||
|
private bool hasUnsavedChanges;
|
||
|
|
||
|
/// <summary>
|
||
|
/// The tab's project file
|
||
|
/// </summary>
|
||
|
[ObservableProperty]
|
||
|
[NotifyPropertyChangedFor(nameof(TabTitle))]
|
||
|
[property: JsonIgnore]
|
||
|
private FilePath? projectFile;
|
||
1 year ago
|
|
||
|
/// <inheritdoc />
|
||
|
Control? IPersistentViewProvider.AttachedPersistentView { get; set; }
|
||
|
|
||
|
protected virtual void Dispose(bool disposing)
|
||
|
{
|
||
|
if (disposing)
|
||
|
{
|
||
|
((IPersistentViewProvider) this).AttachedPersistentView = null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <inheritdoc />
|
||
|
public void Dispose()
|
||
|
{
|
||
|
Dispose(true);
|
||
|
GC.SuppressFinalize(this);
|
||
|
}
|
||
1 year ago
|
}
|