private void RebuildLineIndexesDescriptions() { LineIndexesDescriptions.Clear(); for (int i = 0; i < EntityDirectory.Entities[CurrentKey].Count; i++) { LineIndexesDescriptions.Add(i + " - " + EntityDirectory.Entities[CurrentKey][i].Name); } this.RaisePropertyChanged(nameof(LineIndexesDescriptions)); }
public async void OpenDirectory() { if (DirectoryInUse && !directorySaved) { var msg = CommonUtils.GetMessageBox("Directory in use", "An unsaved directory is currently in use, " + "opening a directory will loose all unsaved changes,\nare you sure you want to proceed?", ButtonEnum.YesNo, Icon.Question); await msg.ShowDialog(CommonUtils.MainWindow); if (msg.ButtonResult == ButtonResult.No) { return; } } OpenFolderDialog dlg = new OpenFolderDialog(); dlg.Title = "Select a Bug Fables entitydata directory"; string filePaths = await dlg.ShowAsync(CommonUtils.MainWindow); if (string.IsNullOrEmpty(filePaths)) { return; } try { EntityDirectory.ResetToDefault(); EntityDirectory.LoadDirectory(filePaths); CurrentDirectoryPath = filePaths; DirectoryInUse = true; directorySaved = true; RebuildKeysDescriptions(); LineIndexesDescriptions.Clear(); } catch (Exception ex) { EntityDirectory.ResetToDefault(); var msg = CommonUtils.GetMessageBox("Error opening directory", "An error occured while opening the directory: " + ex.Message, ButtonEnum.Ok, Icon.Error); await msg.ShowDialog(CommonUtils.MainWindow); } }