Ejemplo n.º 1
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)
        {
            _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.");
            }
        }
Ejemplo n.º 2
0
        private void ShowText()
        {
            if (_comicBook.TotalFiles == 0)
            {
                ShowMessage("No archive loaded");
                return;
            }

            if (string.IsNullOrEmpty(_comicBook.CurrentFile.InfoText))
            {
                ShowMessage("No information text");
            }
            else
            {
                var infoText = new InformationText(_comicBook.CurrentFile.Location, _comicBook.CurrentFile.InfoText);
                infoText.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Called when [key down].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.Input.KeyEventArgs"/> instance containing the event data.</param>
        private void OnKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.X)
            {
                ApplicationExit(null, e);
            }

            if (e.Key == Key.R)
            {
                if (ResumeFile_RightClick.IsEnabled)
                {
                    Resume_Click(sender, e);
                }
                else
                {
                    ShowMessage("No archive to resume");
                }
            }

            if (e.Key == Key.I)
            {
                ShowPageInformation();
            }

            if (e.Key == Key.L)
            {
                _lastMouseMove = DateTime.Now;

                if (_mouseIsHidden)
                {
                    Mouse.OverrideCursor = Cursors.Arrow;
                    _mouseIsHidden = false;
                }

                LoadAndDisplayComic(true);
            }

            if (e.Key == Key.M)
            {
                WindowState = System.Windows.WindowState.Minimized;
            }

            if (e.Key == Key.T)
            {
                ToggleImageOptions();
            }

            if (e.Key == Key.N)
            {
                if (_comicBook != null && _comicBook.TotalFiles != 0)
                {
                    if (string.IsNullOrEmpty(_comicBook.CurrentFile.InfoText))
                    {
                        ShowMessage("No information text");
                    }
                    else
                    {
                        _informationText = new InformationText(_comicBook.CurrentFile.Location, _comicBook.CurrentFile.InfoText);
                        _informationText.ShowDialog();
                    }
                }
                else
                {
                    ShowMessage("No archive loaded");
                }
            }

            if (e.Key == Key.W)
            {
                if (Configuration.Windowed)
                {
                    //go full screen if windowed
                    Configuration.Windowed = false;

                    SetWindowMode(WindowMode.Fullscreen);
                }
                else
                {
                    //go windowed if fullscreen
                    Configuration.Windowed = true;
                    SetWindowMode(WindowMode.Windowed);
                }

                _scrollValueHorizontal = (int)(ScrollField.ViewportHeight * 0.05);
                _scrollValueVertical = (int)(ScrollField.ViewportWidth * 0.05);
                _imageUtils.ScreenHeight = (int)ScrollField.ViewportHeight;
                _imageUtils.ScreenWidth = (int)ScrollField.ViewportWidth;

                if (DisplayedImage.Source != null)
                {
                    DisplayImage(_comicBook.CurrentFile.CurrentPage, ImageStartPosition.Top);
                }
            }

            if (e.Key == Key.PageDown)
            {
                //prevent default action from occurring.
                e.Handled = true;
            }

            if (e.Key == Key.PageUp)
            {
                //prevent default action from occurring.
                e.Handled = true;
            }
        }
Ejemplo n.º 4
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.");
            }
        }