예제 #1
0
 private T GetValue <T>(JobNotifyField field)
 {
     if (_fieldValues.TryGetValue(field, out object value))
     {
         return((T)value);
     }
     else
     {
         return(default);
예제 #2
0
        /// <summary>
        /// Updates the specified field for the print job.
        /// </summary>
        /// <param name="field">The <see cref="JobNotifyField" /> to update.</param>
        /// <param name="value">The value.</param>
        public void Update(JobNotifyField field, object value)
        {
            LastUpdate = DateTimeOffset.Now;

            // PortName is a little strange.  It starts out blank, but then gets updated with a port that it's
            // printing on.  Once the job is done printing, the PortName gets cleared out.  For this reason,
            // do not set the port name unless the value is not blank.
            if (field == JobNotifyField.PortName && string.IsNullOrEmpty(value.ToString()))
            {
                return;
            }

            _fieldValues[field] = value;

            // If the status has changed, check to see if our timestamps or end status need to be updated.
            if (field == JobNotifyField.Status)
            {
                JobStatus status = (JobStatus)value;
                LogTrace($"Job {PrintJobId} status: {status}");

                ProcessStatusChange(status);
            }
        }