/// <summary>
        /// Updates control display with activity data.
        /// </summary>
        private void InitializeControlWithActivityData()
        {
            this.InvokeIfRequired(c =>
            {
                if (_currentDevice == null)
                {
                    throw new InvalidOperationException($"Current device is null.  Your reservation in asset inventory may have expired.");
                }

                UpdateLabel(activeDeviceLabel, $"{_currentDevice.AssetId} ({_currentDevice.Address})");
                var actionList = new List <string>();
                foreach (DirtyDeviceActionFlags flag in DirtyDeviceActions.SelectedActions(_activityData.DirtyDeviceActionFlags))
                {
                    try
                    {
                        actionList.Add(EnumUtil.GetDescription(flag));
                    }
                    catch (Exception x)
                    {
                        UpdateExecutionStatus(this, new StatusChangedEventArgs($"Error deriving string value for '{flag}': {x.ToString()}"));
                        actionList.Add(flag.ToString());
                    }
                }
                var actionDescription = string.Join(" | ", actionList);
                UpdateLabel(labelDocumentProcessAction, actionDescription);
            });
        }
Exemple #2
0
        public void ExecuteDirty()
        {
            var actions = DirtyDeviceActions.SelectedActions(_activityData.DirtyDeviceActionFlags);

            OnUpdateStatus(this, $"");

            foreach (var action in actions)
            {
                DateTime startTime = DateTime.Now;

                string actionDescription = $"Dirty {EnumUtil.GetDescription(action)} on {_deviceInfo.Address}";
                OnUpdateStatus(this, actionDescription + " Start");

                switch (action)
                {
                case DirtyDeviceActionFlags.UserInterface:
                    _uiExerciser.Exercise(_activityData);
                    break;

                case DirtyDeviceActionFlags.WebServices:
                    _webServicesExerciser.Exercise(_activityData, _deviceInfo.Attributes);
                    break;

                case DirtyDeviceActionFlags.EWS:
                    _ewsExerciser.Exercise(_activityData, _userCredential, _environment, _deviceInfo.Attributes);
                    break;

                case DirtyDeviceActionFlags.SNMP:
                    _snmpExerciser.Exercise(_activityData);
                    break;

                case DirtyDeviceActionFlags.Print:
                    _printExerciser.Exercise(_activityData);
                    break;

                case DirtyDeviceActionFlags.DigitalSend:
                    if (_deviceInfo.Attributes.HasFlag(AssetAttributes.Scanner))
                    {
                        _digitalSendExerciser.Exercise(_activityData, _userCredential, _environment);
                    }
                    break;
                }

                TimeSpan duration = DateTime.Now - startTime;
                OnUpdateStatus(this, actionDescription + $" Complete (Time elapsed: {duration})");
                OnUpdateStatus(this, $"");
            }
        }