private void PromptTglBtn_Click(object sender, RibbonControlEventArgs e) { string docPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XLant\\personal.xml"; //Update the settings file XDocument xPer = XLtools.personalDoc(); XElement settings = xPer.Descendants("PersonalSettings").FirstOrDefault(); string prompt = settings.Descendants("Prompt").FirstOrDefault().Value; if (PromptTglBtn.Checked) { //Update the settings file settings.Descendants("Prompt").FirstOrDefault().Value = "true"; xPer.Save(docPath); XLOutlook.XLEventhandler(true); ExInternalCheck.Visible = true; } else { //Update the settings file settings.Descendants("Prompt").FirstOrDefault().Value = "false"; xPer.Save(docPath); XLOutlook.XLEventhandler(false); ExInternalCheck.Visible = false; } }
private void XLantRibbon_Load(object sender, RibbonUIEventArgs e) { //Deal with the prompt issue string docPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\XLant\\personal.xml"; XDocument xPer = XLtools.personalDoc(); XElement settings = xPer.Descendants("PersonalSettings").FirstOrDefault(); string prompt = ""; if (settings.Descendants("Prompt").FirstOrDefault() == null) { settings.Add(new XElement("Prompt", "true")); xPer.Save(docPath); } else { prompt = settings.Descendants("Prompt").FirstOrDefault().Value; } //check the setting for prompt if it is not present or true then add handler if (prompt != "false") { XLOutlook.XLEventhandler(true); PromptTglBtn.Checked = true; } else { //don't need to stop the event handler, it hasn't yet been started PromptTglBtn.Checked = false; } if (prompt == "true") { //make the selection visible ExInternalCheck.Visible = true; //handle whether internal emails should be excluded if (settings.Descendants("Internal").FirstOrDefault() == null) { settings.Add(new XElement("Internal", "false")); xPer.Save(docPath); } if (settings.Descendants("Internal").FirstOrDefault().Value == "true") { ExInternalCheck.Checked = true; exInternal = true; } else { ExInternal.Checked = false; exInternal = false; } } else { ExInternal.Visible = false; } //Handle the creation of the VC Folder //XLOutlook.CreateVCFolder(); }