feat: add CanExecute for command
This commit is contained in:
@@ -17,7 +17,9 @@ namespace BallanceTasEditor.Frontend.Shared {
|
|||||||
bool ShowConfirmExitWhenOpeningFileDialog();
|
bool ShowConfirmExitWhenOpeningFileDialog();
|
||||||
bool ShowFileChangedDialog();
|
bool ShowFileChangedDialog();
|
||||||
GotoDialogResult? ShowGotoDialog();
|
GotoDialogResult? ShowGotoDialog();
|
||||||
|
bool ShowConfirmClearKeysDialog();
|
||||||
EditFpsDialogResult? ShowEditFpsDialog();
|
EditFpsDialogResult? ShowEditFpsDialog();
|
||||||
|
bool ShowConfirmUniformFpsDialog();
|
||||||
AddFrameDialogResult? ShowAddFrameDialog();
|
AddFrameDialogResult? ShowAddFrameDialog();
|
||||||
PreferenceDialogResult? ShowPreferenceDialog();
|
PreferenceDialogResult? ShowPreferenceDialog();
|
||||||
void ShowManuallyReportBugDialog();
|
void ShowManuallyReportBugDialog();
|
||||||
@@ -133,6 +135,14 @@ namespace BallanceTasEditor.Frontend.Shared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShowConfirmClearKeysDialog() {
|
||||||
|
var rv = MessageBox.Show(
|
||||||
|
"Do you really want to clear keys for all frames?\nThis operation can not be revoked.",
|
||||||
|
"Clear Keys",
|
||||||
|
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
|
return rv == MessageBoxResult.Yes;
|
||||||
|
}
|
||||||
|
|
||||||
public EditFpsDialogResult? ShowEditFpsDialog() {
|
public EditFpsDialogResult? ShowEditFpsDialog() {
|
||||||
var dialog = new Views.EditFpsDialog();
|
var dialog = new Views.EditFpsDialog();
|
||||||
dialog.Owner = m_Parent;
|
dialog.Owner = m_Parent;
|
||||||
@@ -144,6 +154,14 @@ namespace BallanceTasEditor.Frontend.Shared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ShowConfirmUniformFpsDialog() {
|
||||||
|
var rv = MessageBox.Show(
|
||||||
|
"Do you really want to set an uniform FPS value for all frames?\nThis operation can not be revoked.",
|
||||||
|
"Uniform FPS",
|
||||||
|
MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
|
return rv == MessageBoxResult.Yes;
|
||||||
|
}
|
||||||
|
|
||||||
public AddFrameDialogResult? ShowAddFrameDialog() {
|
public AddFrameDialogResult? ShowAddFrameDialog() {
|
||||||
var dialog = new Views.AddFrameDialog();
|
var dialog = new Views.AddFrameDialog();
|
||||||
dialog.Owner = m_Parent;
|
dialog.Owner = m_Parent;
|
||||||
|
|||||||
@@ -181,84 +181,128 @@ namespace BallanceTasEditor.Frontend.ViewModels {
|
|||||||
|
|
||||||
#region Undo and Redo
|
#region Undo and Redo
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanUndo))]
|
||||||
private void Undo() {
|
private void Undo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
private bool CanUndo() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanRedo))]
|
||||||
private void Redo() {
|
private void Redo() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanRedo() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Viewer Operation
|
#region Viewer Operation
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanPreviousPage))]
|
||||||
private void PreviousPage() {
|
private void PreviousPage() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanPreviousPage() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanPreviousItem))]
|
||||||
private void PreviousItem() {
|
private void PreviousItem() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanPreviousItem() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanNextPage))]
|
||||||
private void NextPage() {
|
private void NextPage() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanNextPage() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanNextItem))]
|
||||||
private void NextItem() {
|
private void NextItem() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanNextItem() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanGoto))]
|
||||||
private void Goto() {
|
private void Goto() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanGoto() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Tool Mode
|
#region Tool Mode
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanSelectMode))]
|
||||||
[RelayCommand]
|
|
||||||
private void SelectMode() {
|
private void SelectMode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanSelectMode() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanFillMode))]
|
||||||
private void FillMode() {
|
private void FillMode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanFillMode() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanDrawMode))]
|
||||||
private void DrawMode() {
|
private void DrawMode() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanDrawMode() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Misc Edit Operations
|
#region Misc Edit Operations
|
||||||
|
|
||||||
|
[RelayCommand(CanExecute = nameof(CanUniformFps))]
|
||||||
[RelayCommand]
|
|
||||||
private void ClearKeys() {
|
private void ClearKeys() {
|
||||||
|
m_DialogService.ShowConfirmClearKeysDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CanClearKeys() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand(CanExecute = nameof(CanUniformFps))]
|
||||||
private void UniformFps() {
|
private void UniformFps() {
|
||||||
|
var rv = m_DialogService.ShowEditFpsDialog();
|
||||||
|
if (rv is not null) {
|
||||||
|
m_DialogService.ShowConfirmUniformFpsDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanUniformFps() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user