From: coderhyme Date: Thu, 21 Sep 2017 07:50:50 +0000 (+0900) Subject: [Multimedia] Modified the ScreenMirroring to throw NotSupportedException when the... X-Git-Tag: preview1-00238~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3d82c84710c155949e4f39780c257f173ddc96a9;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [Multimedia] Modified the ScreenMirroring to throw NotSupportedException when the feature is false. Change-Id: I38a94ab922346fa4a599494428a666751ba4ee8b Signed-off-by: coderhyme --- diff --git a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs index 2d02dc8..4e0bd7d 100644 --- a/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs +++ b/src/Tizen.Multimedia.Remoting/ScreenMirroring/ScreenMirroring.cs @@ -29,6 +29,7 @@ namespace Tizen.Multimedia.Remoting /// public class ScreenMirroring : IDisposable, IDisplayable { + private const string Feature = "http://tizen.org/feature/network.wifi.direct.display"; private const int Port = 2022; private IntPtr _handle; @@ -47,6 +48,11 @@ namespace Tizen.Multimedia.Remoting } } + private static bool IsSupported() + { + return System.Information.TryGetValue(Feature, out bool isSupported) ? isSupported : false; + } + /// /// Initializes a new instance of the ScreenMirroring class. /// @@ -54,6 +60,11 @@ namespace Tizen.Multimedia.Remoting /// The feature is not supported. public ScreenMirroring() { + if (IsSupported() == false) + { + throw new PlatformNotSupportedException($"The feature({Feature}) is not supported on the current device"); + } + Native.Create(out _handle).ThrowIfError("Failed to create ScreenMirroring."); _state = new AtomicState();