Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="task"></param>
        public void DoitReceive(Task task)
        {
            // get match cp with task
            //
            CommuniPort cp = this.GetCommPort(task.Device);

            byte[] bytes = null;
            if (cp != null)
            {
                //cp.Read();
                //bytes = cp.ReceivedBytes;
                bytes = cp.Read();
            }
            //else
            //{
            //    //bytes = null;
            //    bytes = new byte[0];
            //}

            LogReceived(task, bytes);

            ParseResult           pr = task.ParseReceiced(bytes);
            TaskExecutedEventArgs e  = new TaskExecutedEventArgs(task, pr);

            // 2010-09-15
            //
            //OnExecuted(task, pr);
            if (CommuniSoft.IsUseUISynchronizationContext)
            {
                CommuniSoft.UISynchronizationContext.Post(
                    this.ExecutedCallback, e);
            }
            else
            {
                OnExecuted(e);
            }

            // process df
            //
            if ((bytes != null && bytes.Length > 0))
            {
                if (!pr.Success)
                {
                    this.CommuniSoft.FDManager.Process(cp, bytes);
                }
                else if (pr.Remain != null)
                {
                    this.CommuniSoft.FDManager.Process(cp, pr.Remain);
                }
            }

            if (!task.CanRemove)
            {
                this.Tasks.Add(task);
            }
        }
Пример #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="task"></param>
 /// <param name="pr"></param>
 //private void OnExecuted(Task task, ParseResult pr)
 private void OnExecuted(TaskExecutedEventArgs e)
 {
     // event
     //
     if (this.Executed != null)
     {
         //TaskExecutedEventArgs e = new TaskExecutedEventArgs(task, pr);
         Executed(this, e);
     }
 }
Пример #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="task"></param>
 /// <param name="pr"></param>
 //private void OnExecuted(Task task, ParseResult pr)
 private void OnExecuted(TaskExecutedEventArgs e)
 {
     // event
     //
     if (this.Executed != null)
     {
         //TaskExecutedEventArgs e = new TaskExecutedEventArgs(task, pr);
         Executed(this, e);
     }
 }
Пример #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="task"></param>
        public void DoitReceive(Task task)
        {
            // get match cp with task
            //
            CommuniPort cp = this.GetCommPort(task.Device);

            byte[] bytes = null;
            if (cp != null)
            {
                //cp.Read();
                //bytes = cp.ReceivedBytes;
                bytes = cp.Read();
            }
            //else
            //{
            //    //bytes = null;
            //    bytes = new byte[0];
            //}

            LogReceived(task, bytes);

            ParseResult pr = task.ParseReceiced(bytes);
            TaskExecutedEventArgs e = new TaskExecutedEventArgs(task, pr);

            // 2010-09-15
            //
            //OnExecuted(task, pr);
            if (CommuniSoft.IsUseUISynchronizationContext)
            {
                CommuniSoft.UISynchronizationContext.Post(
                    this.ExecutedCallback, e);
            }
            else
            {
                OnExecuted(e);
            }

            // process df
            //
            if ((bytes != null && bytes.Length > 0))
            {
                if (!pr.Success)
                {
                    this.CommuniSoft.FDManager.Process(cp, bytes);
                }
                else if (pr.Remain != null)
                {
                    this.CommuniSoft.FDManager.Process(cp, pr.Remain);
                }
            }

            if (!task.CanRemove)
            {
                this.Tasks.Add(task);
            }
        }
Пример #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void TaskManager_Executed(object sender, TaskExecutedEventArgs e)
 {
     _processAddin.ProcessExecutedTask(e.Task, e.ParseResult);
 }
Пример #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="state"></param>
        private void ExecutedCallbackTarget(object state)
        {
            TaskExecutedEventArgs e = state as TaskExecutedEventArgs;

            OnExecuted(e);
        }