Files
ZuneUIXTools/UIX/Microsoft/Iris/Library/DynamicData.cs
T
2021-04-02 02:58:17 -05:00

46 lines
1.6 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.Iris.Library.DynamicData
// Assembly: UIX, Version=4.8.0.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217
// MVID: A56C6C9D-B7F6-46A9-8BDE-B3D9B8D60B11
// Assembly location: C:\Program Files\Zune\UIX.dll
using System;
namespace Microsoft.Iris.Library
{
public struct DynamicData
{
private SmartMap _dataMap;
public void Create() => this._dataMap = new SmartMap();
public object GetData(DataCookie cookie) => this._dataMap[GetKey(cookie)];
public void SetData(DataCookie cookie, object value) => this._dataMap[GetKey(cookie)] = value;
public Delegate GetEventHandler(EventCookie cookie) => this._dataMap[GetKey(cookie)] as Delegate;
public bool AddEventHandler(EventCookie cookie, Delegate handlerToAdd)
{
uint key = GetKey(cookie);
Delegate data = this._dataMap[key] as Delegate;
this._dataMap[key] = Delegate.Combine(data, handlerToAdd);
return (object)data == null;
}
public bool RemoveEventHandler(EventCookie cookie, Delegate handlerToRemove)
{
uint key = GetKey(cookie);
Delegate @delegate = Delegate.Remove(this._dataMap[key] as Delegate, handlerToRemove);
this._dataMap[key] = @delegate;
return (object)@delegate == null;
}
public void RemoveEventHandlers(EventCookie cookie) => this._dataMap[GetKey(cookie)] = null;
private static uint GetKey(DataCookie cookie) => DataCookie.ToUInt32(cookie);
private static uint GetKey(EventCookie cookie) => EventCookie.ToUInt32(cookie);
}
}