Esempio n. 1
0
        public void Run(Action <string> log)
        {
            LogLine = log;
            SocketTraceListener.Start();
            var  ui             = Dispatcher.CurrentDispatcher;
            uint numberOfEmails = 0;

            Task.Run(() =>
            {
                try
                {
                    var client = new Pop3Client();
                    client.Connect(Server, Port, SSL);
                    client.SendAuthUserPass(Username, Password);

                    numberOfEmails = client.GetEmailCount();
                    client.Disconnect();
                }
                catch (Exception ex)
                {
                    ui.Invoke(delegate { LogLine($"### {ex.Message}"); });
                }

                ui.Invoke(delegate
                {
                    Log($"### {numberOfEmails} Messages.");
                    LogLine("### DIAGNOSTICS TRACE START");
                    Log(SocketTraceListener.Stop());
                    LogLine("### DIAGNOSTICS TRACE END");
                });
            });
        }
Esempio n. 2
0
        public void Run(Action <string> log)
        {
            LogLine = log;
            SocketTraceListener.Start();
            var ui = Dispatcher.CurrentDispatcher;

            Task.Run(() =>
            {
                try
                {
                    client.Send(msg);
                }
                catch (Exception ex)
                {
                    ui.Invoke(delegate { LogLine($"### {ex.Message}"); });
                }

                ui.Invoke(delegate
                {
                    LogLine("### DIAGNOSTICS TRACE START");
                    Log(SocketTraceListener.Stop());
                    LogLine("### DIAGNOSTICS TRACE END");
                });
            });
        }