Ejemplo n.º 1
0
 private void OnPrintCompleted()
 {
     if (PrintCompleted != null)
     {
         PrintCompleted.Invoke();
     }
 }
Ejemplo n.º 2
0
        public void Print(Stream fs)
        {
            PrintStarted?.Invoke(this, new PrintEventArgs("printing started"));

            PrintInternal(fs);

            PrintCompleted?.Invoke(this, new PrintEventArgs("printing completed"));
        }
Ejemplo n.º 3
0
 private void OnTypewriterCompleted()
 {
     PrintCompleted?.Invoke();
 }
Ejemplo n.º 4
0
 private void OnPrintCompleted()
 {
     PrintCompleted?.DynamicInvoke(this, EventArgs.Empty);
 }
Ejemplo n.º 5
0
        private async void UpdateJob()
        {
            if (_isBusy)
            {
                OnLog("上次请求还未处理");
                return;
            }

            _isBusy = true;

            try
            {
                var status = await X30Client.GetClearSendStatusAsync();

                if (status == ClearSendStatus.Ready)
                {
                    if (IsComplete)
                    {
                        _timer.Stop();
                        await X30Client.StateChangeAsync(StateChangeStatus.Ready);

                        PrintCompleted?.Invoke(this, EventArgs.Empty);
                    }
                    else
                    {
                        CurrentBatchItem.Status = BatchStatus.Printed;
                        AppContext.Instance.DB.Update(CurrentBatchItem);

                        if (IsFatalError)
                        {
                            _timer.Stop();
                            FatalError?.Invoke(this, EventArgs.Empty);
                            await X30Client.StateChangeAsync(StateChangeStatus.Ready);

                            return;
                        }
                        var jobUpdateCommand = new JobCommand();
                        var bi = _batchsToPrint[_batchIndex + 1];

                        PopulateJobCommandFields(jobUpdateCommand, bi.QRCodeContent);

                        await X30Client.UpdateJob(jobUpdateCommand);

                        _currentClearStatus = ClearSendStatus.NotReady;
                        _batchIndex++;
                        bi.Status = BatchStatus.CodeSent;
                        AppContext.Instance.DB.Update(bi);
                        var message = $"{bi.SerinalNo} - {bi.QRCodeContent} 已赋码";
                        OnLog(message);
                        Printed?.Invoke(this, EventArgs.Empty);
                    }
                }
                else
                {
                    CurrentBatchItem.Status = BatchStatus.Printing;
                }
            }
            catch (Exception e)
            {
                var message = $"错误--{e.Message}";
                OnLog(message);
            }

            _isBusy = false;
        }