using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace IReaper{
/// <summary>
/// NotifyDicionary
/// </summary>
/// <param name="Key"></param>
/// <param name="value"></param>
public delegate void OnDataSetEventHandler(CoreDataType Key, object value);
/// <summary>
/// INotifyPropertyChanged
/// </summary>
public class NotifiedDictionary:Dictionary<CoreDataType,object>,INotifyPropertyChanged
{
Dictionary<CoreDataType, PropertyChangedEventArgs> properties =
new Dictionary<CoreDataType, PropertyChangedEventArgs>();
[MethodImpl(MethodImplOptions.Synchronized)]
public new void Add(CoreDataType key, object value)
{
base.Add(key, value);
if (properties.ContainsKey(key))
{
return;
}
else
{
properties.Add(key, new PropertyChangedEventArgs(key.ToString()));
}
}
/// <summary>
///
/// </summary>
/// <param name="Key"></param>
/// <returns></returns>
public new object this[CoreDataType Key]
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return base[Key];
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
base[Key] = value;
this.InvokeCoreDataTypeNotification(Key);
}
}
/// <summary>
///
/// </summary>
/// <param name="Type"></param>
public void InvokeCoreDataTypeNotification(CoreDataType Type)
{
if (PropertyChanged != null)
{
this.PropertyChanged(this, properties[Type]);
}
}
/// <summary>
///
///
/// </summary>
/// <param name="Type"></param>
/// <param name="paras"></param>
public void OnExternalMethodsInvoked(CoreDataType Type, params object[] paras)
{
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
#endregion
}
/// <summary>
///
/// </summary>
public enum CoreDataType
{
#region Course
/// <summary>
///
/// </summary>
Dispatched,
/// <summary>
///
/// </summary>
HasCourse,
/// <summary>
///
/// </summary>
CurrentViewedCourses,
// /
CurrentFilteredCourses,
/// <summary>
///
/// </summary>
CurrentSelectedCourses,
/// <summary>
///
/// </summary>
CurrentSelectedFiles,
/// <summary>
///
/// </summary>
CurrentViewedFiles,
/// <summary>
///
/// </summary>
AllCourseTreeNode,
/// <summary>
///
/// </summary>
CurrentViewedCourseTreeNode,
#endregion
#region RSS
/// <summary>
/// RSS
/// </summary>
CurrentSelectedRSSTreeNode,
/// <summary>
/// NewsItem
/// </summary>
CurrentSelectedRSSNewsItem,
/// <summary>
/// RSS Feeds
/// </summary>
AllRSSFeeds,
/// <summary>
///
/// </summary>
HasRSSFeed,
#endregion
#region WebPage
/// <summary>
///
/// </summary>
ActiveWebBrowser,
#endregion
#region UI
/// <summary>
/// ActiveDockPanel
/// </summary>
ActiveDockPanel,
/// <summary>
/// DockContent
/// </summary>
ActiveDockContent,
/// <summary>
/// Main Form
/// </summary>
ApplicationForm,
#endregion
#region VideoPlay
CurrentPlayList,
CurrentPlayItem,
#endregion
#region Update
HasNewVersion
#endregion
}
}
|