예제 #1
0
        /// <summary>
        /// 载入插件
        /// </summary>
        /// <param name="fileToLoad"></param>
        /// <param name="showFlags"></param>
        /// <returns></returns>
        public override object Load(string fileToLoad, ShowFlags showFlags)
        {
            ViewerControl viewerControl = null;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                String ext      = Path.GetExtension(fileToLoad);
                String fileName = Path.GetFileNameWithoutExtension(fileToLoad);

                TraceProc(System.Diagnostics.TraceLevel.Info, "fileName: " + fileName + ", ext: " + ext);

                // 如果文件扩展名不在支持之列则直接返回
                if (AllowedExtensions.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                {
                    return(null);
                }

                viewerControl = new ViewerControl(this);
                viewerControl.FileLoad(fileToLoad);
                FocusedControl = viewerControl.webBrowser1;
                viewerControl.Focus();

                controls.Add(viewerControl);
            }

            return(viewerControl);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileToLoad"></param>
        /// <param name="showFlags"></param>
        /// <returns></returns>
        public override object Load(string fileToLoad, ShowFlags showFlags)
        {
            ViewerControl viewerControl = null;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                //changed 1.0.0.2
                if ((showFlags & ShowFlags.ForceShow).Equals(ShowFlags.ForceShow))
                {
                    string ext = Path.GetExtension(fileToLoad);
                    if (AllowedExtensions.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        return(null);
                    }
                }
                //String ext = Path.GetExtension(fileToLoad);
                //// 如果文件扩展名不在支持之列则直接返回
                //if (AllowedExtensions.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                //{
                //    return null;
                //}

                viewerControl = new ViewerControl();
                viewerControl.FileLoad(fileToLoad);

                controls.Add(viewerControl);
            }
            return(viewerControl);
        }
예제 #3
0
        /// <summary>
        /// Is called when click print button
        /// </summary>
        /// <param name="control"></param>
        /// <param name="fileToPrint"></param>
        /// <param name="defPrinter"></param>
        /// <param name="printFlags"></param>
        /// <param name="margins"></param>
        /// <returns></returns>
        public override ListerResult Print(object control, string fileToPrint, string defPrinter, PrintFlags printFlags, PrintMargins margins)
        {
            TraceProc(System.Diagnostics.TraceLevel.Info, "Print fileToPrint:" + fileToPrint + ", defPrinter: " + defPrinter);
            ViewerControl viewerControl = (ViewerControl)control;

            viewerControl.webBrowser1.ShowPrintDialog();
            return(ListerResult.OK);
        }
예제 #4
0
        public override ListerResult SendCommand(object control, ListerCommand command, ShowFlags parameter)
        {
            ViewerControl viewerControl = (ViewerControl)control;

            switch (command)
            {
            case ListerCommand.Copy:
                viewerControl.webBrowser1.Document.ExecCommand("Copy", false, null);
                break;

            case ListerCommand.SelectAll:
                viewerControl.webBrowser1.Document.ExecCommand("SelectAll", false, null);
                break;
            }
            return(ListerResult.OK);
        }
예제 #5
0
        //Added 1.0.0.2
        public override ListerResult LoadNext(object control, string fileToLoad, ShowFlags showFlags)
        {
            ViewerControl viewerControl = (ViewerControl)control;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                if ((showFlags & ShowFlags.ForceShow).Equals(ShowFlags.ForceShow))
                {
                    string ext = Path.GetExtension(fileToLoad);
                    if (AllowedExtensions.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                    {
                        return(ListerResult.Error);
                    }
                }
                viewerControl.FileLoad(fileToLoad);
                return(ListerResult.OK);
            }
            return(ListerResult.Error);
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileToLoad"></param>
        /// <param name="showFlags"></param>
        /// <returns></returns>
        public override object Load(string fileToLoad, ShowFlags showFlags)
        {
            ViewerControl viewerControl = null;

            if (!String.IsNullOrEmpty(fileToLoad))
            {
                String ext = Path.GetExtension(fileToLoad);
                // 如果文件扩展名不在支持之列则直接返回
                if (AllowedExtensions.IndexOf(ext, StringComparison.InvariantCultureIgnoreCase) < 0)
                {
                    return(null);
                }

                viewerControl = new ViewerControl();
                viewerControl.FileLoad(fileToLoad);

                controls.Add(viewerControl);
            }

            return(viewerControl);
        }
예제 #7
0
        public override int NotificationReceived(object control, int message, int wParam, int lParam)
        {
            ViewerControl viewerControl = (ViewerControl)control;

            return(0);
        }
예제 #8
0
        public override ListerResult SearchText(object control, string searchString, SearchParameter searchParameter)
        {
            ViewerControl viewerControl = (ViewerControl)control;

            return(ListerResult.OK);
        }