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


C# Channel.Update方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Channel channel = new Channel();
            HelloService service = new HelloService();
            channel.AddMethod<HelloRequest, HelloSerializer>("maid.example.HelloService.HelloNotify", service.HelloNotify);
            channel.AddMethod<HelloRequest, HelloSerializer, HelloResponse, HelloSerializer>("maid.example.HelloService.HelloRpc", service.HelloRpc);
            channel.ConnectedCallback.Add(() =>
            {
                Console.WriteLine("连接上了");
            });

            channel.Connect("192.168.0.99", 8888);

            while (true)
            {
                channel.Update();

                HelloRequest request = new HelloRequest();
                request.message = "this message from protobuf-net";
                try
                {
                    channel.CallMethod("maid.example.HelloService.HelloNotify", request);
                    channel.CallMethod("maid.example.HelloService.HelloRpc", request);
                }
                catch (Exception ){ }
                if (channel.Connecting)
                {
                    Console.WriteLine("连接中");
                }
            }
        }
开发者ID:rayx999,项目名称:libmaid,代码行数:31,代码来源:Program.cs

示例2: UpdateChannelService

 private static void UpdateChannelService(Channel ch, Service s)
 {
     if (ch.Service == null || ch.Service.Id != s.Id)
     {
         if (ch == null)
         {
             Util.Trace(TraceLevel.Error, "Null channel object, service {0}!", s);
             return;
         }
         if (ch.ChannelType == ChannelType.UserAdded)
         {
             Util.Trace(TraceLevel.Info, "Skipping service update for channel {0} because it is user added", ch);
             return;
         }
         Util.Trace(TraceLevel.Warning, "Updating service for channel {0} to {1}", ch, s);
         ch.Service = s;
         ch.Update();
     }
 }
开发者ID:glugalug,项目名称:GuideEditingMisc,代码行数:19,代码来源:ScheduleEntriesInjector.cs

示例3: OrderingMoveUp

 public void OrderingMoveUp(Channel channel)
 {
     IList<Channel> siblings = GetSiblings(channel);
     Channel switcher =
         siblings.Where(c => c.Ordering < channel.Ordering).OrderBy(c => c.Ordering).FirstOrDefault();
     if (switcher != null)
     {
         int currentOrder = channel.Ordering;
         channel.Ordering = switcher.Ordering;
         switcher.Ordering = currentOrder;
         channel.Update();
         switcher.Update();
     }
 }
开发者ID:BGCX261,项目名称:zorillacms-svn-to-git,代码行数:14,代码来源:ChannelService.cs


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