private void SetupMainUI()
        {
            _compose.Text = "Compose";
            _bodyView.Clear();
            List <string> _subjects = new List <string>();

            switch (_uiState)
            {
            case 0:     //inbox
                _header.Text = "Inbox";
                _inbox.ClearItems();
                foreach (var message in _email.Inbox.OrderByDescending(x => x.Timestamp))
                {
                    if (_subjects.Contains(message.Subject))
                    {
                        continue;
                    }
                    var item = new ListViewItem
                    {
                        Tag   = message.Subject,
                        Value = $"{message.Subject} - {message.From}"
                    };
                    _inbox.AddItem(item);
                    _subjects.Add(message.Subject);
                }
                _bodyView.AddChild(_inbox);
                break;

            case 1:     //outbox
                _header.Text = "Outbox";
                _outbox.ClearItems();
                foreach (var message in _email.Outbox.OrderByDescending(x => x.Timestamp))
                {
                    if (_subjects.Contains(message.Subject))
                    {
                        continue;
                    }
                    var item = new ListViewItem
                    {
                        Tag   = message.Subject,
                        Value = $"{message.Subject} - {message.To}"
                    };
                    _outbox.AddItem(item);
                    _subjects.Add(message.Subject);
                }
                _bodyView.AddChild(_outbox);
                break;

            case 2:     //view message
                _compose.Text = "Reply";
                _header.Text  = _subject;
                _thread.Clear();
                foreach (var message in _email.GetThread(_subject))
                {
                    var panel = new EmailMessagePanel();
                    panel.Subject = message.Subject;
                    panel.From    = message.From;
                    panel.Message = message.Message;
                    _thread.AddChild(panel);
                }
                _bodyView.AddChild(_thread);
                break;

            case 3:     //compose message
                _header.Text         = "Compose message";
                _compose.Text        = "Send";
                _composeMessage.Text = "";
                _composeSubject.Text = "";
                _composeTo.Text      = "";
                _bodyView.AddChild(_composePanel);
                break;

            case 4:     //compose reply
                _header.Text       = _subject;
                _compose.Text      = "Send";
                _replyMessage.Text = "";
                _bodyView.AddChild(_replyPanel);
                var addresses = new List <string>();
                foreach (var message in _email.GetThread(_subject))
                {
                    if (message.From == _email.MyEmailAddress || addresses.Contains(message.From))
                    {
                        continue;
                    }
                    addresses.Add(message.From);
                }
                _addresses = addresses.ToArray();
                break;
            }
        }