private void OpenBook(LibraryItemViewModel book) { //return; //BookViewModel bookViewModel = new BookViewModel(book.Id); //IWindowContext bookWindowContext = windowManager.CreateWindow(bookViewModel); //bookWindowContext.Show(); }
/// <summary> /// Opens a SGF file provided its info /// </summary> /// <param name="fileInfo">File info</param> public async Task OpenSgfFileAsync(FileContentInfo fileInfo) { var newItem = await CreateLibraryItemFromFileContentAsync(fileInfo); if (newItem != null) { SelectedLibraryItem = new ExternalSgfFileViewModel(fileInfo.Contents, newItem); } }
private async Task ExportItemAsync(LibraryItemViewModel libraryItem) { LoadingText = Localizer.LoadingEllipsis; IsWorking = true; var contents = await _appDataFileService.ReadFileAsync(libraryItem.FileName, SgfFolderName); await _filePicker.PickAndWriteFileAsync(libraryItem.FileName, contents); IsWorking = false; }
private void StartAnalysis(LibraryItemViewModel item, SgfGameTree sgfGameTree) { SgfToGameTreeConverter converter = new SgfToGameTreeConverter(sgfGameTree); var conversionResult = converter.Convert(); var bundle = new AnalyzeOnlyViewModel.NavigationBundle(item, conversionResult.GameTree, conversionResult.GameInfo); Mvx.RegisterSingleton(bundle); ShowViewModel <AnalyzeOnlyViewModel>(); }
public void RemoveBookFromLibrary(LibraryItemViewModel libraryItemViewModel) { string bookCoverImageFilePath = GetBookCoverImageFilePath(libraryItemViewModel.Id); if (File.Exists(bookCoverImageFilePath)) { File.Delete(bookCoverImageFilePath); } settings.Books.Remove(settings.Books.First(book => book.Id == libraryItemViewModel.Id)); applicationContext.SaveSettings(); }
private async Task DeleteItemAsync(LibraryItemViewModel libraryItem) { if ( await _dialogService.ShowConfirmationDialogAsync( Localizer.DeleteWarning, String.Format(Localizer.DeleteQuestion, libraryItem.FileName), Localizer.DeleteCommand, Localizer.No)) { await _appDataFileService.DeleteFileAsync(SgfFolderName, libraryItem.FileName); LibraryItems.Remove(libraryItem); SelectedLibraryItem = null; } }
void HandleContextMenu(LibraryItemViewModel item) { if (item == null) { ContextMenu = null; return; } var local = item as ContentLibraryItemViewModel <LocalMissionsContainer>; if (local != null) { _localMissionFolderContextMenu.ShowForItem(local); ContextMenu = _localMissionFolderContextMenu; return; } ContextMenu = null; }
private void listBoxZone_PreviewKeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Space) { LibraryItemViewModel selectedItem = listBoxZone.SelectedItem as LibraryItemViewModel; if (selectedItem != null) { selectedItem.GenerateThis = !selectedItem.GenerateThis; if (selectedItem.PocoType != null) { ViewModel.PocoTypeCheckedChange(selectedItem, selectedItem.GenerateThis); } e.Handled = true; } } }
private void LibrarySelectionChanged(object sender, SelectionChangedEventArgs eventArgs) { if (LibraryListBox.SelectedIndex == -1) { return; } LibraryItemViewModel libraryItemViewModel = LibraryListBox.SelectedItem as LibraryItemViewModel; ILibraryItem libraryItem = libraryItemViewModel.LibraryItem; long itemId = libraryItem.Id; if (libraryItem.Type == LibraryItemType.Directory) { libraryHistory.Push(itemId); library.RequestItem(itemId); } else if (libraryItem.Type == LibraryItemType.Multimedia) { playlist.AddItem(itemId); } }
void HandleSingleMenu(LibraryItemViewModel item) { if (item == null) { ContextMenu = null; return; } var collection = item as CollectionLibraryItemViewModel; if (collection != null) { _customCollectionContextMenu.ShowForItem(collection); ContextMenu = _customCollectionContextMenu; return; } var repo = item as ContentLibraryItemViewModel <SixRepo>; if (repo != null) { _repositoryOptionsContextMenu.ShowForItem(repo); ContextMenu = _repositoryOptionsContextMenu; return; } var local = item as ContentLibraryItemViewModel <LocalModsContainer>; if (local != null) { _localModFolderContextMenu.ShowForItem(local); ContextMenu = _localModFolderContextMenu; return; } ContextMenu = null; }
private void RemoveBookFromLibrary(LibraryItemViewModel book) { libraryModel.RemoveBookFromLibrary(book); RefreshLibrary(); }
public NavigationBundle(LibraryItemViewModel libraryItem, GameTree gameTree, GameInfo gameInfo) { LibraryItem = libraryItem; GameTree = gameTree; GameInfo = gameInfo; }
/// <summary> /// Deselects the currently selected library item /// </summary> private void DeselectLibraryItem() { SelectedLibraryItem = null; }
/// <summary> /// Selects a library item /// </summary> private void SelectLibraryItem(LibraryItemViewModel libraryItemViewModel) { SelectedLibraryItem = libraryItemViewModel; }