private void pushEmailClick(object sender, RibbonControlEventArgs e)
        {
            if (checkConfiguration())
            {
                Selection selectedItems = null;
                try
                {
                    selectedItems = Globals.ThisAddIn.Application.ActiveExplorer().Selection;

                    if (selectedItems != null && selectedItems.Count > 0)
                    {
                        int emailCount = ASPECUtil.pushEmails(selectedItems);

                        MessageBox.Show((emailCount == 1 ? "1 email has" : emailCount + " emails have") + " been pushed to ASPEC", DEFAULT_TITLE + EMAIL_TITLE);
                    }
                    else
                    {
                        MessageBox.Show("No emails are selected.", DEFAULT_TITLE + EMAIL_TITLE);
                    }
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    MessageBox.Show("Failed to push emails to ASPEC", DEFAULT_TITLE + EMAIL_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
        private void syncCalendarClick(object sender, RibbonControlEventArgs e)
        {
            if (checkConfiguration())
            {
                try
                {
                    ASPECUtil.syncCalendar();

                    MessageBox.Show("ASPEC appointments have been synchronized", DEFAULT_TITLE + CALENDAR_TITLE);
                }
                catch (System.Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    MessageBox.Show("Failed to synchronize appointments with ASPEC", DEFAULT_TITLE + CALENDAR_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            StringBuilder sb    = new StringBuilder();
            CheckObject   check = null;

            byte[]        buf      = new byte[8192];
            ASCIIEncoding encoding = new ASCIIEncoding();

            try
            {
                check = ASPECUtil.authenticate(this.aspecURLTextBox.Text, this.aspecUserNamTextBox.Text, this.aspecPassTextBox.Text);

                if (check != null)
                {
                    if (check.result == 1)
                    {
                        this.connectionErrrorLabel.ForeColor = Color.Green;
                        this.connectionErrrorLabel.Text      = "ASPEC Connection Parameters Are Correct";
                    }
                    else
                    {
                        this.connectionErrrorLabel.ForeColor = Color.Red;
                        this.connectionErrrorLabel.Text      = "ASPEC Connection Test Failed";
                    }
                }
                else
                {
                    this.connectionErrrorLabel.ForeColor = Color.Red;
                    this.connectionErrrorLabel.Text      = "ASPEC Connection Test Failed";
                }
            }
            catch (JsonSerializationException jsonEx)
            {
                this.connectionErrrorLabel.ForeColor = Color.Red;
                this.connectionErrrorLabel.Text      = "ASPEC Connection Test Failed";
            }
            catch (Exception ex)
            {
                this.connectionErrrorLabel.ForeColor = Color.Red;
                this.connectionErrrorLabel.Text      = "ASPEC Connection Test Failed";
            }
        }
 private void connectionButtonClick(object sender, RibbonControlEventArgs e)
 {
     ASPECUtil.openOptions();
 }