コード例 #1
0
 void Progress(object sender, PDFSplitterEventArgs e)
 {
     if (_parent != null)
     {
         _parent.OnPDFSplitterMsgEvent(sender, e);
     }
 }
コード例 #2
0
        void SendMsgEvent(object sender, PDFSplitterEventArgs e)
        {
            if (e.Evtype == TraceEventType.Error)
            {
                string message = DateTime.Now.ToString("[H:mm] ") + e.Msg;

                string path = Path.Combine(_directoryData.FolderLog, "error.log.txt");
                // This text is added only once to the file.
                try
                {
                    // Create a file to write to.
                    using (StreamWriter sw = new StreamWriter(path, true))
                    {
                        sw.WriteLine(message);
                        sw.Flush();
                        sw.Close();
                    }
                }
                catch
                {
                }
            }

            //if (_parent != null)
            //	_parent.Invoke(new EventHandler<PDFSplitterEventArgs>(Progress), sender, e);
            Progress(sender, e);
        }
コード例 #3
0
        public void OnPDFSplitterMsgEvent(object sender, PDFSplitterEventArgs args)
        {
            int listindex = GetDirectoryIndexById(args.DirID);

            DirectoryData[] dirData = _directorySettings.GetDirectoryData();

            if (args.Kind == 1 && listindex > -1)
            {
                switch (args.Msg)
                {
                case "Stopped":
                    dirData[listindex].Status = false;
                    break;
                }
            }

            string strmsg = args.DirID.ToString() + "|" + args.Kind.ToString() + "|" + args.Msg + "|" + ((int)args.Evtype).ToString();

            try
            {
                if (_isManageconnected)
                {
                    _intercommsClient.Send(strmsg, "PDFSCANMANAGEPIPE");
                }
                else
                {
                    ServiceLog.WriteLog("Intercomms Client Send Data, " + strmsg);
                }
            }
            catch (Exception ex)
            {
                ServiceLog.WriteLog("Intercomms Client Send Error, " + ex.Message + ", " + strmsg);
            }

            for (int i = 0; i < dirData.Length; i++)
            {
                if (dirData[i].Status)
                {
                    return;
                }
            }

            for (int i = 0; i < _pdfSplitters.Length; i++)
            {
                if (splitThreads[i] != null)
                {
                    splitThreads[i].Abort();
                }
                _pdfSplitters[i] = null;
            }

            _pdfSplitters = null;
            splitThreads  = null;
        }