Ejemplo n.º 1
0
            private void TerminateEmailAutomation(string status, string prevousStatus)
            {
                ProgressValueChangeEventArgs pvce = new ProgressValueChangeEventArgs()
                {
                    MinValue = 0, MaxValue = 4
                };
                StatusChangeEventArgs sce = new StatusChangeEventArgs();

                sce.CurrentStatus  = status;
                sce.PreviousStatus = prevousStatus;

                OnStatusChanged(sce);

                pvce.Value = 4;

                OnProgressValueChanged(pvce);
            }
Ejemplo n.º 2
0
            public void PlayEmailAutomation()
            {
                retValue = new StringBuilder("--------Start--------\r\n\r\n");
                int countMail = 0;

                ((ITraceable)client).LogTrace += new TraceEventHandler(TraceLog);

                ProgressValueChangeEventArgs pvce = new ProgressValueChangeEventArgs() { MinValue = 0, MaxValue = 4 };
                StatusChangeEventArgs sce = new StatusChangeEventArgs() { CurrentStatus = "Connecting " + client.GetHostName() + "...", PreviousStatus = "--------Start--------" };

                OnStatusChanged(sce);

                var result = client.Login(username, password);

                if (string.IsNullOrEmpty(result))
                {
                    pvce.Value = 1;

                    OnProgressValueChanged(pvce);

                    sce.CurrentStatus = "Authenticating client...";
                    sce.PreviousStatus = retValue.ToString();

                    OnStatusChanged(sce);

                    pvce.Value = 2;

                    OnProgressValueChanged(pvce);

                    sce.CurrentStatus = "Selecting Inbox...";
                    sce.PreviousStatus = retValue.ToString();

                    OnStatusChanged(sce);

                    if (string.IsNullOrEmpty(result))
                    {
                        pvce.Value = 3;

                        OnProgressValueChanged(pvce);

                        sce.CurrentStatus = "Getting total mail from Inbox...";
                        sce.PreviousStatus = retValue.ToString();

                        OnStatusChanged(sce);

                        result = client.GetTotalMail(out countMail);

                        if (string.IsNullOrEmpty(result))
                        {
                            if (countMail > 0)
                            {
                                sce.CurrentStatus = "Getting mail detail from Inbox...";
                                sce.PreviousStatus = retValue.ToString();

                                OnStatusChanged(sce);

                                IEnumerable<int> msgIds = null;

                                result = client.GetAllMessageFlags(MailFlag.All, out msgIds);

                                if (!string.IsNullOrEmpty(result))
                                    TerminateEmailAutomation("Problem in getting mail(s).", retValue.ToString());
                            }

                            pvce.Value = 4;

                            OnProgressValueChanged(pvce);

                            sce.CurrentStatus = "Logout from Inbox...";
                            sce.PreviousStatus = retValue.ToString();

                            OnStatusChanged(sce);

                            client.LogOut();

                            sce.CurrentStatus = "Logout completed...";
                            sce.PreviousStatus = retValue.ToString();

                            OnStatusChanged(sce);
                        }
                        else
                        {
                            TerminateEmailAutomation("Problem in getting mail count.", retValue.ToString());
                        }
                    }
                    else
                    {
                        TerminateEmailAutomation("Problem in getting mail count.", retValue.ToString());
                    }

                ((IDisposable)client).Dispose();
                    ((ITraceable)client).LogTrace -= new TraceEventHandler(TraceLog);
                }
            }
Ejemplo n.º 3
0
            private void TerminateEmailAutomation(string status, string prevousStatus)
            {
                ProgressValueChangeEventArgs pvce = new ProgressValueChangeEventArgs() { MinValue = 0, MaxValue = 4 };
                StatusChangeEventArgs sce = new StatusChangeEventArgs();

                sce.CurrentStatus = status;
                sce.PreviousStatus = prevousStatus;

                OnStatusChanged(sce);

                pvce.Value = 4;

                OnProgressValueChanged(pvce);
            }
Ejemplo n.º 4
0
 private void OnStatusChanged(StatusChangeEventArgs e)
 {
     this.statusChangedEventHandler?.Invoke(this, e);
 }
Ejemplo n.º 5
0
 private void emailAutomation_StatusChanged(object sender, StatusChangeEventArgs e)
 {
     UpdateStatus(label6, e.CurrentStatus);
     UpdateStatus(txtDetail, e.PreviousStatus);
 }
Ejemplo n.º 6
0
            public void PlayEmailAutomation()
            {
                retValue = new StringBuilder("--------Start--------\r\n\r\n");
                int countMail = 0;

                ((ITraceable)client).LogTrace += new TraceEventHandler(TraceLog);

                ProgressValueChangeEventArgs pvce = new ProgressValueChangeEventArgs()
                {
                    MinValue = 0, MaxValue = 4
                };
                StatusChangeEventArgs sce = new StatusChangeEventArgs()
                {
                    CurrentStatus = "Connecting " + client.GetHostName() + "...", PreviousStatus = "--------Start--------"
                };

                OnStatusChanged(sce);

                var result = client.Login(username, password);

                if (string.IsNullOrEmpty(result))
                {
                    pvce.Value = 1;

                    OnProgressValueChanged(pvce);

                    sce.CurrentStatus  = "Authenticating client...";
                    sce.PreviousStatus = retValue.ToString();

                    OnStatusChanged(sce);

                    pvce.Value = 2;

                    OnProgressValueChanged(pvce);

                    sce.CurrentStatus  = "Selecting Inbox...";
                    sce.PreviousStatus = retValue.ToString();

                    OnStatusChanged(sce);

                    if (string.IsNullOrEmpty(result))
                    {
                        pvce.Value = 3;

                        OnProgressValueChanged(pvce);

                        sce.CurrentStatus  = "Getting total mail from Inbox...";
                        sce.PreviousStatus = retValue.ToString();

                        OnStatusChanged(sce);

                        result = client.GetTotalMail(out countMail);

                        if (string.IsNullOrEmpty(result))
                        {
                            if (countMail > 0)
                            {
                                sce.CurrentStatus  = "Getting mail detail from Inbox...";
                                sce.PreviousStatus = retValue.ToString();

                                OnStatusChanged(sce);

                                IEnumerable <int> msgIds = null;

                                result = client.GetAllMessageFlags(MailFlag.All, out msgIds);

                                if (!string.IsNullOrEmpty(result))
                                {
                                    TerminateEmailAutomation("Problem in getting mail(s).", retValue.ToString());
                                }
                            }

                            pvce.Value = 4;

                            OnProgressValueChanged(pvce);

                            sce.CurrentStatus  = "Logout from Inbox...";
                            sce.PreviousStatus = retValue.ToString();

                            OnStatusChanged(sce);

                            client.LogOut();

                            sce.CurrentStatus  = "Logout completed...";
                            sce.PreviousStatus = retValue.ToString();

                            OnStatusChanged(sce);
                        }
                        else
                        {
                            TerminateEmailAutomation("Problem in getting mail count.", retValue.ToString());
                        }
                    }
                    else
                    {
                        TerminateEmailAutomation("Problem in getting mail count.", retValue.ToString());
                    }

                    ((IDisposable)client).Dispose();
                    ((ITraceable)client).LogTrace -= new TraceEventHandler(TraceLog);
                }
            }
Ejemplo n.º 7
0
 private void OnStatusChanged(StatusChangeEventArgs e)
 {
     this.statusChangedEventHandler?.Invoke(this, e);
 }
Ejemplo n.º 8
0
 private void emailAutomation_StatusChanged(object sender, StatusChangeEventArgs e)
 {
     UpdateStatus(label6, e.CurrentStatus);
     UpdateStatus(txtDetail, e.PreviousStatus);
 }