⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coreevents.cs

📁 Gibphone is CSharp Program, it can tell you how to design p2p chat.
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using GPCore.Plugins;
using GPCore.Protocols;
namespace GPCore
{
    public static partial class Core
    {
        /// <summary>
        /// This is the delegate used when an <see cref="IProtocol"/> in Core.Protocols is added.
        /// </summary>
        /// <param name="AutoLoad">Will this <see cref="IProtocol"/> automatically load up on start up?</param>
        /// <param name="Password">The password of the newly created Account.</param>
        /// <param name="e">Information about the affected <see cref="IProtocol"/>.</param>
        public delegate void ProtocolAddedEventDelegate(bool AutoLoad, string Password, ProtocolEventArgs e);
        /// <summary>
        /// This is the delegate used when an <see cref="IProtocol"/> in Core.Protocols is deleted.
        /// </summary>
        /// <param name="e">Information about the affected <see cref="IProtocol"/>.</param>
        public delegate void ProtocolDeletedEventDelegate(ProtocolEventArgs e);
        /// <summary>
        /// This delegate is used when a <see cref="CoreEventListener"/> in Core.Listeners is added or deleted.
        /// </summary>
        /// <param name="e">Information about the affected CoreEventListener</param>
        public delegate void PluginEventDelegate(PluginEventArgs e);

        /// <summary>
        /// Fires when a <see cref="IProtocol"/> in Core.Protocols is added.
        /// </summary>
        public static event ProtocolAddedEventDelegate onProtocolAdded;
        /// <summary>
        /// Fires when a <see cref="IProtocol"/> in Core.Protocols is deleted.
        /// </summary>
        public static event ProtocolDeletedEventDelegate onProtocolDeleted;
        /// <summary>
        /// Fires when a <see cref="CoreEventListener"/> in Core.Listeners is added.
        /// </summary>
        public static event PluginEventDelegate onPluginAdded;
        /// <summary>
        /// Fires when a <see cref="CoreEventListener"/> in Core.Listeners is deleted.
        /// </summary>
        public static event PluginEventDelegate onPluginDeleted;
    }

    /// <summary>
    /// This is the EventArgs that is used to describe a <see cref="CoreEventListener"/>.
    /// </summary>
    public class PluginEventArgs : EventArgs
    {
        private Type type;
        /// <summary>
        /// The <see cref="Type"/> of the <see cref="CoreEventListener"/>
        /// </summary>
        public Type Type
        {
            get { return type; }
            set { type = value; }
        }
        /// <summary>
        /// Instantiates a new <see cref="PluginEventArgs"/>.
        /// </summary>
        /// <param name="type">The <see cref="Type"/> of the <see cref="CoreEventListener"/>.</param>
        public PluginEventArgs(Type type)
        {
            this.type = type;
        }
    }

    /// <summary>
    /// This is the EventArgs that is used to describe an <see cref="IProtocol"/>
    /// </summary>
    public class ProtocolEventArgs : EventArgs
    {
        private string username;
        /// <summary>
        /// The Username of the <see cref="IProtocol"/>.
        /// </summary>
        public string Username
        {
            get { return username; }
            set { username = value; }
        }
        private Type type;
        /// <summary>
        /// The <see cref="Type"/> of the <see cref="IProtocol"/>.
        /// </summary>
        public Type Type
        {
            get { return type; }
            set { type = value; }
        }
        /// <summary>
        /// Instantiates a new <see cref="ProtocolEventArgs"/>.
        /// </summary>
        /// <param name="username">The Username of the <see cref="IProtocol"/>.</param>
        /// <param name="type">The <see cref="Type"/> of the <see cref="IProtocol"/>.</param>
        public ProtocolEventArgs(string username, Type type)
        {
            this.username = username;
            this.type = type;
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -