Exemplo n.º 1
0
 void GlowReader_FramingError(object sender, EmberLib.Framing.FramingReader.FramingErrorArgs e)
 {
     Console.WriteLine("GlowReader framing error: {0}", e.Message);
 }
Exemplo n.º 2
0
 public GlowRootReadyArgs(EmberLib.Glow.GlowContainer root)
 {
     Root = root;
 }
Exemplo n.º 3
0
        void GlowReader_Error(object sender, EmberLib.Glow.Framing.GlowReader.ErrorArgs e)
        {
            if(e.ErrorCode != _lastGlowFramingError)
             {
            OnNotification(new NotificationArgs(String.Format("Framing Error: {0}", e.Message)));

            _lastGlowFramingError = e.ErrorCode;
             }
        }
Exemplo n.º 4
0
        void GlowReader_RootReady(object sender, EmberLib.AsyncDomReader.RootReadyArgs e)
        {
            var root = e.Root as EmberLib.Glow.GlowContainer;
             State = GlowEndPointState.Connected;

             if(root != null)
            OnGlowRootReady(new GlowRootReadyArgs(root));
             else
            OnNotification(new NotificationArgs(String.Format("Unexpected Ember Root: {0} ({1})", e.Root, e.Root.GetType())));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Sends an ember/glow tree to the remote host.
        /// </summary>
        /// <param name="root">The root of the tree to send.</param>
        public void Write(EmberLib.Glow.GlowContainer root)
        {
            lock(_sync)
             {
            var tcpClient = _tcpClient;

            if(tcpClient != null
            && tcpClient.Connected)
            {
               var output = CreateFramingOutput(
                  (_, e) =>
                  {
                     var stream = tcpClient.GetStream();
                     stream.Write(e.FramedPackage, 0, e.FramedPackageLength);
                  });

               using(output)
               {
                  root.Encode(output);

                  output.Finish();
               }
            }
             }
        }