zoukankan      html  css  js  c++  java
  • Delegate Event

                    logon = new Logon();
                    logon.LoginChangeEvent += new Logon.LoginChangeDelegate(logon_LoginChangeEvent);
                    logon.CloseEvent += new Logon.CloseDelegate(logon_CloseEvent);

           //Login
            private void logon_LoginChangeEvent(UserType type)
            {
                this.ChangeScreen(this.mainForm);
            }

            //Application Exit
            private void logon_CloseEvent()
            {
                //this.Visible = false;
                //this.Close();
                this.Hide();
                Application.Exit();
            }

    -------------------------------------------------------------------------------------------
    public delegate void LoginChangeDelegate(UserType type);
            public event LoginChangeDelegate LoginChangeEvent;

            public delegate void CloseDelegate();
            public event CloseDelegate CloseEvent;


    //Exit
            private void btnExit_Click(object sender, EventArgs e)
            {
                if (this.CloseEvent != null)
                {
                    this.CloseEvent();
                }
            }

    //Login
    if (this.LoginChangeEvent != null)
                    {
                        this.LoginChangeEvent(UserType.Employee);
                    }

  • 相关阅读:
    【转载】Chrome 0day漏洞:不要用Chrome查看pdf文件
    内网渗透闲谈
    Sticky Fingure安装教程
    局域网下交换机配置
    Access 2010 应用基础 单元三:SQL查询
    ESP8266 wifi干扰、钓鱼实现
    这是谁的锅
    svn/git的diff、patch
    sublime开发php必备工具集合(mac)
    gcc学习笔记
  • 原文地址:https://www.cnblogs.com/RobotTech/p/1248515.html
Copyright © 2011-2022 走看看