From 3d82c84710c155949e4f39780c257f173ddc96a9 Mon Sep 17 00:00:00 2001 From: coderhyme Date: Thu, 21 Sep 2017 16:50:50 +0900 Subject: [PATCH] [Multimedia] Modified the ScreenMirroring to throw NotSupportedException when the feature is false. Change-Id: I38a94ab922346fa4a599494428a666751ba4ee8b Signed-off-by: coderhyme --- .../ScreenMirroring/ScreenMirroring.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) 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(); -- 2.7.4