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

  • 相关阅读:
    iOS 调试心得
    一步一步带你安装史上最难安装的 vim 插件
    20 行代码极速为 App 加上聊天功能
    在通知栏上玩游戏,Steve iOS 游戏实现思路
    ThinkPHP 3.2.x 集成极光推送指北
    MkDocs 文档生成逻辑浅析
    极光推送的角标问题
    聊天界面-自适应文字
    Python3.7源码包编译安装
    Navicat远程连接MySQL数据库
  • 原文地址:https://www.cnblogs.com/RobotTech/p/1248515.html
Copyright © 2011-2022 走看看