6
6
7
7
namespace OpenLoco . Gui . ViewModels
8
8
{
9
+ public record FileViewButton ( ReactiveCommand < Unit , Unit > Command , string Text , string Icon ) ;
10
+
11
+ public interface ILocoFileViewModelControl
12
+ {
13
+ [ Reactive ]
14
+ public FileSystemItem CurrentFile { get ; init ; }
15
+
16
+ ListObservable < FileViewButton > Buttons { get ; }
17
+ }
18
+
9
19
public interface ILocoFileViewModel
10
20
{
11
21
public ReactiveCommand < Unit , Unit > ReloadCommand { get ; init ; }
12
22
public ReactiveCommand < Unit , Unit > SaveCommand { get ; init ; }
13
23
public ReactiveCommand < Unit , Unit > SaveAsCommand { get ; init ; }
24
+ public ReactiveCommand < Unit , Unit > DeleteLocalFileCommand { get ; init ; }
14
25
15
26
[ Reactive ]
16
27
public FileSystemItem CurrentFile { get ; init ; }
17
28
29
+ [ Reactive ]
30
+ public bool IsLocalMode => CurrentFile . FileLocation == FileLocation . Local ;
31
+
18
32
public string ReloadText { get ; }
19
33
public string SaveText { get ; }
20
34
public string SaveAsText { get ; }
35
+ public string DeleteLocalFileText { get ; }
21
36
22
37
public string ReloadIcon { get ; }
23
38
public string SaveIcon { get ; }
24
39
public string SaveAsIcon { get ; }
40
+ public string DeleteLocalFileIcon { get ; }
25
41
}
26
42
27
43
public abstract class BaseLocoFileViewModel : ReactiveObject , ILocoFileViewModel
@@ -34,6 +50,7 @@ protected BaseLocoFileViewModel(FileSystemItem currentFile, ObjectEditorModel mo
34
50
ReloadCommand = ReactiveCommand . Create ( Load ) ;
35
51
SaveCommand = ReactiveCommand . Create ( Save ) ;
36
52
SaveAsCommand = ReactiveCommand . Create ( SaveAs ) ;
53
+ DeleteLocalFileCommand = ReactiveCommand . Create ( Delete ) ;
37
54
}
38
55
39
56
[ Reactive ]
@@ -45,19 +62,23 @@ protected BaseLocoFileViewModel(FileSystemItem currentFile, ObjectEditorModel mo
45
62
public ReactiveCommand < Unit , Unit > ReloadCommand { get ; init ; }
46
63
public ReactiveCommand < Unit , Unit > SaveCommand { get ; init ; }
47
64
public ReactiveCommand < Unit , Unit > SaveAsCommand { get ; init ; }
65
+ public ReactiveCommand < Unit , Unit > DeleteLocalFileCommand { get ; init ; }
48
66
49
67
public abstract void Load ( ) ;
50
68
51
69
public abstract void Save ( ) ;
52
70
53
71
public abstract void SaveAs ( ) ;
72
+ public virtual void Delete ( ) { }
54
73
55
74
public string ReloadText => CurrentFile . FileLocation == FileLocation . Local ? "Reload" : "Redownload" ;
56
75
public string SaveText => CurrentFile . FileLocation == FileLocation . Local ? "Save" : "Download" ;
57
76
public string SaveAsText => $ "{ SaveText } As";
77
+ public string DeleteLocalFileText => "Delete File" ;
58
78
59
79
public string ReloadIcon => CurrentFile . FileLocation == FileLocation . Local ? "DatabaseRefresh" : "FileSync" ;
60
80
public string SaveIcon => CurrentFile . FileLocation == FileLocation . Local ? "ContentSave" : "FileDownload" ;
61
81
public string SaveAsIcon => CurrentFile . FileLocation == FileLocation . Local ? "ContentSavePlus" : "FileDownloadOutline" ;
82
+ public string DeleteLocalFileIcon => "DeleteForever" ;
62
83
}
63
84
}
0 commit comments