Ejemplo n.º 1
0
        private void IntercommsMessageHandler(string message)
        {
            Debug.WriteLine(message);

            try
            {
                switch (message)
                {
                case "SERVICE_CON":
                    tmrServiceCheck.Stop();
                    break;

                default:
                    string[] items = message.Split('|');

                    if (items.Length == 4)
                    {
                        int            dirID  = int.Parse(items[0]);
                        int            kind   = int.Parse(items[1]);
                        string         msg    = items[2];
                        TraceEventType evType = (TraceEventType)int.Parse(items[3]);

                        PDFSplitterEventArgs args = new PDFSplitterEventArgs(dirID, kind, msg, evType);

                        this.Invoke(new EventHandler <PDFSplitterEventArgs>(OnPDFSplitterMsgEvent), this, args);
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                this.Invoke(new EventHandler <PDFSplitterEventArgs>(OnPDFSplitterMsgEvent), this, new PDFSplitterEventArgs(-1, 2, ex.Message, TraceEventType.Error));
            }
        }
Ejemplo n.º 2
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 "Ready":
                    dataGridView.Rows[listindex].Cells[3].Value = "";
                    break;

                case "Processing":
                    dataGridView.Rows[listindex].Cells[3].Value = "Processing";
                    break;

                case "Running":
                    dataGridView.Rows[listindex].Cells[3].Value = "Running";
                    break;

                case "Stopping":
                    dataGridView.Rows[listindex].Cells[3].Value = "Stopping";
                    break;

                case "Stopped":
                    dataGridView.Rows[listindex].Cells[3].Value = "";
                    dirData[listindex].Status = false;
                    break;
                }
            }
            else if (args.Kind == 2)
            {
                WriteLine(args.Msg, args.Evtype);
            }

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

            btnRunAll.Enabled = true;

            btnAdd.Enabled     = true;
            btnEdit.Enabled    = true;
            btnDelete.Enabled  = true;
            btnEnable.Enabled  = true;
            btnOptions.Enabled = true;

            dataGridView_Click(this, null);
        }