Esempio n. 1
0
        internal MMDevice(IMMDevice realDevice)
        {
            _RealDevice = realDevice;

            GetPropertyInformation();

            Marshal.ThrowExceptionForHR(_RealDevice.GetId(out _id));

            IMMEndpoint ep = _RealDevice as IMMEndpoint;

            Marshal.ThrowExceptionForHR(ep.GetDataFlow(out _dataFlow));

            Marshal.ThrowExceptionForHR(_RealDevice.GetState(out _state));

            if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_FriendlyName))
            {
                _friendlyName = (string)_PropertyStore[PKEY.PKEY_DeviceInterface_FriendlyName].Value;
            }

            if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_Icon))
            {
                var iconPath = (string)_PropertyStore[PKEY.PKEY_DeviceInterface_Icon].Value;

                _icon = DeviceIconHelper.GetIconByPath(iconPath);
            }

            if (_PropertyStore.Contains(PKEY.PKEY_DeviceInterface_RealName))
            {
                var nameValue = _PropertyStore[PKEY.PKEY_DeviceInterface_RealName].Value;
                if (nameValue is string s)
                {
                    _realName = s;
                }
            }
        }
Esempio n. 2
0
        public ProtoExperimentDevice(Experiment prefab, ProtoPartSnapshot protoPart, ProtoPartModuleSnapshot protoModule, Vessel vessel)
            : base(prefab, protoPart, protoModule)
        {
            this.vessel = vessel;
            expInfo     = ScienceDB.GetExperimentInfo(prefab.experiment_id);
            icon        = new DeviceIcon(expInfo.SampleMass > 0f ? Textures.sample_scicolor : Textures.file_scicolor, "open experiment info", () => new ExperimentPopup(vessel, prefab, protoPart.flightID, prefab.part.partInfo.title, protoModule));
            sb          = new StringBuilder();

            OnUpdate();
        }
Esempio n. 3
0
 public ExperimentDevice(Experiment module) : base(module)
 {
     icon = new DeviceIcon(module.ExpInfo.SampleMass > 0.0 ? Textures.sample_scicolor : Textures.file_scicolor, "open experiment window", () => new ExperimentPopup(module.vessel, module, PartId, PartName));
     sb   = new StringBuilder();
     OnUpdate();
 }