private async void ShowLoadModal() { if (Application.Current.MainWindow is not MetroWindow window) { return; } var progress = await GuardSettingWindowIfNeeded(); var dialog = new SaveLoadMetroDialog(); var vm = SaveLoadDataViewModel.CreateForLoad(_rootModel, _saveFileManager, async() => { await window.HideMetroDialogAsync(dialog); if (progress != null) { await progress.CloseAsync(); } }); dialog.DataContext = vm; await window.ShowMetroDialogAsync(dialog, new MetroDialogSettings() { AnimateShow = true, AnimateHide = false, OwnerCanCloseWithDialog = true, }); await dialog.WaitUntilUnloadedAsync(); }
internal SaveLoadFileItemViewModel(bool isLoadMode, bool isCurrent, SettingFileOverview model, SaveLoadDataViewModel parent) { IsLoadMode = isLoadMode; IsCurrent = isCurrent; Index = model.Index; IsExist = model.Exist; ModelName = model.ModelName; LastUpdatedDate = model.LastUpdateTime; SelectThisCommand = new ActionCommand(async() => { if (isLoadMode) { await parent.ExecuteLoad(Index); } else { await parent.ExecuteSave(Index); } }); }