• 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);
                    }

  • 相关阅读:
    std::bind 详解及参数解析
    c++ 静态类成员函数(static member function) vs 名字空间 (namespace)
    继续进发
    lua闭包
    Mysql按时间段分组查询来统计会员的个数
    linux安装配置sendmail实现邮件发送
    Javascript验证用户输入URL地址是否正确
    php返回json数据函数例子
    ArrayList与List对象用法与区别
    java 获取数组(二维数组)长度实例程序
  • 原文地址:https://www.cnblogs.com/RobotTech/p/1248515.html
Copyright © 2020-2023  润新知