Exemplo n.º 1
0
 private void OpenBook(LibraryItemViewModel book)
 {
     //return;
     //BookViewModel bookViewModel = new BookViewModel(book.Id);
     //IWindowContext bookWindowContext = windowManager.CreateWindow(bookViewModel);
     //bookWindowContext.Show();
 }
Exemplo n.º 2
0
        /// <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);
            }
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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>();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 8
0
        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;
                }
            }
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 11
0
 private void RemoveBookFromLibrary(LibraryItemViewModel book)
 {
     libraryModel.RemoveBookFromLibrary(book);
     RefreshLibrary();
 }
Exemplo n.º 12
0
 public NavigationBundle(LibraryItemViewModel libraryItem, GameTree gameTree, GameInfo gameInfo)
 {
     LibraryItem = libraryItem;
     GameTree    = gameTree;
     GameInfo    = gameInfo;
 }
Exemplo n.º 13
0
 /// <summary>
 /// Deselects the currently selected library item
 /// </summary>
 private void DeselectLibraryItem()
 {
     SelectedLibraryItem = null;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Selects a library item
 /// </summary>
 private void SelectLibraryItem(LibraryItemViewModel libraryItemViewModel)
 {
     SelectedLibraryItem = libraryItemViewModel;
 }