zoukankan      html  css  js  c++  java
  • c# usercontrol ,networkcomms3.0 Invoke总结

     1: accordionControl 添加了自定义控件页面 之后,切换到别的页面后,原先打开的页面对象还是存在的没有被销毁,再打开时重新引用即可

      private void accordionControlElement5_Click(object sender, EventArgs e)
            {
                SelectModelShowOnPanel("ad");
            }

        所以需要做一个判断
          if(ad==null) nd = new models.NowDataDemo(_neworkhelper);

     

    2: networkcomms  使用过程中,客户端发送请求需要带返回包的,  并且是时钟不停请求的, 不要使用SendReceiveObject 方法,应为时钟和返回值不同步的话容易出现问题

     客户端发送:
      newTcpConnection.SendObject("ReqCount");
    客户端接收:
    NetworkComms.AppendGlobalIncomingPacketHandler<CountMsgContract>("ResCount", IncomingLineProductCoutRequest);
    ResCount 相当于 路由,接收服务器端发送使用rescount 字符串的数据包

     3: 修改gridview内的值

       this.Invoke(new Action(() =>
                {
                    resmsg.linename = "";
                    resmsg.tiaocount = counttatmsg.TiaoCount;
                    resmsg.firstcount = counttatmsg.FirstCount;
                    resmsg.nextcount = counttatmsg.NextCount;
                }));

    4:gridview 绑定字段模版

      public  class ResReceiveMsg :  INotifyPropertyChanged
        {
             public event PropertyChangedEventHandler PropertyChanged; 
             protected void OnPropertyChanged(string name) 
               {        PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name)); }
           private string _linename="";
           private string _tiaocount="";
           private string _firstcount="";
           private string _nextcount="";
           /// <summary>
           ///
           /// </summary>
           public string linename
           {
               get{return _linename;}
               set{_linename=value;OnPropertyChanged("linename");}
           }
           /// <summary>
           ///
           /// </summary>
           public string tiaocount
           {
               get{return _tiaocount;}
               set{_tiaocount=value;OnPropertyChanged("tiaocount");}
           }
           /// <summary>
           ///
           /// </summary>
           public string firstcount
           {
               get{return _firstcount;}
               set{_firstcount=value;OnPropertyChanged("firstcount");}
           }
           /// <summary>
           ///
           /// </summary>
           public string nextcount
           {
               get{return _nextcount;}
               set{_nextcount=value;OnPropertyChanged("nextcount");}
           }
           public ResReceiveMsg(){}
        }

     使用这个模版的好处就是更新了数据源不用刷新控件 ,这个模版已继承了控件更新通知

  • 相关阅读:
    【中文分词】条件随机场CRF
    【中文分词】最大熵马尔可夫模型MEMM
    【中文分词】二阶隐马尔可夫模型2-HMM
    【中文分词】隐马尔可夫模型HMM
    Elasticsearch的CRUD:REST与Java API
    d3的比例尺和坐标轴
    webpack DllPlugin的用法
    webpack单独启动目录方法
    d3的常用方法和数据类型
    d3中的enter,exit,update概念
  • 原文地址:https://www.cnblogs.com/zuochanzi/p/7909566.html
Copyright © 2011-2022 走看看