Exemplo n.º 1
0
        /// <summary>
        /// Outlook custom calendar path validation.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private void tbCalendarPath_Validating(object sender, CancelEventArgs e)
        {
            e.Cancel = Enabled && rbMSOutlook.Checked && rbCustomCalendar.Checked &&
                       (tbOutlookCalendarPath.Text.Any(x => Path.GetInvalidPathChars().Contains(x)) ||
                        String.IsNullOrWhiteSpace(tbOutlookCalendarPath.Text.Trim()) ||
                        !ExternalCalendar.OutlookCalendarExist(rbDefaultCalendar.Checked, tbOutlookCalendarPath.Text));

            if (e.Cancel)
            {
                MessageBox.Show(@"A calendar at that path could not be found.", @"MS Outlook",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Occurs when the user click the "Update Calendar" button.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private async void btnUpdateCalendar_Click(object sender, EventArgs e)
        {
            // Ensure that we are trying to use the external calendar
            if (!Settings.Calendar.Enabled)
            {
                btnAddToCalendar.Visible = false;
                return;
            }

            if (m_character is CCPCharacter)
            {
                await ExternalCalendar.UpdateCalendar(m_character as CCPCharacter);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Outlook custom calendar path validation.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param>
        private void tbCalendarPath_Validating(object sender, CancelEventArgs e)
        {
            var badChars = Path.GetInvalidPathChars();

            e.Cancel = Enabled && rbMSOutlook.Checked && rbCustomCalendar.Checked &&
                       (tbOutlookCalendarPath.Text.Any(x => badChars.Contains(x)) ||
                        string.IsNullOrWhiteSpace(tbOutlookCalendarPath.Text) ||
                        !ExternalCalendar.OutlookCalendarExist(rbDefaultCalendar.Checked,
                                                               tbOutlookCalendarPath.Text));
            if (e.Cancel)
            {
                MessageBox.Show(Properties.Resources.ErrorNoCalendar, @"MS Outlook",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }