当前位置: 首页>>代码示例>>C#>>正文


C# Topic.Subscribe方法代码示例

本文整理汇总了C#中Topic.Subscribe方法的典型用法代码示例。如果您正苦于以下问题:C# Topic.Subscribe方法的具体用法?C# Topic.Subscribe怎么用?C# Topic.Subscribe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Topic的用法示例。


在下文中一共展示了Topic.Subscribe方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 public void Start() {
   using(var sr=new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("X13.Periphery.gpio.xst"))) {
     Topic.Import(sr, null);
   }
   _gpio=Topic.root.Get("/dev/Gpio");
   _gpio.Get<string>("_declarer", _gpio).value="Gpio";
   _gpio.Subscribe("+", GpioChanged);
   _poolTimer=new Timer(Pool, null, 500, 50);
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:9,代码来源:Gpio.cs

示例2: Main

        static void Main(string[] args)
        {
            var daemon = new ThreadPoolDaemon();
            var topic = new Topic<string>();

            topic.Subscribe(daemon, (line) => Console.WriteLine(line));
            topic.Publish("Hello World !");
            topic.Publish("Press Any Key ...");
            Console.ReadKey();
        }
开发者ID:ArturD,项目名称:Daemons,代码行数:10,代码来源:Program.cs

示例3: TopicViewProp

 public TopicViewProp(Topic item) {
   obj=item;
   obj.Subscribe("+", obj_changed);
   propsColl=new PropertyDescriptorCollection(null);
   foreach(PropertyDescriptor pr in TypeDescriptor.GetProperties(this.obj)) {
     if(obj.valueType!=null || pr.Category!="Content") {
       propsColl.Add(pr);
     }
   }
   foreach(Topic tp in obj.children) {
     if(tp.name=="_declarer" || tp.name=="_location" || tp.valueType==null) {
       continue;
     }
     PropertyDescriptor np=new DVarPropertyDescriptor(tp);
     propsColl.Add(np);
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:17,代码来源:PropertyView.xaml.cs

示例4: Main

        static void Main(string[] args)
        {
            if (args.Length >= 1) _processNo = int.Parse(args[0]);
            if (args.Length >= 2) _messagesPerProcess = int.Parse(args[1]);

            _start = DateTime.UtcNow;

            _countDown = _processNo;
            for (int i = 0; i < _processNo; i++)
            {
                Topic<int> topic = new Topic<int>();
                var daemon = new ThreadPoolDaemon();
                topic.Subscribe(daemon, (msg) => Increment(topic, msg));
                topic.Publish(0);
            }

            Console.ReadLine();
        }
开发者ID:ArturD,项目名称:Daemons,代码行数:18,代码来源:Program.cs

示例5: Parse

    private void Parse(string rp, string json) {
      if(rp.StartsWith(_remoteBase)) {
        if(rp.Length==_remoteBase.Length) {
          rp=name;
        } else {
          rp=name+rp.Substring(_remoteBase.Length);
        }
      } else {
        return;
      }

      Topic cur;
      if(!string.IsNullOrEmpty(json) && json!="null") {         // Publish
        if(!_var.Exist(rp, out cur) || cur.valueType==null) {
          Type vt=X13.WOUM.ExConverter.Json2Type(json);
          cur=Topic.GetP(_var.path+"/"+rp, vt, _var);
        }
        if(_val==null) {
          _val=_var.Get(name);
          _val.Subscribe("#", _local_changed);
        }
        cur.saved=false;
        if(cur.valueType!=null) {
          cur.FromJson(json, _val);
        }
      } else if(_var.Exist(rp, out cur)) {                      // Remove
        cur.Remove(_val);
      }
    }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:29,代码来源:WsSyncPl.cs

示例6: SetOwner

 public void SetOwner(Topic owner) {
   if(_owner!=null) {
     _owner.Unsubscribe("+", STVarChanged);
   }
   _owner=owner;
   if(_owner!=null) {
     addr=int.Parse(owner.name.Substring(2));
     if(_owner.parent!=null && _owner.parent.valueType==typeof(MsDevice)) {
       _dev=(_owner.parent as DVar<MsDevice>).value;
     }
     _decl=_owner.Get<string>("_declarer", _owner);
     _owner.Subscribe("+", STVarChanged);
     if(_state!=0xB0) {
       Reset();
     }
   } else {
     _decl=null;
     _state=0xB0;
     _to.Change(-1, -1);
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:21,代码来源:SmartTwi.cs

示例7: SetOwner

 public void SetOwner(Topic owner) {
   if(_owner!=null) {
     if(Topic.brokerMode) {
       _owner.Unsubscribe("+", STVarChanged);
     }
   }
   if(_dev!=null) {
     _dev.Pool+=_dev_Pool;
   }
   _owner=owner;
   if(_owner!=null) {
     name=owner.name;
     if(Topic.brokerMode) {
       if(_owner.parent!=null && _owner.parent.valueType==typeof(MsDevice)) {
         _dev=(_owner.parent as DVar<MsDevice>).value;
       }
       _owner.Get<string>("_declarer", _owner).value="TWI";
       _owner.Subscribe("+", STVarChanged);
       if(_dev!=null) {
         _dev.Pool+=_dev_Pool;
         Reset();
       }
     }
   }
 }
开发者ID:X13home,项目名称:X13.Host,代码行数:25,代码来源:TWIDriver.cs

示例8: SetOwner

 public void SetOwner(Topic owner) {
   if(!object.ReferenceEquals(owner, _owner)) {
     if(_owner!=null) {
       _owner.Unsubscribe("#", ChildChaged);
     }
     _owner=owner;
     if(_owner!=null) {
       _tPresent=_owner.Get<bool>("_present");
       _tPresent.saved=false;
       _owner.Get<string>("_declarer", _owner).value=_decl;
       PSetOwner();
       _owner.Subscribe("#", ChildChaged);
     } else if(_gate!=null) {
       _gate.DelDevice(this);
       var dev=Topic.root.Get("/dev/1Wire").children.Select(z => z.GetValue() as OneWireBase).FirstOrDefault(z => z!=null && z!=this && this.rom.SequenceEqual(z.rom));
       if(dev!=null) {
         dev.gate=_gate;
       }
       _gate=null;
     }
   }
 }
开发者ID:giapdangle,项目名称:X13.Host,代码行数:22,代码来源:OneWireBase.cs

示例9: PiVar

 public PiVar(Topic src) {
   owner = src;
   _cont=new List<PlcItem>();
   layer=0;
   owner.Subscribe(owner_changed, SubRec.SubMask.Once, true);
 }
开发者ID:Wassili-Hense,项目名称:Host.V04f,代码行数:6,代码来源:PlcItems.cs


注:本文中的Topic.Subscribe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。