예제 #1
0
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            try
            {
                string id = ((AppMessage)MessagesLB.SelectedIndex())?.Id;

                if (!string.IsNullOrEmpty(id) && _messages.Remove(id))
                {
                    if (!_messages.SaveMessages())
                    {
                        MessageBox.Show("Unable to save some or all messages.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    ClearMessageDetails();
                    ToggleButtons(false, DASH);
                    SearchTB.SetText(string.Empty);
                    UpdateMessages();
                    ClearMessageDisplay();
                }
            }
            catch (Exception)
            {
                //Something happened
            }
        }
예제 #2
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            if (_messages.Add())
            {
                if (!_messages.SaveMessages())
                {
                    MessageBox.Show("Unable to save some or all messages.", "Error Occurred.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                ClearMessageDetails();
                ToggleButtons(false, DASH);
                SearchTB.SetText(string.Empty);
                UpdateMessages();
                ClearMessageDisplay();
            }
        }
예제 #3
0
 /// <summary>
 /// Updates the messages view
 /// </summary>
 public void UpdateMessagesView()
 {
     SearchTB.SetText(string.Empty);
     UpdateMessages();
     ToggleButtons(false, DASH);
 }