///<summary> /// MediaPermission ctor. ///</summary> public MediaPermission(MediaPermissionVideo permissionVideo) { VerifyMediaPermissionVideo(permissionVideo); InitDefaults(); _mediaPermissionVideo = permissionVideo; }
internal static void VerifyMediaPermissionVideo(MediaPermissionVideo level) { if (level < MediaPermissionVideo.NoVideo || level > MediaPermissionVideo.AllVideo) { throw new ArgumentException(SR.Get(SRID.InvalidPermissionLevel)); } }
///<summary> /// Private helper to compare the level of the 3 enum fields. ///</summary> private bool EqualsLevel(MediaPermissionAudio audioLevel, MediaPermissionVideo videoLevel, MediaPermissionImage imageLevel) { return((_mediaPermissionAudio == audioLevel) && (_mediaPermissionVideo == videoLevel) && (_mediaPermissionImage == imageLevel)); }
internal static void DemandMediaPermission(MediaPermissionAudio audioPermissionToDemand, MediaPermissionVideo videoPermissionToDemand, MediaPermissionImage imagePermissionToDemand) { // Demand the appropriate permission (new MediaPermission(audioPermissionToDemand, videoPermissionToDemand, imagePermissionToDemand)).Demand(); }
// </SnippetMediaPermissionAttribute9> public void Stub09() { // <SnippetMediaPermission3> MediaPermission mediaPermission = new MediaPermission(MediaPermissionVideo.AllVideo); // </SnippetMediaPermission3> // <SnippetMediaPermission8> MediaPermissionVideo mediaPermissionVideo = mediaPermission.Video; // </SnippetMediaPermission8> }
///<summary> /// MediaPermission ctor. ///</summary> public MediaPermission(MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage) { VerifyMediaPermissionAudio(permissionAudio); VerifyMediaPermissionVideo(permissionVideo); VerifyMediaPermissionImage(permissionImage); _mediaPermissionAudio = permissionAudio; _mediaPermissionVideo = permissionVideo; _mediaPermissionImage = permissionImage; }
internal static bool CallerHasMediaPermission(MediaPermissionAudio audioPermissionToDemand, MediaPermissionVideo videoPermissionToDemand, MediaPermissionImage imagePermissionToDemand) { try { (new MediaPermission(audioPermissionToDemand, videoPermissionToDemand, imagePermissionToDemand)).Demand(); return(true); } catch (SecurityException) { return(false); } }
///<summary> /// Return the intersection with the target ///</summary> public override IPermission Intersect(IPermission target) { if (target == null) { return(null); } MediaPermission operand = target as MediaPermission; if (operand != null) { // // Construct a permission that is the aggregate of the // least priveleged level of the 3 enums. // MediaPermissionAudio audioIntersectLevel = _mediaPermissionAudio < operand._mediaPermissionAudio ? _mediaPermissionAudio : operand._mediaPermissionAudio; MediaPermissionVideo videoIntersectLevel = _mediaPermissionVideo < operand._mediaPermissionVideo ? _mediaPermissionVideo : operand._mediaPermissionVideo; MediaPermissionImage imageIntersectLevel = _mediaPermissionImage < operand._mediaPermissionImage ? _mediaPermissionImage : operand._mediaPermissionImage; if ((audioIntersectLevel == MediaPermissionAudio.NoAudio) && (videoIntersectLevel == MediaPermissionVideo.NoVideo) && (imageIntersectLevel == MediaPermissionImage.NoImage)) { return(null); } else { return(new MediaPermission(audioIntersectLevel, videoIntersectLevel, imageIntersectLevel)); } } else { throw new ArgumentException(SR.Get(SRID.TargetNotMediaPermissionLevel)); } }
public MediaPermission (MediaPermissionVideo permissionVideo) { throw new NotImplementedException (); }
///<summary> /// Private helper to compare the level of the 3 enum fields. ///</summary> private bool EqualsLevel( MediaPermissionAudio audioLevel, MediaPermissionVideo videoLevel, MediaPermissionImage imageLevel ) { return ( ( _mediaPermissionAudio == audioLevel ) && ( _mediaPermissionVideo == videoLevel ) && ( _mediaPermissionImage == imageLevel ) ) ; }
///<summary> /// MediaPermission ctor. ///</summary> public MediaPermission(MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage ) { VerifyMediaPermissionAudio( permissionAudio ); VerifyMediaPermissionVideo( permissionVideo ); VerifyMediaPermissionImage( permissionImage ); _mediaPermissionAudio = permissionAudio ; _mediaPermissionVideo = permissionVideo ; _mediaPermissionImage = permissionImage ; }
internal static void VerifyMediaPermissionVideo(MediaPermissionVideo level) { if (level < MediaPermissionVideo.NoVideo || level > MediaPermissionVideo.AllVideo ) { throw new ArgumentException(SR.Get(SRID.InvalidPermissionLevel)); } }
internal static bool CallerHasMediaPermission(MediaPermissionAudio audioPermissionToDemand, MediaPermissionVideo videoPermissionToDemand, MediaPermissionImage imagePermissionToDemand) { try { (new MediaPermission(audioPermissionToDemand,videoPermissionToDemand,imagePermissionToDemand)).Demand(); return true; } catch(SecurityException) { return false; } }
///<summary> /// MediaPermission ctor. ///</summary> public MediaPermission(MediaPermissionVideo permissionVideo ) { VerifyMediaPermissionVideo( permissionVideo ) ; InitDefaults(); _mediaPermissionVideo = permissionVideo ; }
public MediaPermission(MediaPermissionVideo permissionVideo) { }
internal static void DemandMediaPermission(MediaPermissionAudio audioPermissionToDemand, MediaPermissionVideo videoPermissionToDemand, MediaPermissionImage imagePermissionToDemand) { new MediaPermission(audioPermissionToDemand, videoPermissionToDemand, imagePermissionToDemand).Demand(); }
public MediaPermission(MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage) { throw new NotImplementedException(); }
public MediaPermission(MediaPermissionVideo permissionVideo) { throw new NotImplementedException(); }
public MediaPermission(MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage) { }
public MediaPermission (MediaPermissionAudio permissionAudio, MediaPermissionVideo permissionVideo, MediaPermissionImage permissionImage) { throw new NotImplementedException (); }
internal static void DemandMediaPermission(MediaPermissionAudio audioPermissionToDemand, MediaPermissionVideo videoPermissionToDemand, MediaPermissionImage imagePermissionToDemand) { // Demand the appropriate permission (new MediaPermission(audioPermissionToDemand, videoPermissionToDemand, imagePermissionToDemand )).Demand(); }