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

  • 相关阅读:
    Thrift在微服务中的使用
    MySQL 必知必会
    IDEA 内使用 git
    分布式锁
    LeetCode 图
    LeetCode 位运算
    LeetCode 数组
    LeetCode 字符串
    LeetCode 哈希表
    LeetCode 栈和队列
  • 原文地址:https://www.cnblogs.com/RobotTech/p/1248515.html
Copyright © 2011-2022 走看看