コード例 #1
0
ファイル: Workers.cs プロジェクト: rrossenbg/vprint
        private void SendMessages(DataServiceClient client)
        {
            //******************************************************************
            //  SEND MESSAGES TO THE SERVER
            //******************************************************************
            Trace.WriteLine("TransferringService: ClientDataAccess.SelectMessagesForExport");

            int msgCount = (Settings != null && Settings.MaximumMessagesForExport > 0) ?
                           Settings.MaximumMessagesForExport :
                           Program.MAXIMUM_MESSAGES_FOR_EXPORT;

            List <DbMessageInfo> messages = ClientDataAccess.SelectMessagesForExport(msgCount);

            if (messages != null && messages.Count > 0)
            {
                foreach (var msg in messages)
                {
                    Stopwatch w = Stopwatch.StartNew();
                    Trace.WriteLine("TransferringService: client.SaveMessageXmlText");
                    Hashtable table = new Hashtable();
                    table.Add("Message", msg.Message);
                    //TODO: Hardcode
                    table.Add("Source", 0);
                    table.Add("StackTrace", msg.StackTrace);
                    table.Add("Type", msg.Type);
                    table.Add("DateInserted", msg.DateInserted);
#warning TODO
                    ////////using (ProtectedXml xml = new ProtectedXml(ProtectionOptions.Encript))
                    ////////{
                    ////////    xml.AddElement("MSG", table);
                    ////////    client.SaveMessageXmlText(xml.OuterXml);
                    ////////    Trace.WriteLine("TransferringService: ".concat(w.Elapsed));
                    ////////}

                    ClientDataAccess.SetMessageExportedAsync(msg.MessageID);

                    Thread.Sleep(0);
                }
            }
            else
            {
                Trace.WriteLine("TransferringService: MESSAGES to Send (OK)");
            }
        }