Handler = null;
}
+ private static Interop.RuntimeInfo.RuntimeInformationChangedCallback __callback;
+
internal event EventHandler<RuntimeFeatureStatusChangedEventArgs> EventHandler
{
add
{
if (Handler == null)
{
- InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(TvProductHelper.ConvertKeyIfTvProduct(Key), RuntimeInformationChangedCallback, IntPtr.Zero);
+ __callback = (RuntimeInfoKey num, IntPtr userData) =>
+ {
+ string strKey = "Invalid";
+ RuntimeInfoKey key = TvProductHelper.ReconvertKeyIfTvProduct(num);
+
+ if (key > 0 && Information.EnumStringMapping.ContainsKey(key))
+ {
+ strKey = Information.EnumStringMapping[key];
+ }
+
+ RuntimeFeatureStatusChangedEventArgs eventArgs = new RuntimeFeatureStatusChangedEventArgs()
+ {
+ Key = Information.HttpPrefix + Information.RuntimeInfoStringKeyPrefix + strKey
+ };
+
+ Handler?.Invoke(null, eventArgs);
+ };
+
+ InformationError ret = Interop.RuntimeInfo.SetRuntimeInfoChangedCallback(TvProductHelper.ConvertKeyIfTvProduct(Key), __callback, IntPtr.Zero);
if (ret != InformationError.None)
{
Log.Error(InformationErrorFactory.LogTag, "Interop failed to add event handler");
}
}
}
-
- private void RuntimeInformationChangedCallback(RuntimeInfoKey num, IntPtr userData)
- {
- string strKey = "Invalid";
- RuntimeInfoKey key = TvProductHelper.ReconvertKeyIfTvProduct(num);
-
- if (key > 0 && Information.EnumStringMapping.ContainsKey(key))
- {
- strKey = Information.EnumStringMapping[key];
- }
-
- RuntimeFeatureStatusChangedEventArgs eventArgs = new RuntimeFeatureStatusChangedEventArgs()
- {
- Key = Information.HttpPrefix + Information.RuntimeInfoStringKeyPrefix + strKey
- };
-
- Handler?.Invoke(null, eventArgs);
- }
}
}