예제 #1
0
        public IPlugin ProcessFile()
        {
            if (String.IsNullOrEmpty(CurrentDirectory) || String.IsNullOrEmpty(CurrentFile))
            {
                return(null);
            }

            try
            {
                var filename = String.Format(@"{0}\{1}", CurrentDirectory, CurrentFile);
                _plugin = PluginFactory.CreateUsing(new PluginParameter
                {
                    Zoom           = ZoomLevel,
                    ContainerWidth = _view.GetViewerWidth(),
                    Filename       = filename,
                });
                if (_plugin == null)
                {
                    return(null);
                }
                _view.DisplayBlock(_plugin.Viewer.GetControl());
                return(_plugin);
            }
            catch (Exception ex)
            {
                var whatHappened    = String.Format("We're sorry but Gold Box Explorer encountered a problem with the file named \"{0}\".", CurrentFile);
                var howUserAffected = "Unfortunately Gold Box Explorer is having some difficulty in displaying this file.";
                var whatUserCanDo   = "If the error persists, please consider logging an issue at http://goldbox.codeplex.com.";
                HandledExceptionManager.ShowDialog(whatHappened, howUserAffected, whatUserCanDo,
                                                   ex, MessageBoxButtons.OK, MessageBoxIcon.Hand, HandledExceptionManager.UserErrorDefaultButton.Default);
            }
            return(null);
        }