diff --git a/Models/ReportFile.cs b/Models/ReportFile.cs index d46949b..93b1932 100644 --- a/Models/ReportFile.cs +++ b/Models/ReportFile.cs @@ -6,9 +6,6 @@ namespace ReceiptPDFBuilder.Models; class ReportFile : ChangeNotifier { - private bool _isMoveUpEnabled = false; - private bool _isMoveDownEnabled = false; - private string _title; private DateOnly _date; private DateTime _dateTime; @@ -78,16 +75,4 @@ class ReportFile : ChangeNotifier { get => Path.GetFileName(_filePath); } - - public bool IsMoveUpEnabled - { - get => _isMoveUpEnabled; - set { _isMoveUpEnabled = value; NotifyPropertyChanged(); } - } - - public bool IsMoveDownEnabled - { - get => _isMoveDownEnabled; - set { _isMoveDownEnabled = value; NotifyPropertyChanged(); } - } } \ No newline at end of file diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs index a5c22b2..c1eca5e 100644 --- a/ViewModels/MainViewModel.cs +++ b/ViewModels/MainViewModel.cs @@ -95,26 +95,14 @@ class MainViewModel : BaseViewModel, IFontResolver Date = DateOnly.FromDateTime(File.GetCreationTime(filePath)), Notes = "", FilePath = filePath, - IsMoveDownEnabled = true, - IsMoveUpEnabled = true, }); } } - UpdateMoveEnabled(); } } } } - private void UpdateMoveEnabled() - { - for (var i = 0; i < ReportFiles.Count; i++) - { - ReportFiles[i].IsMoveUpEnabled = i != 0; - ReportFiles[i].IsMoveDownEnabled = i != ReportFiles.Count - 1; - } - } - public void MoveItemUp(ReportFile file) { var idx = ReportFiles.IndexOf(file); @@ -127,7 +115,6 @@ class MainViewModel : BaseViewModel, IFontResolver // So, remove and insert. ReportFiles.RemoveAt(idx); ReportFiles.Insert(idx - 1, file); - UpdateMoveEnabled(); } } @@ -138,7 +125,6 @@ class MainViewModel : BaseViewModel, IFontResolver { ReportFiles.RemoveAt(idx); ReportFiles.Insert(idx + 1, file); - UpdateMoveEnabled(); } } @@ -151,7 +137,6 @@ class MainViewModel : BaseViewModel, IFontResolver if (idx != -1) { ReportFiles.RemoveAt(idx); - UpdateMoveEnabled(); } } } diff --git a/Views/MainView.axaml b/Views/MainView.axaml index 2a1bd9e..7ef9a01 100644 --- a/Views/MainView.axaml +++ b/Views/MainView.axaml @@ -66,9 +66,10 @@ @@ -96,27 +97,12 @@ - - -