Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions 10.0/Apps/DeveloperBalance/PageModels/ProjectDetailPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@ public partial class ProjectDetailPageModel : ObservableObject, IQueryAttributab
new IconData { Icon = FluentUI.bot_24_regular, Description = "Bot Icon" }
};

public bool HasCompletedTasks
private bool _canDelete;

public bool CanDelete
{
get => _canDelete;
set
{
_canDelete = value;
DeleteCommand.NotifyCanExecuteChanged();
}
}

public bool HasCompletedTasks
=> _project?.Tasks.Any(t => t.IsCompleted) ?? false;

public ProjectDetailPageModel(ProjectRepository projectRepository, TaskRepository taskRepository, CategoryRepository categoryRepository, TagRepository tagRepository, ModalErrorHandler errorHandler)
Expand Down Expand Up @@ -145,7 +157,8 @@ private async Task LoadData(int id)
finally
{
IsBusy = false;
OnPropertyChanged(nameof(HasCompletedTasks));
CanDelete = !_project.IsNullOrNew();
OnPropertyChanged(nameof(HasCompletedTasks));
}
}

Expand Down Expand Up @@ -216,7 +229,7 @@ await Shell.Current.GoToAsync($"task",
});
}

[RelayCommand]
[RelayCommand(CanExecute = nameof(CanDelete))]
private async Task Delete()
{
if (_project.IsNullOrNew())
Expand Down
1 change: 1 addition & 0 deletions 10.0/Apps/DeveloperBalance/Pages/ProjectDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

<ContentPage.ToolbarItems>
<ToolbarItem
Text="Delete"
Command="{Binding DeleteCommand}"
Order="Primary"
Priority="0"
Expand Down
19 changes: 16 additions & 3 deletions 9.0/Apps/DeveloperBalance/PageModels/ProjectDetailPageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,19 @@ public partial class ProjectDetailPageModel : ObservableObject, IQueryAttributab
new IconData { Icon = FluentUI.bot_24_regular, Description = "Bot Icon" }
};

public bool HasCompletedTasks
private bool _canDelete;

public bool CanDelete
{
get => _canDelete;
set
{
_canDelete = value;
DeleteCommand.NotifyCanExecuteChanged();
}
}

public bool HasCompletedTasks
=> _project?.Tasks.Any(t => t.IsCompleted) ?? false;

public ProjectDetailPageModel(ProjectRepository projectRepository, TaskRepository taskRepository, CategoryRepository categoryRepository, TagRepository tagRepository, ModalErrorHandler errorHandler)
Expand Down Expand Up @@ -153,7 +165,8 @@ private async Task LoadData(int id)
finally
{
IsBusy = false;
OnPropertyChanged(nameof(HasCompletedTasks));
CanDelete = !_project.IsNullOrNew();
OnPropertyChanged(nameof(HasCompletedTasks));
}
}

Expand Down Expand Up @@ -221,7 +234,7 @@ await Shell.Current.GoToAsync($"task",
});
}

[RelayCommand]
[RelayCommand(CanExecute = nameof(CanDelete))]
private async Task Delete()
{
if (_project.IsNullOrNew())
Expand Down
Loading