internal System.Drawing.Image GetIcon16(DeviceStateOptions state) { if (this.dicIcon16 == null) { IDeviceTypeImage img = this.GetImages(this.Type); this.dicIcon16 = new Dictionary <DeviceStateOptions, System.Drawing.Image>(); foreach (DeviceStateOptions deviceState in Enum.GetValues(typeof(DeviceStateOptions))) { if (img != null) { if (img.stateIcon16 != null && img.stateIcon16[deviceState] != null) { this.dicIcon16.Add(deviceState, img.stateIcon16[deviceState]); } else { this.dicIcon16.Add(deviceState, this.Icon16); } } else { this.dicIcon16.Add(deviceState, this.Icon16); } } } return(this.dicIcon16[state]); }
internal System.Drawing.Image GetIcon32(DeviceStateOptions state) { if (this.dicIcon32 == null) { this.dicIcon32 = new Dictionary <DeviceStateOptions, System.Drawing.Image>(); foreach (DeviceStateOptions deviceState in Enum.GetValues(typeof(DeviceStateOptions))) { this.dicIcon32.Add(deviceState, this.Icon32); } } return(this.dicIcon32[state]); }
/// <summary> /// 获取设备状态的文字说明。 /// </summary> /// <param name="deviceState">设备状态</param> /// <returns>设备状态的文字说明</returns> public static string GetDescription(this DeviceStateOptions deviceState) { switch (deviceState) { case DeviceStateOptions.Running: return("运行"); case DeviceStateOptions.Waiting: return("待装"); case DeviceStateOptions.Stopped: return("停用"); case DeviceStateOptions.Exception: return("故障"); case DeviceStateOptions.Backout: return("拆除"); default: throw new NotImplementedException("尚未实现该枚举。"); } }