/// <summary> /// Load recipient list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonLoad_Click(object sender, EventArgs e) { try { // we load a different list from file... OpenFileDialog LobjDlg = new OpenFileDialog(); LobjDlg.InitialDirectory = Common.GetUserAppDataPath(Common.APPNAME); LobjDlg.Filter = "Outlook Calendar Export - User List (*.oceul)|*.oceul"; if (LobjDlg.ShowDialog() == DialogResult.OK) { // cleanup MobjRecipients = new Dictionary <string, ExtendedRecipient>(); listBox1.Items.Clear(); // load ExtendedRecipientList LobjList = new ExtendedRecipientList(); LobjList.Import(LobjDlg.FileName); foreach (ExtendedRecipient LobjItem in LobjList) { MobjRecipients.Add(LobjItem.RecipientName, LobjItem); listBox1.Items.Add(LobjItem.RecipientName); } uiVerify(); } } catch (Exception PobjEx) { PobjEx.Log(true, "Unable to load the recipient list."); } }
/// <summary> /// Load the settings from the registry /// </summary> public void LoadSettings() { try { RegistryKey LobjKey = Registry.CurrentUser.OpenSubKey(Common.REGPATH, false); // if the key does not exist, we create it if (LobjKey == null) { // create it LobjKey = Registry.CurrentUser.CreateSubKey(Common.REGPATH); } Recipients = new ExtendedRecipientList(); string LstrList = LobjKey.GetValue("Recipients", "").ToString(); Recipients.FromRegistryString(LstrList); if (Recipients.Count == 0) { Recipients.Add(new ExtendedRecipient(Globals.ThisAddIn.Application.Session.CurrentUser)); } this.PrintWhat = LobjKey.GetValue("PrintWhat", "").ToString(); this.ShowHeader = bool.Parse(LobjKey.GetValue("ShowHeader", 1).ToString()); this.ExportWhat = LobjKey.GetValue("ExportWhat", ExportType.All).ToString().GetEnumFromName <ExportType>(); this.ShowLocation = bool.Parse(LobjKey.GetValue("ShowLocation", true).ToString()); this.EmphasizeRecurring = bool.Parse(LobjKey.GetValue("EmphasizeRecurring", false).ToString()); this.DisplayTimeOnly = bool.Parse(LobjKey.GetValue("DisplayTimeOnly", false).ToString()); this.ExcludePrivate = bool.Parse(LobjKey.GetValue("ExcludePrivate", false).ToString()); } catch (Exception PobjEx) { throw new Exception("Load settings from registry failed. " + PobjEx.Message); } }
/// <summary> /// Public emthod that gets a list of Extended Recipients /// </summary> /// <returns></returns> public ExtendedRecipientList GetRecipients() { ExtendedRecipientList LobjList = new ExtendedRecipientList(); foreach (ExtendedRecipient LobjItem in MobjRecipients.Values) { LobjList.Add(LobjItem); } return(LobjList); }
/// <summary> /// ctor /// </summary> /// <param name="PobjRecipients"></param> public RecipientOptions(ExtendedRecipientList PobjRecipients) { InitializeComponent(); foreach (ExtendedRecipient LobjItem in PobjRecipients) { listBox1.Items.Add(LobjItem.RecipientName); MobjRecipients.Add(LobjItem.RecipientName, LobjItem); } uiVerify(); }
/// <summary> /// EXTENSION METHOD /// Takes a Recipients Object list and converts it to a /// List of Outlook Recipient objects /// </summary> /// <param name="PobjRecipients"></param> /// <returns></returns> public static ExtendedRecipientList ToListOfExtendedRecipient(this Outlook.Recipients PobjRecipients) { try { ExtendedRecipientList LobjResult = new ExtendedRecipientList(); foreach (Outlook.Recipient LobjItem in PobjRecipients) { LobjResult.Add(new ExtendedRecipient(LobjItem)); } return(LobjResult); } catch { return(null); } }
/// <summary> /// This is a constructor to be used for cloning an item /// </summary> /// <param name="PobjOther"></param> public ExtendedAppointment(ExtendedAppointment PobjItem) { try { Start = PobjItem.Start; End = PobjItem.End; Subject = PobjItem.Subject; Location = PobjItem.Location; Guid = PobjItem.Guid; Recurring = PobjItem.Recurring; IsMeeting = PobjItem.IsMeeting; Recipients = new ExtendedRecipientList(); Recipients.AddRange(PobjItem.Recipients); } catch (Exception PobjEx) { throw new Exception("Unable to clone appointment " + PobjItem.Subject + ". " + PobjEx.Message); } }
/// <summary> /// Created a new Extended appointment from an existing appointment /// </summary> /// <param name="PobjItem"></param> public ExtendedAppointment(Outlook.AppointmentItem PobjItem, ExtendedRecipient PobjRecipient) { try { Start = PobjItem.Start; End = PobjItem.End; Subject = PobjItem.Subject; Location = PobjItem.Location; Guid = PobjItem.GlobalAppointmentID; Recurring = PobjItem.IsRecurring; IsMeeting = (PobjItem.MeetingStatus != Outlook.OlMeetingStatus.olNonMeeting); Recipients = new ExtendedRecipientList(); Recipients.Add(PobjRecipient); } catch (Exception PobjEx) { throw new Exception("Unable to add appointment " + PobjItem.Subject + " from " + PobjRecipient.RecipientName + "'s calendar. " + PobjEx.Message); } }