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


C# Plug类代码示例

本文整理汇总了C#中Plug的典型用法代码示例。如果您正苦于以下问题:C# Plug类的具体用法?C# Plug怎么用?C# Plug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CreatedPlugCanBeDisconnected

 public void CreatedPlugCanBeDisconnected()
 {
     var stream = Substitute.For<IAudioStream>();
     var plug = new Plug<IAudioStream>(stream);
     plug.Disconnect();
     plug.IsConnected.Should().Be.False();
 }
开发者ID:JohnStov,项目名称:WinHill.Audio,代码行数:7,代码来源:PlugTests.cs

示例2: CreateConnectorCollection

 public ConnectorCollection CreateConnectorCollection()
 {
   var plug = new Plug();
   var connectorCollection = new ConnectorCollection();
   connectorCollection.Connectors.Add(plug);
   return connectorCollection;
 }
开发者ID:WinnieThePoooh,项目名称:Lego,代码行数:7,代码来源:Input.cs

示例3: RemoveHalfPlug

        public void RemoveHalfPlug(Plug plug) {
            try {
                plugs.Remove(plug);
                Plugs_ListBox.ItemsSource = plugs;
            } catch (Exception) {

            }
        }
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:8,代码来源:HalfPlug.xaml.cs

示例4: CanConnectPlugToSocket

        public void CanConnectPlugToSocket()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            plug.ConnectTo(socket).Should().Be.True();
        }
开发者ID:JohnStov,项目名称:WinHill.Audio,代码行数:8,代码来源:PlugTests.cs

示例5: CanConnectSocketToPlug

        public void CanConnectSocketToPlug()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            socket.ConnectTo(plug).Should().Be.True();
        }
开发者ID:JohnStov,项目名称:WinHill.Audio,代码行数:8,代码来源:SocketTests.cs

示例6: ConnectingSetsSocketChannel

        public void ConnectingSetsSocketChannel()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            plug.ConnectTo(socket);
            Assert.Same(stream, socket.Channel);
        }
开发者ID:JohnStov,项目名称:WinHill.Audio,代码行数:9,代码来源:PlugTests.cs

示例7: ConnectedSocketIsConnected

        public void ConnectedSocketIsConnected()
        {
            var stream = Substitute.For<IAudioStream>();
            var plug = new Plug<IAudioStream>(stream);
            var socket = new Socket<IAudioStream>();

            plug.ConnectTo(socket);
            socket.IsConnected.Should().Be.True();
        }
开发者ID:JohnStov,项目名称:WinHill.Audio,代码行数:9,代码来源:PlugTests.cs

示例8: Start

 //--- Methods ---
 protected override Yield Start(XDoc config, Result result)
 {
     yield return Coroutine.Invoke(base.Start, config, new Result());
     _redirect = Plug.New(config["proxy"].AsUri ?? config["redirect"].AsUri, TimeSpan.FromSeconds(config["timeout"].AsInt ?? (int)Plug.DEFAULT_TIMEOUT.TotalSeconds));
     if(_redirect == null) {
         throw new ArgumentException("redirect URI missing or invalid");
     }
     result.Return();
 }
开发者ID:sdether,项目名称:DReAM,代码行数:10,代码来源:RedirectService.cs

示例9: AmazonS3Client

 //--- Constructors ---
 /// <summary>
 /// Create new client instance 
 /// </summary>
 /// <param name="config">Client configuration.</param>
 /// <param name="timerFactory">Timer factory.</param>
 public AmazonS3Client(AmazonS3ClientConfig config, TaskTimerFactory timerFactory)
 {
     _config = config;
     _bucketPlug = Plug.New(_config.S3BaseUri)
         .WithS3Authentication(_config.PrivateKey, _config.PublicKey)
         .WithTimeout(_config.Timeout)
         .At(_config.Bucket);
     _rootPlug = _bucketPlug;
     if(!string.IsNullOrEmpty(_config.RootPath)) {
         _keyRootParts = _config.RootPath.Split(new[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
         if(_keyRootParts != null && _keyRootParts.Any()) {
             _rootPlug = _rootPlug.At(_keyRootParts);
         }
     }
     _expirationEntries = new ExpiringHashSet<string>(timerFactory);
     _expirationEntries.EntryExpired += OnDelete;
 }
开发者ID:nataren,项目名称:DReAM,代码行数:23,代码来源:AmazonS3Client.cs

示例10: Main

    public static void Main(string[] args)
    {
        if (args.Length != 2) {
        Console.WriteLine("Need socket id and file-name as an argument.");
        return;
        }
        uint socket_id = UInt32.Parse(args[0]);
        string filename=args[1];
        Console.WriteLine("filename="+filename);

        Console.WriteLine("using socket "+socket_id);

        //	    Glib.Thread.Init();
        Gdk.Threads.Init();

        Application.Init();
        Gdk.Threads.Enter();
        try {

        Plug plug= new Plug(socket_id);

        Fixed fixed1 = new Fixed();
        fixed1.Put(new Label("File: \""+filename+"\""), 10, 10);
        fixed1.Put(new Entry("HELLO"), 10, 50);
        fixed1.Put(new Entry("World"), 10, 100);
        fixed1.ShowAll();
        plug.Add(fixed1);
        plug.ShowAll();

        Console.WriteLine("app is running..");
        Application.Run();
            } finally {
          Gdk.Threads.Leave();
            }
        Console.WriteLine("Done!");
    }
开发者ID:jcorrius,项目名称:go-oo-mingw32-soc,代码行数:36,代码来源:SamplePlug.cs

示例11: WaitFor

 private bool WaitFor(Plug plug, Func<DreamMessage, bool> func, TimeSpan timeout)
 {
     var expire = DateTime.Now.Add(timeout);
     while(expire > DateTime.Now) {
         var r = plug.GetAsync().Wait();
         if(func(r)) {
             return true;
         }
         Thread.Sleep(100);
     }
     return false;
 }
开发者ID:sdether,项目名称:DReAM,代码行数:12,代码来源:PubSubServiceTests.cs

示例12: Init

 public void Init()
 {
     _hostInfo = DreamTestHelper.CreateRandomPortHost();
     _hostInfo.Host.Self.At("load").With("name", "test.mindtouch.dream").Post(DreamMessage.Ok());
     var config = new XDoc("config")
        .Elem("path", "test")
        .Elem("sid", "sid://mindtouch.com/DreamContextTestService");
     DreamMessage result = _hostInfo.LocalHost.At("host", "services").With("apikey", _hostInfo.ApiKey).PostAsync(config).Wait();
     Assert.IsTrue(result.IsSuccessful, result.ToText());
     _plug = Plug.New(_hostInfo.LocalHost.Uri.WithoutQuery()).At("test");
     DreamContextTestService.ContextVar = null;
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:12,代码来源:DreamContextTests.cs

示例13: CreateBadStartChild

 public Yield CreateBadStartChild(DreamContext context, DreamMessage request, Result<DreamMessage> response)
 {
     yield return CreateService(
         "badchild",
         "sid://mindtouch.com/TestBadStartService",
         new XDoc("config").Elem("throw", context.GetParam("throw", "false")),
         new Result<Plug>()).Set(v => _badChild = v);
     response.Return(DreamMessage.Ok());
     yield break;
 }
开发者ID:maximmass,项目名称:DReAM,代码行数:10,代码来源:ServiceTests.cs

示例14:

 Yield IPlugEndpoint.Invoke(Plug plug, string verb, XUri uri, DreamMessage request, Result<DreamMessage> response)
 {
     _env.UpdateInfoMessage(_sourceInternal, null);
     Result<DreamMessage> res = new Result<DreamMessage>(response.Timeout);
     _env.SubmitRequestAsync(verb, uri, null, request, res);
     yield return res;
     response.Return(res);
 }
开发者ID:heran,项目名称:DReAM,代码行数:8,代码来源:httptransport.cs

示例15: CreateSecondPrivateStorageServiceProxy

 private void CreateSecondPrivateStorageServiceProxy()
 {
     _hostInfo.Host.Self.At("services").Post(
         new XDoc("config")
             .Elem("class", typeof(TestServiceWithPrivateStorage).FullName)
             .Elem("path", TEST_PATH + "2"));
     _log.Debug("created second storage service");
     testService = Plug.New(_hostInfo.Host.LocalMachineUri).At(TEST_PATH + "2");
 }
开发者ID:sdether,项目名称:DReAM,代码行数:9,代码来源:PrivateStorageTests.cs


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