Beispiel #1
0
 /// <summary>
 /// The user wants to setup display options for multiple recipients
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonDisplayOptions_Click(object sender, EventArgs e)
 {
     try
     {
         RecipientOptions LobjForm = new RecipientOptions(Settings.Recipients);
         if (LobjForm.ShowDialog() == DialogResult.OK)
         {
             Settings.Recipients = LobjForm.GetRecipients();
             txtName.Text        = Settings.Recipients.ToStringOfNames();
             if (Settings.Recipients.Count == 1)
             {
                 radioButtonShared.Enabled = false;
                 if (radioButtonShared.Checked)
                 {
                     radioButtonMeetings.Checked = true;
                 }
             }
             else
             {
                 radioButtonShared.Enabled = true;
             }
         }
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Something happened while working with the recipients form.");
     }
 }
 /// <summary>
 /// Load and initialize the progress form or set it to
 /// a new value to reset it to zero
 /// </summary>
 /// <param name="PintMax"></param>
 /// <param name="PstrValue"></param>
 public static void LoadProgress(int PintMax, string PstrValue)
 {
     try
     {
         IntPtr LintHwnd = Process.GetProcessesByName("Outlook")[0].MainWindowHandle;
         if (GobjProgress == null)
         {
             GobjProgress = new ProgressForm(PintMax, PstrValue);
             GobjProgress.Show(new ArbitraryWindow(LintHwnd));
         }
         else
         {
             GobjProgress.SetLabel(PstrValue);
             GobjProgress.SetProgressBarMax(PintMax);
             if (!GobjProgress.Visible)
             {
                 GobjProgress.Show(new ArbitraryWindow(LintHwnd));
             }
         }
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Unable to load the progress form.");
     }
 }
Beispiel #3
0
        /// <summary>
        /// Downloads the manifest file from the web
        /// </summary>
        /// <param name="PstrServerUrl"></param>
        /// <param name="PstrDestPath"></param>
        /// <returns></returns>
        private static string DownloadFileFromWeb(string PstrServerUrl, string PstrDestPath)
        {
            try
            {
                string[] LstrPathParts    = PstrServerUrl.Split('/');
                string   LstrManifestName = LstrPathParts[LstrPathParts.Length - 1];

                string LstrInstallFilename = Path.Combine(PstrDestPath, LstrManifestName);
                Console.WriteLine("Reading manifest file from: " + PstrServerUrl);
                Console.WriteLine("Writing the manifest file to the install folder: " + LstrInstallFilename);
                WebRequest LobjRequest = System.Net.HttpWebRequest.Create(PstrServerUrl);
                using (StreamReader LobjReader = new StreamReader(LobjRequest.GetResponse().GetResponseStream()))
                {
                    using (StreamWriter LobjWriter = new StreamWriter(LstrInstallFilename))
                    {
                        LobjWriter.Write(LobjReader.ReadToEnd());
                    }
                }

                return(LstrInstallFilename);
            }
            catch (Exception PobjEx)
            {
                throw PobjEx.PassException("Unable to download manifest from web.");
            }
        }
Beispiel #4
0
 /// <summary>
 /// The user wants to add a new item to the list
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     try
     {
         Outlook.SelectNamesDialog LobjDialog;
         LobjDialog = Globals.ThisAddIn.Application.Session.GetSelectNamesDialog();
         LobjDialog.NumberOfRecipientSelectors = Microsoft.Office.Interop.Outlook.OlRecipientSelectors.olShowNone;
         if (LobjDialog.Display())
         {
             // verify the recipient first
             try
             {
                 Outlook.MAPIFolder LobjFolder = Common.IsRecipientValid(LobjDialog.Recipients[1]);
                 Outlook.Items      LobjItems  = LobjFolder.Items;
                 LobjItems.Sort("[Start]");
             }
             catch
             {
                 MessageBox.Show("Unable to add the recipient. This might be becuase you do not have " +
                                 "permission/access to their calendar or it has not been setup as a shared " +
                                 "calendar in your Outlook Calendar.",
                                 Common.APPNAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
             listBox1.Items.Add(LobjDialog.Recipients[1].Name);
             MobjRecipients.Add(LobjDialog.Recipients[1].Name, new ExtendedRecipient(LobjDialog.Recipients[1]));
             uiVerify();
         }
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "An error occurred when adding the name.");
     }
 }
Beispiel #5
0
        /// <summary>
        /// Updates the manifest from the server location
        /// </summary>
        /// <param name="PstrManifestPath"></param>
        /// <param name="PstrInstallPath"></param>
        /// <returns>bool</returns>
        private static bool Update(string PstrManifestPath, string PstrInstallPath)
        {
            try
            {
                string LstrLocalManifestFullPath = "";

                if (PstrManifestPath.ToLower().StartsWith("http"))
                {
                    LstrLocalManifestFullPath = DownloadFileFromWeb(PstrManifestPath, PstrInstallPath);
                }
                else
                {
                    LstrLocalManifestFullPath = DownloadFile(PstrManifestPath, PstrInstallPath);
                }

                Console.WriteLine("Update process completed.");
                return(true);
            }
            catch (Exception PobjEx)
            {
                PobjEx.HandleException(true, "Either the manifest server location is invalid, " +
                                       "cannot be accessed, or the local file is in use or " +
                                       "the path is no longer valid.");
                return(false);
            }
        }
 /// <summary>
 /// Get the recipient dialog and allow the user to chose a recipient
 /// </summary>
 /// <param name="PstrRecipient"></param>
 public static ExtendedRecipientList GetRecipients(string PstrRecipient = "")
 {
     try
     {
         Outlook.SelectNamesDialog LobjSnd = Globals.ThisAddIn.Application.Session.GetSelectNamesDialog();
         if (PstrRecipient != string.Empty)
         {
             LobjSnd.Recipients.Add(PstrRecipient);
         }
         LobjSnd.NumberOfRecipientSelectors = Outlook.OlRecipientSelectors.olShowTo;
         LobjSnd.AllowMultipleSelection     = false;
         LobjSnd.Display();
         if (!LobjSnd.Recipients.ResolveAll())
         {
             return(null);
         }
         else
         {
             return(LobjSnd.Recipients.ToListOfExtendedRecipient());
         }
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "There was an error selecting the recipient.");
         return(null);
     }
 }
Beispiel #7
0
        /// <summary>
        /// Uninstalls the web add-in
        /// </summary>
        /// <param name="PstrLocalManifestFullName"></param>
        /// <returns>bool</returns>
        private static bool Uninstall(string PstrLocalManifestFullName, bool PbolDoNotDelete = false)
        {
            try
            {
                string LstrId = GetManifestId(PstrLocalManifestFullName);

                if (LstrId == null)
                {
                    throw new Exception("Invalid manifest file detected.");
                }

                if (!PbolDoNotDelete)
                {
                    FileInfo LobjFile = new FileInfo(PstrLocalManifestFullName); // grab the local
                    Console.WriteLine("Deleting the manifest file: " + PstrLocalManifestFullName);
                    LobjFile.Delete();
                }

                Console.WriteLine("Deleting Registry entries...");
                RegistryKey LobjKey = Registry.CurrentUser.OpenSubKey(REG_KEY, true);
                LobjKey.DeleteValue(LstrId);
                LobjKey.DeleteSubKey(LstrId);
                Console.WriteLine("Registry keys deleted.");
                Console.WriteLine("Uninstall process completed.");
                return(true);
            }
            catch (Exception PobjEx)
            {
                PobjEx.HandleException(true, "Either the manifest path is invalid, cannot be accessed, or " +
                                       "the manifest is not a valid XML file, is not a Web Add-in " +
                                       "manifest, or the local path does not exist, or the local " +
                                       "file is still in use.");
                return(false);
            }
        }
        /// <summary>
        /// Opens Word, loads the provided template "PrintWhat" and then
        /// fills in the data based on whether the result is a:
        ///  - Day
        ///  - Work week
        ///  - Full week
        ///  - Month
        ///  The type of item to print is based on the Name of the template
        ///  provided in PrintWhat.
        /// </summary>
        public void Export()
        {
            try
            {
                // first we need to get the template type
                switch (MobjSettings.GetTemplateType())
                {
                case AddinSettings.TemplateType.Day:
                    exportDays();
                    break;

                case AddinSettings.TemplateType.FullWeek:
                    exportDays();
                    break;

                case AddinSettings.TemplateType.Month:
                    // if the first day of the month is a Friday, then we start
                    // off with a count of 5, so that we start replacing the
                    // day fields on the proper day on a monthly calendar
                    DateTime LobjDate = MobjSettings.Date.GetFirstOfMonth();
                    exportDays(LobjDate.GetDayOfWeekInt());
                    break;

                case AddinSettings.TemplateType.WorkWeek:
                    exportDays();
                    break;
                }
            }
            catch (Exception PobjEx)
            {
                PobjEx.Log(true, "The export to Microsoft Word failed.");
            }
        }
Beispiel #9
0
 /// <summary>
 /// EVENT
 /// This event fires when Outlook starts, but after ALL other
 /// add-ins have been loaded.
 /// </summary>
 private void Application_Startup()
 {
     try
     {
         // PRIMARY PURPOSE:
         // start a thread, wait a second and then load the
         // add-in. We do this because we want to give Outlook
         // a chance to fully connect to the server before
         // specific add-ins load and interfere with the
         // connection to the Exchange Server
         new Thread(() =>
         {
             try
             {
                 Thread.Sleep(1000);    // wait one second
                 loadDelayedAddins();
             }
             catch (Exception PobjEx)
             {
                 PobjEx.Log("Thread failed.");
             }
         }).Start();
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log("Application_Startup(): Unable to start thread.");
     }
 }
 /// <summary>
 /// Replaces all the symbols with the proper coloring
 /// </summary>
 /// <param name="PobjDoc"></param>
 private void colorCode(Word.Document PobjDoc)
 {
     try
     {
         // now find all the symbols and color code them
         foreach (ExtendedRecipient LobjRecipient in MobjSettings.Recipients)
         {
             Word.Find LobjFind = PobjDoc.Range().Find;
             // Clear all previously set formatting for Find dialog box.
             LobjFind.ClearFormatting();
             // Clear all previously set formatting for Replace dialog box.
             LobjFind.Replacement.ClearFormatting();
             // Set font to Replace found font.
             LobjFind.Text                   = LobjRecipient.Symbol;
             LobjFind.Forward                = true;
             LobjFind.Wrap                   = Word.WdFindWrap.wdFindContinue;
             LobjFind.Format                 = true;
             LobjFind.MatchCase              = true;
             LobjFind.MatchWholeWord         = false;
             LobjFind.MatchWildcards         = false;
             LobjFind.MatchSoundsLike        = false;
             LobjFind.MatchAllWordForms      = false;
             LobjFind.Replacement.Text       = LobjRecipient.Symbol;
             LobjFind.Replacement.Font.Color = LobjRecipient.HighlightColor.FromRGBColorString().ConvertToWordColor();
             LobjFind.Execute(Replace: Word.WdReplace.wdReplaceAll);
         }
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Unable to update the coloring on the symbols.");
     }
 }
Beispiel #11
0
        /// <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.");
            }
        }
Beispiel #12
0
 /// <summary>
 /// The user clicked the about button
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         FileInfo LobjFile    = new FileInfo(Assembly.GetExecutingAssembly().CodeBase.Replace("file:///", "").Replace("/", "\\"));
         Assembly LobjAssm    = Assembly.LoadFrom(LobjFile.FullName);
         Version  LobjVersion = LobjAssm.GetName().Version;
         MessageBox.Show(Common.APPNAME + "\n\n" +
                         "This add-in is provided to give you more printing options " +
                         "in Outlook. The templates provided are fully customizable " +
                         "and new templates can be developed.\n\n" +
                         "This has been developed by:\n\n\t" +
                         " - Microsoft Premier Field Engineering\n\t" +
                         " - Date:     \t" + LobjFile.CreationTime.ToShortDateString() + "\n\t" +
                         " - Version:  \t" + LobjVersion.ToString() + "\n\n" +
                         "THIS SOFTWARE IS PROVIDED 'AS IS' AND ANY EXPRESSED OR " +
                         "IMPLIED WARRANTIES ARE DISCLAIMED. PLEASE CONTACT YOUR " +
                         "HELP DESK FOR ASSISTANCE.",
                         Common.APPNAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
     }
 }
        /// <summary>
        /// Updates the header of the document
        /// </summary>
        /// <param name="PobjDoc"></param>
        private void updateHeader(Word.Document PobjDoc)
        {
            try
            {
                switch (MobjSettings.GetTemplateType())
                {
                case AddinSettings.TemplateType.FullWeek:
                case AddinSettings.TemplateType.WorkWeek:
                    PobjDoc.FindReplace("<<header>>", "Calendar for Week of " + MobjStart.Day.GetOrdinal() + " to " + MobjEnd.Day.GetOrdinal());
                    break;

                case AddinSettings.TemplateType.Month:
                    PobjDoc.FindReplace("<<header>>", "Calendar for Month of " + MobjStart.Month.GetMonthName() + ", " + MobjEnd.Year.ToString());
                    break;

                case AddinSettings.TemplateType.Day:
                    PobjDoc.FindReplace("<<header>>", "Day of " + MobjStart.Month.GetMonthName() + " the " + MobjStart.Day.GetOrdinal());
                    break;
                }

                if (MobjSettings.ShowHeader)
                {
                    if (MobjSettings.Recipients.Count == 1)
                    {
                        if (MobjSettings.Recipients[0].ShowName)
                        {
                            PobjDoc.FindReplace("<<name>>", "Calendar of " +
                                                MobjSettings.Recipients[0].RecipientName);
                        }
                        else
                        {
                            PobjDoc.FindReplace("<<name>>", "Calendar of " +
                                                MobjSettings.Recipients[0].DisplayName);
                        }
                    }
                    else
                    {
                        PobjDoc.FindReplace("<<name>>", "Calendars of " +
                                            MobjSettings.Recipients.ToStringOfNamesWithSymbols());
                    }
                }
                else
                {
                    // delete the header row and lead paragraph
                    // this is the ONLY troubling part, we have to select
                    // the range and type a backspace
                    Word.Range LobjRange = PobjDoc.FindReplace("<<name>>", "");
                    LobjRange.Select();
                    LobjRange.Application.Selection.TypeBackspace();
                }
            }
            catch (Exception PobjEx)
            {
                PobjEx.Log(true, "Unable to update the header.");
            }
        }
        //Create callback methods here. For more information about adding callback methods, visit https://go.microsoft.com/fwlink/?LinkID=271226

        public void Ribbon_Load(Office.IRibbonUI ribbonUI)
        {
            try
            {
                this.Ribbon = ribbonUI;
            }
            catch (Exception PobjEx)
            {
                MessageBox.Show(PobjEx.ToString());
            }
        }
 public ExportToWord(AddinSettings PobjSettings)
 {
     try
     {
         MobjSettings = PobjSettings;
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
     }
 }
Beispiel #16
0
 /// <summary>
 /// Used for .Contains() to assist with easy list actions
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public bool Equals(ExtendedAppointment PobjOther)
 {
     try
     {
         return(PobjOther.Guid == this.Guid);
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(false);
     }
 }
Beispiel #17
0
 /// <summary>
 /// Gets the path to the current DLL install location
 /// </summary>
 /// <returns></returns>
 public static string GetCurrentPath()
 {
     try
     {
         return(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase).Replace("file:\\", "").Replace("/", "\\"));
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return("");
     }
 }
Beispiel #18
0
 /// <summary>
 /// EXTENSION METHOD
 /// Converts a System Color object to a Word Color Object
 /// </summary>
 /// <param name="PobjColor"></param>
 /// <returns></returns>
 public static Word.WdColor ConvertToWordColor(this Color PobjColor)
 {
     try
     {
         return((Microsoft.Office.Interop.Word.WdColor)(PobjColor.R + 0x100 * PobjColor.G + 0x10000 * PobjColor.B));
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(Word.WdColor.wdColorBlack);
     }
 }
Beispiel #19
0
 /// <summary>
 /// Returns the first day of the month
 /// </summary>
 /// <param name="PobjDate"></param>
 /// <returns></returns>
 public static DateTime GetFirstOfMonth(this DateTime PobjDate)
 {
     try
     {
         return(new DateTime(PobjDate.Year, PobjDate.Month, 1));
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(PobjDate);
     }
 }
Beispiel #20
0
        /// <summary>
        /// Installs the Web Add-in
        /// </summary>
        /// <param name="PstrManifestPath"></param>
        /// <param name="PstrInstallPath"></param>
        private static bool Install(string PstrManifestPath, string PstrInstallPath)
        {
            try
            {
                // copy the manifest down to the install path
                Console.WriteLine("Accessing the manifest file: " + PstrManifestPath);

                string LstrLocalManifestFullPath = "";

                if (PstrManifestPath.ToLower().StartsWith("http"))
                {
                    LstrLocalManifestFullPath = DownloadFileFromWeb(PstrManifestPath, PstrInstallPath);
                }
                else
                {
                    LstrLocalManifestFullPath = DownloadFile(PstrManifestPath, PstrInstallPath);
                }

                Console.WriteLine("Copy complete. Analyzing file...");
                string LstrId = GetManifestId(LstrLocalManifestFullPath);

                if (LstrId == null)
                {
                    throw new Exception("Invalid manifest file detected.");
                }
                Console.WriteLine("Writing Registry entries...");
                RegistryKey LobjKey = Registry.CurrentUser.OpenSubKey(REG_KEY, true);
                if (LobjKey == null)
                {
                    LobjKey = Registry.CurrentUser.CreateSubKey(REG_KEY, true);
                }
                if (LobjKey == null)
                {
                    throw new Exception("Unable to create or write to the registry path: HKCU\\" + REG_KEY);
                }
                LobjKey.SetValue(LstrId, LstrLocalManifestFullPath, RegistryValueKind.String);
                LobjKey = LobjKey.CreateSubKey(LstrId);
                LobjKey.SetValue(VALUE_UseDirectDebugger, 1, RegistryValueKind.DWord);
                LobjKey.SetValue(VALUE_UseLiveReload, 0, RegistryValueKind.DWord);
                LobjKey.SetValue(VALUE_UseWebDebugger, 0, RegistryValueKind.DWord);
                Console.WriteLine("Registry keys completed.");
                Console.WriteLine("Install process completed.");
                return(true);
            }
            catch (Exception PobjEx)
            {
                PobjEx.HandleException(true, "Either the manifest path is invalid, cannot be accessed, or " +
                                       "the manifest is not a valid XML file, is not a Web Add-in " +
                                       "manifest, or the local path does not exist, or the local " +
                                       "file is still in use.");
                return(false);
            }
        }
Beispiel #21
0
 /// <summary>
 /// STARTUP
 /// On startup we connect to the startup event
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ThisAddIn_Startup(object sender, System.EventArgs e)
 {
     try
     {
         // hook to the startup event. It will only fire after all
         // the add-ins have been loaded.
         Application.Startup += Application_Startup;
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log("ThisAddin_Startup() failed.");
     }
 }
Beispiel #22
0
 /// <summary>
 /// Returns the first day of the work week (Monday)
 /// </summary>
 /// <param name="PobjDate"></param>
 /// <returns></returns>
 public static DateTime GetMonday(this DateTime PobjDate)
 {
     try
     {
         double LintDoW = (double)PobjDate.DayOfWeek;
         return(PobjDate.AddDays((-1 * LintDoW) + 1));
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(PobjDate);
     }
 }
Beispiel #23
0
 /// <summary>
 /// Returns the last day of the month
 /// </summary>
 /// <param name="PobjDate"></param>
 /// <returns></returns>
 public static DateTime GetEndOfMonth(this DateTime PobjDate)
 {
     try
     {
         DateTime LobjNextMonth = new DateTime(PobjDate.Year, PobjDate.Month + 1, 1);
         return(LobjNextMonth.AddDays(-1));
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(PobjDate);
     }
 }
Beispiel #24
0
 /// <summary>
 /// Load form - set Outlook application
 /// </summary>
 public PrintWhatForm(AddinSettings PobjSettings)
 {
     try
     {
         InitializeComponent();
         MobjOutlook = Globals.ThisAddIn.Application;
         Settings    = PobjSettings;
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Could not load print options form.");
         this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     }
 }
        private bool getAllAppointments()
        {
            try
            {
                // first we need to figure out the start and end dates
                // for all the calendar entries we will be collecting
                switch (MobjSettings.GetTemplateType())
                {
                case AddinSettings.TemplateType.Day:
                    MobjStart = new DateTime(MobjSettings.Date.Year,
                                             MobjSettings.Date.Month,
                                             MobjSettings.Date.Day,
                                             00, 00, 00);
                    MobjEnd = new DateTime(MobjSettings.Date.Year,
                                           MobjSettings.Date.Month,
                                           MobjSettings.Date.Day,
                                           23, 59, 59);
                    break;

                case AddinSettings.TemplateType.FullWeek:
                    MobjStart = MobjSettings.Date.GetSunday();
                    MobjEnd   = MobjStart.AddDays(6);
                    break;

                case AddinSettings.TemplateType.WorkWeek:
                    MobjStart = MobjSettings.Date.GetMonday();
                    MobjEnd   = MobjStart.AddDays(5);
                    break;

                case AddinSettings.TemplateType.Month:
                    MobjStart = new DateTime(MobjSettings.Date.Year,
                                             MobjSettings.Date.Month,
                                             1);
                    MobjEnd = MobjStart.GetEndOfMonth();
                    break;
                }

                // do it
                MobjAppointments = new DailyAppointmentsList();
                bool LbolMeetingsOnly = (MobjSettings.ExportWhat != AddinSettings.ExportType.All);
                return(MobjAppointments.Load(MobjSettings.Recipients, MobjStart, MobjEnd, LbolMeetingsOnly, MobjSettings.ExcludePrivate));
            }
            catch (Exception PobjEx)
            {
                PobjEx.Log();
                return(false);
            }
        }
Beispiel #26
0
 /// <summary>
 /// Exports a serialized list to file
 /// </summary>
 /// <param name="PstrFilename"></param>
 /// <returns></returns>
 public bool Export(string PstrFilename)
 {
     try
     {
         StreamWriter  LobjSw  = new StreamWriter(PstrFilename);
         XmlSerializer LobjSer = new XmlSerializer(this.GetType());
         LobjSer.Serialize(LobjSw, this);
         LobjSw.Close();
         return(true);
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Unable to export the users.");
         return(false);
     }
 }
 /// <summary>
 /// Returns a List of strings with recipient names.
 /// </summary>
 /// <returns></returns>
 public List <string> GetRecipientList()
 {
     try
     {
         List <string> LobjReturn = new List <string>();
         foreach (ExtendedRecipient LobjItem in Recipients)
         {
             LobjReturn.Add(LobjItem.RecipientName);
         }
         return(LobjReturn);
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
         return(null);
     }
 }
Beispiel #28
0
 /// <summary>
 /// Imports a serialized list from file
 /// </summary>
 /// <param name="PstrFileName"></param>
 /// <returns></returns>
 public bool Import(string PstrFileName)
 {
     try
     {
         StreamReader  LobjReader = new StreamReader(PstrFileName);
         XmlSerializer LobjSer    = new XmlSerializer(this.GetType());
         this.Clear();
         this.AddRange((ExtendedRecipientList)LobjSer.Deserialize(LobjReader));
         LobjReader.Close();
         return(true);
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Unable to import the user list.");
         return(false);
     }
 }
Beispiel #29
0
        /// <summary>
        /// Downloads the file from the local file system or from a
        /// network location via UNC
        /// </summary>
        /// <param name="PstrSrcPath"></param>
        /// <param name="PstrDestPath"></param>
        /// <returns></returns>
        private static string DownloadFile(string PstrSrcPath, string PstrDestPath)
        {
            try
            {
                FileInfo LobjFile            = new FileInfo(PstrSrcPath);
                string   LstrInstallFilename = Path.Combine(PstrDestPath, LobjFile.Name);
                Console.WriteLine("Reading manifest file from: " + PstrSrcPath);
                Console.WriteLine("Writing the manifest file to the install folder: " + LstrInstallFilename);
                LobjFile.CopyTo(LstrInstallFilename, true);

                return(LstrInstallFilename);
            }
            catch (Exception PobjEx)
            {
                throw PobjEx.PassException("Unable to download the file.");
            }
        }
Beispiel #30
0
        /// <summary>
        /// User change the show to limit the template types
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ComboBoxShow_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                // load all again
                listBoxTemplates.Items.Clear();
                listBoxTemplates.Items.AddRange(Common.LoadTemplates().ToArray());
                List <string> LobjKeep = new List <string>();
                foreach (string LstrItem in listBoxTemplates.Items)
                {
                    if (LstrItem.ToUpper().StartsWith("[MONTH]") &&
                        (comboBoxShow.Text.ToUpper().Contains("MONTH") ||
                         comboBoxShow.Text.ToUpper().Contains("ALL")))
                    {
                        LobjKeep.Add(LstrItem);
                    }
                    if (LstrItem.ToUpper().StartsWith("[WORKWEEK]") &&
                        (comboBoxShow.Text.ToUpper().Contains("WORK") ||
                         comboBoxShow.Text.ToUpper().Contains("ALL")))
                    {
                        LobjKeep.Add(LstrItem);
                    }
                    if (LstrItem.ToUpper().StartsWith("[FULLWEEK]") &&
                        (comboBoxShow.Text.ToUpper().Contains("FULL") ||
                         comboBoxShow.Text.ToUpper().Contains("ALL")))
                    {
                        LobjKeep.Add(LstrItem);
                    }
                    if (LstrItem.ToUpper().StartsWith("[DAY]") &&
                        (comboBoxShow.Text.ToUpper().Contains("DAILY") ||
                         comboBoxShow.Text.ToUpper().Contains("ALL")))
                    {
                        LobjKeep.Add(LstrItem);
                    }
                }

                // now clear again and add them
                listBoxTemplates.Items.Clear();
                listBoxTemplates.Items.AddRange(LobjKeep.ToArray());
            }
            catch (Exception PobjEx)
            {
                PobjEx.Log(true);
            }
        }