/// <summary>
        /// Load the archives
        /// </summary>
        /// <param name="files">Archive location</param>
        /// <param name="fileNumber">File in array to start at</param>
        /// <param name="pageNumber">Page on which to start from selected file</param>
        public void LoadFile(string[] files, int fileNumber, int pageNumber)
        {
            _fileLoader.Load(files);

            if (_fileLoader.LoadedFileData.HasFile)
            {
                _comicBook = _fileLoader.LoadedFileData.ComicBook;

                foreach (ComicFile comicFile in _comicBook)
                {
                    if (!string.IsNullOrEmpty(comicFile.InfoText))
                    {
                        Mouse.OverrideCursor = Cursors.Arrow;
                        _informationText = new InformationText(comicFile.Location, comicFile.InfoText);
                        _informationText.ShowDialog();
                        Mouse.OverrideCursor = Cursors.Wait;
                    }
                }

                DisplayImage(_comicBook.GetPage(fileNumber, pageNumber), ImageStartPosition.Top);
                if (!string.IsNullOrEmpty(_fileLoader.Error))
                {
                    ShowMessage(_fileLoader.Error);
                }
            }
            else if (!string.IsNullOrEmpty(_fileLoader.Error))
            {
                ShowMessage(_fileLoader.Error);
            }
            else
            {
                ShowMessage("No supported files found.");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load the archives
        /// </summary>
        /// <param name="files">Archive location</param>
        /// <param name="fileNumber">File in array to start at</param>
        /// <param name="pageNumber">Page on which to start from selected file</param>
        public void LoadFile(string[] files, int fileNumber, int pageNumber)
        {
            KeyGrid.Visibility = Visibility.Collapsed;

            _fileLoader.Load(files);

            if (_fileLoader.LoadedFileData.HasFile)
            {
                _comicBook = _fileLoader.LoadedFileData.ComicBook;
                if (_comicBook.TotalPages < 1) // Found a ZIP containing ZIPs
                {
                    ShowMessage("Unable to load any images");
                    return;
                }

                DisplayImage(_comicBook.GetPage(fileNumber, pageNumber), ImageStartPosition.Top);

                foreach (ComicFile comicFile in _comicBook)
                {
                    if (!string.IsNullOrEmpty(comicFile.InfoText))
                    {
                        Mouse.OverrideCursor = Cursors.Arrow;
                        var infoText = new InformationText(comicFile.Location, comicFile.InfoText);
                        infoText.ShowDialog();
                        Mouse.OverrideCursor = Cursors.Wait;
                    }
                }

                if (!string.IsNullOrEmpty(_fileLoader.Error))
                {
                    ShowMessage(_fileLoader.Error);
                }
            }
            else if (!string.IsNullOrEmpty(_fileLoader.Error))
            {
                ShowMessage(_fileLoader.Error);
            }
            else
            {
                ShowMessage("No supported files found.");
            }
        }