Example #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // check for updates
            if (Convert.ToBoolean(StaticHelper.GetApplicationSetting("AutoUpdate")))
            {
                if (string.IsNullOrEmpty(StaticHelper.GetApplicationSetting("LastUpdateCheckDate")))
                {
                    StaticHelper.CheckForMenuXmlUpdates();
                }
                else
                {
                    DateTime lastcheck = Convert.ToDateTime(StaticHelper.GetApplicationSetting("LastUpdateCheckDate"));
                    TimeSpan t         = DateTime.Now - lastcheck;
                    if (t.Days >= Convert.ToInt32(StaticHelper.GetApplicationSetting("UpdateCheckFrequency")))
                    {
                        StaticHelper.CheckForMenuXmlUpdates();
                    }
                }
            }

            // get the buttons
            StaticHelper.LogMessage(MessageType.Info, "Getting buttons");
            menu[] buttons = StaticHelper.GetControlledVocabularyMenus();

            // build the buttons
            StaticHelper.LogMessage(MessageType.Info, "Building menu");
            this.BuildMenu(buttons);

            if (this.menu1.Items.Count == 0)
            {
                this.ShowManager();
            }
        }
Example #2
0
        private void ShowManager()
        {
            Manager managerWindow = new Manager();

            managerWindow.ShowDialog();
            StaticHelper.LogMessage(MessageType.Info, "Building menu");

            // get the buttons
            StaticHelper.LogMessage(MessageType.Info, "Getting buttons");
            menu[] buttons = StaticHelper.GetControlledVocabularyMenus();

            // build the buttons
            StaticHelper.LogMessage(MessageType.Info, "Building menu");
            this.BuildMenu(buttons);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the MainWindow class
        /// </summary>
        public MainWindow()
        {
            try
            {
                this.InitializeComponent();
                this.Width  = Convert.ToInt32(Settings.Default.WindowWidth);
                this.Height = Convert.ToInt32(Settings.Default.WindowHeight);
                FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
                this.Title += " - " + new Version(versionInfo.FileMajorPart, versionInfo.FileMinorPart, versionInfo.FileBuildPart, versionInfo.FilePrivatePart);
            }
            catch (Exception ex)
            {
                StaticHelper.LogMessage(MessageType.Error, "in error");

                StaticHelper.LogMessage(MessageType.Error, ex.ToString());
                if (ex.InnerException != null)
                {
                    StaticHelper.LogMessage(MessageType.Error, ex.InnerException.Message);
                }
            }
        }
Example #4
0
        private static void Send(object sender, RoutedEventArgs e)
        {
            MenuItem m = (MenuItem)sender;

            try
            {
                string[] idParts = m.Uid.Split(new[] { StaticHelper.SplitSequence }, StringSplitOptions.RemoveEmptyEntries);

                // Get the recipients
                string[] recipients = StaticHelper.GetRecipients(idParts[0], m.Uid);
                string   mailto     = "mailto:" + recipients[0];
                mailto += "?subject=" + m.Tag;

                if (!string.IsNullOrEmpty(recipients[1]))
                {
                    mailto += "&cc=" + recipients[1];
                }

                if (!string.IsNullOrEmpty(recipients[2]))
                {
                    mailto += "&bcc=" + recipients[2];
                }

                if (Convert.ToBoolean(StaticHelper.GetApplicationSetting("CopySubjectToClipboard")))
                {
                    Clipboard.SetText(m.Tag.ToString());
                }

                if (Convert.ToBoolean(StaticHelper.GetApplicationSetting("CallMailtoProtocol")))
                {
                    Process.Start(mailto);
                }
            }
            catch (System.Exception ex)
            {
                StaticHelper.LogMessage(MessageType.Error, ex.ToString());
                throw;
            }
        }