当前位置:编程学习 > C#/ASP.NET >>

c#事件委托需要返回int,1表示成功,0表示失败

public delegate void DialOutEventHandler(object sender, AxLib._OnDialOutEvent e)
public AxLib._OnDialOutEvent(int i)
应该怎么实现呢,
AxLib._OnDialOutEvent e=new AxLib._OnDialOutEvent(object sender, AxLib._OnDialOutEvent e);
int ai=e.i; --------------------编程问答-------------------- http://www.cnblogs.com/BeginnerClassroom/archive/2009/01/11/1373689.html --------------------编程问答-------------------- 不知道你什么意思。

委托你懂么? --------------------编程问答--------------------         public AxLib.LinkSocket axLink;
        public Main()
        {
            InitializeComponent();
            axLink = new AxLib.LinkSocket();           
         
           axLink.OnDialOut += new AxLib.DialOutEventHandler(ConDiaOut_Tel);
          
        }

        public delegate void DialOutEventHandler(object sender, AxLib._OnDialOutEvent e);
       
        public int aireturn = 0;
      
 
        private void ConDiaOut_Tel(object sender, AxLib._OnDialOutEvent e)
        {
            AxLib._OnDialOutEvent outtel = new AxLib._OnDialOutEvent(e.iReturn);
            if (outtel.iRe == 0)
            {
                //axLink.OnDialOut(0);
                axLink.DialOut(textBox1.Text);
                conn.Log.SetLog("成功:" + textBox1.Text + "_" + e.iRe.ToString());
            }
            else
            {
                conn.Log.SetLog("失败" + textBox1.Text +"_"+ e.iRe.ToString());
            }

        }
      
        protected void OnMyEvent(AxLib._OnDialOutEvent e)
        {
            if (elvc1 != null)
            {
                elvc1(this, e);             
                aiRe = 0;
                conn.Log.SetLog("代码" + e.iRe.ToString() + "");
            }
        }
        public void RaiseEvent()
        {
            // 步骤7,触发事件
          
           AxLib._OnDialOutEvent e = new AxLib._OnDialOutEvent(0);
            OnMyEvent(e);
        }
  

      
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                RaiseEvent();
              
              
            }
            catch (Exception ex)
            {
                conn.Log.SetLog("错误事件" + ex.Message + ex.Source + ex.StackTrace + 
            }
        }
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,