private void btnViewFiles_Click(object sender, EventArgs e)
        {
            string prompt     = "Select a reminder to view its files.";
            bool   isSelected = ForceSingleSelection(prompt);

            if (!isSelected)
            {
                return;
            }

            try {
                ListViewItem row        = TicklerslistView.SelectedItems[0];
                int          reminderID = (int)row.Tag;
                Reminder     rem        = ReminderManager.GetReminder(reminderID);
                if (rem == null)
                {
                    return;
                }
                FormFileAidViewReminder viewRem = new FormFileAidViewReminder(rem);
                viewRem.ShowDialog();

                // Always refresh gui here because reminder may have been removed
                FillListView();
            }
            catch (SqlException) {
                Messenger.ShowDbMsg();
            }
        }
Exemple #2
0
        private void btnViewReminder_Click(object sender, EventArgs e)
        {
            string prompt     = "Check a single file to view its reminder.";
            bool   isSelected = ForceSingleSelection(prompt);

            if (!isSelected)
            {
                return;
            }

            try {
                ListViewItem row         = MainListView.CheckedItems[0];
                bool         hasReminder = (row.SubItems[6].Text == "X"); // Reminder column
                if (!hasReminder)
                {
                    string noReminderPrompt = "Selected file does not have an open, unresolved reminder.";
                    Messenger.Show(noReminderPrompt, caption);
                    return;
                }

                int         fileID = (int)row.Tag;
                TrackedFile tf     = FileManager.GetFile(fileID);
                if (tf == null)
                {
                    return;
                }
                Reminder rem = tf.GetReminder();
                if (rem == null)
                {
                    return;
                }
                FormFileAidViewReminder viewRem = new FormFileAidViewReminder(rem);
                viewRem.ShowDialog();

                // Always refresh gui here because reminder may have been removed
                FillListView();
                // Re-check the selected item if it is still in list
                foreach (ListViewItem item in MainListView.Items)
                {
                    if ((int)item.Tag == fileID)
                    {
                        item.Checked = true;
                    }
                }
            }
            catch (SqlException) {
                Messenger.ShowDbMsg();
            }
        }