ACAT.Lib.Core.TalkWindowManagement.TalkWindowBase.updateDateTime C# (CSharp) Method

updateDateTime() protected method

Formats and displays the current date/time in the status bar
protected updateDateTime ( String dateFormat, string timeFormat ) : void
dateFormat String
timeFormat string
return void
        protected virtual void updateDateTime(String dateFormat, string timeFormat)
        {
            var dateTime = String.Empty;
            try
            {
                if (!String.IsNullOrEmpty(dateFormat))
                {
                    dateTime = DateTime.Today.ToString(dateFormat, CultureInfo.CurrentUICulture);
                }
            }
            catch
            {
                dateTime = DateTime.Today.ToString(defaultDateFormat, CultureInfo.CurrentUICulture);
            }

            try
            {
                if (!String.IsNullOrEmpty(timeFormat))
                {
                    if (!String.IsNullOrEmpty(dateTime))
                    {
                        dateTime += ". ";
                    }

                    dateTime += DateTime.Now.ToString(timeFormat, CultureInfo.CurrentUICulture);
                }
            }
            catch
            {
                if (!String.IsNullOrEmpty(dateTime))
                {
                    dateTime += ", ";
                }

                dateTime += DateTime.Now.ToString(defaultTimeFormat, CultureInfo.CurrentUICulture);
            }

            if (!String.IsNullOrEmpty(dateTime))
            {
                displayDateTime(dateTime);
            }
        }