コード例 #1
0
ファイル: SilverlightBridge.cs プロジェクト: punker76/kaxaml
        void server_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            _isClientWaiting = false;
            Debug.WriteLine("SERVER RECEIVED:" + e.Message);

            if (e.Message.Equals("SENDLENGTH"))
            {
                _isClientWaiting = true; // this lets us know that we can begin the send process later on
            }
            else if (e.Message.Equals("SENDXAML"))
            {
                server.SendReceive("XAML|" + _xaml);
            }
            else if (e.Message.Equals("SUCCESS"))
            {
                // it worked
                // send final COMPLETE message
                server.SendReceive("COMPLETE");

                RaiseParseCompleted(true, string.Empty, 0, 0);
            }
            else if (e.Message.StartsWith("ERROR|"))
            {
                // parse the error and respond
                // send final COMPLETE message

                //client.SendReceive("ERROR|" + errorLineNumber + "|" + errorLinePos + "|" + errorMessage);

                string[] errorResponse = e.Message.Split(new char[] { '|' });
                int errorLineNumber = int.Parse(errorResponse[1]);
                int errorLinePos = int.Parse(errorResponse[2]);
                string errorMessage = errorResponse[3];

                RaiseParseCompleted(false, errorMessage, errorLineNumber, errorLinePos);

                //Debug.WriteLine(e.Message);
                server.SendReceive("COMPLETE");
            }
        }
コード例 #2
0
ファイル: SilverlightBridge.cs プロジェクト: punker76/kaxaml
 static void portServer_MessageReceived(object sender, MessageReceivedEventArgs e)
 {
     if (e.Message.Equals("GETPORT"))
     {
         portServer.SendReceive(NextPort.ToString());
         NextPort++;
     }
 }