Пример #1
0
        internal MediaDeviceEventArgs(Events eventEnum, MediaDevice mediaDevice, IPortableDeviceValues eventParameters)
        {
            this.MediaDevice = mediaDevice;
            this.Event       = eventEnum;

            eventParameters.TryGetStringValue(WPD.EVENT_PARAMETER_PNP_DEVICE_ID, out string pnpDeviceId);
            this.PnpDeviceId = pnpDeviceId;

            eventParameters.TryGetUnsignedIntegerValue(WPD.EVENT_PARAMETER_OPERATION_STATE, out uint operationState);
            this.OperationState = (OperationState)operationState;

            eventParameters.TryGetUnsignedIntegerValue(WPD.EVENT_PARAMETER_OPERATION_PROGRESS, out uint operationProgress);
            this.OperationProgress = operationProgress;

            eventParameters.TryGetStringValue(WPD.EVENT_PARAMETER_OBJECT_PARENT_PERSISTENT_UNIQUE_ID, out string objectParentPersistanceUniqueId);
            this.ObjectParentPersistanceUniqueId = objectParentPersistanceUniqueId;

            eventParameters.TryGetStringValue(WPD.EVENT_PARAMETER_OBJECT_CREATION_COOKIE, out string objectCreationCookie);
            this.ObjectCreationCookie = objectCreationCookie;

            eventParameters.TryGetBoolValue(WPD.EVENT_PARAMETER_CHILD_HIERARCHY_CHANGED, out bool childHierarchyChanged);
            this.ChildHierarchyChanged = childHierarchyChanged;

            eventParameters.TryGetStringValue(WPD.EVENT_PARAMETER_SERVICE_METHOD_CONTEXT, out string serviceMethodContext);
            this.ServiceMethodContext = serviceMethodContext;
        }