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

📄 presencesensorbase.cs

📁 飞信的收发使用csharp进行开发
💻 CS
字号:
namespace Imps.Client.Pc.Sensor
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Pc;
    using Imps.Common;
    using System;
    using System.Text;
    using System.Windows.Forms;

    public class PresenceSensorBase : IPresenceSensor
    {
        private string _desc = string.Empty;
        private IFrameworkWindow _frameworkWnd;
        private bool _modified;
        private string _name = string.Empty;
        private MainPresence _presence = MainPresence.Online;
        private int _priority;

        protected PresenceSensorBase(IFrameworkWindow frameworkWnd)
        {
            this._frameworkWnd = frameworkWnd;
        }

        public virtual bool Poll()
        {
            return true;
        }

        public virtual void Reset()
        {
            this._presence = MainPresence.Online;
            this._modified = false;
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();
            if (string.IsNullOrEmpty(this.Name))
            {
                builder.Append(base.GetType().Name);
            }
            else
            {
                builder.Append(this.Name);
            }
            builder.AppendFormat(": Value={0}", this.PresenseValue);
            if (string.IsNullOrEmpty(this.PresenceDescription))
            {
                builder.Append(", Description=");
                builder.Append(this.PresenceDescription);
            }
            if (string.IsNullOrEmpty(this.ExInfo))
            {
                builder.Append(", ExInfo=");
                builder.Append(this.ExInfo);
            }
            return builder.ToString();
        }

        public string ExInfo
        {
            get
            {
                return string.Empty;
            }
        }

        protected Configuration ImpsConfig
        {
            get
            {
                return this._frameworkWnd.AccountManager.CurrentUser.Configuration;
            }
        }

        protected Form MainForm
        {
            get
            {
                return this._frameworkWnd.MainWindow;
            }
        }

        protected bool Modified
        {
            get
            {
                return this._modified;
            }
            set
            {
                this._modified = value;
            }
        }

        public string Name
        {
            get
            {
                return this._name;
            }
            internal set
            {
                this._name = value;
            }
        }

        public string PresenceDescription
        {
            get
            {
                return this._desc;
            }
            protected set
            {
                if (!string.Equals(this._desc, value))
                {
                    this._desc = value;
                    this.Modified = true;
                }
            }
        }

        public MainPresence PresenseValue
        {
            get
            {
                return this._presence;
            }
            protected set
            {
                if (this._presence != value)
                {
                    this._presence = value;
                    this.Modified = true;
                }
            }
        }

        public int Priority
        {
            get
            {
                return this._priority;
            }
            internal set
            {
                this._priority = value;
            }
        }
    }
}

⌨️ 快捷键说明

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