public DynamicLayerFormatSelectionForm(bool isTime, string strFormat, ProWrite.Core.TimeFormat timeformat)
        {
            InitializeComponent();
            IsTime = isTime;

            _oldSelectTimeFormat = timeformat;
            _oldStrFormat        = strFormat;

            if (IsTime)
            {
                this.Text = "Time Date Format";
            }
            else
            {
                this.Text = "Temperature Format";
            }
            Init();
        }
Пример #2
0
        public static string GetTimeByTimeFormat(ProWrite.Core.TimeFormat timeFormat)
        {
            string strTime = "";

            switch (timeFormat)
            {
            case ProWrite.Core.TimeFormat.Date_US:
                strTime = "MM/DD/YY";
                break;

            case ProWrite.Core.TimeFormat.Date_US_Full_Yr:
                strTime = "MM/DD/YYYY";
                break;

            case ProWrite.Core.TimeFormat.DateIntl_1:
                strTime = "DD/MM/YY";
                break;

            case ProWrite.Core.TimeFormat.DateIntl_1FullYr:
                strTime = "DD/MM/YYYY";
                break;

            case ProWrite.Core.TimeFormat.DateIntl_2:
                strTime = "YY/MM/DD";
                break;

            case ProWrite.Core.TimeFormat.DateIntl_2FullYr:
                strTime = "YYYY/MM/DD";
                break;

            case ProWrite.Core.TimeFormat.Day_of_Month:
                strTime = "DD";    //.Day.ToString();
                break;

            case ProWrite.Core.TimeFormat.Day_of_Week:
                strTime = "DayOfWeek";
                break;

            case ProWrite.Core.TimeFormat.Day_of_Week_Abbr:
                strTime = "DAY";
                break;

            case ProWrite.Core.TimeFormat.Hours_12hour:
                strTime = "HH";
                break;

            case ProWrite.Core.TimeFormat.Hours_24hour:
                strTime = "HH";
                break;

            case ProWrite.Core.TimeFormat.Minutes:
                strTime = "MM";
                break;

            case ProWrite.Core.TimeFormat.Month:
                strTime = "--Month--";    //GetMonth(DateTime.Now.Month);// DateTime.Now.GetDateTimeFormats()[132].Substring(0, DateTime.Now.GetDateTimeFormats()[132].IndexOf(","));
                break;

            case ProWrite.Core.TimeFormat.Month_Abbr:
                strTime = "MTH";    //GetMonth(DateTime.Now.Month).Substring(0, 3);// DateTime.Now.GetDateTimeFormats()[132].Substring(0, DateTime.Now.GetDateTimeFormats()[132].IndexOf(",")).Substring(0, 3);
                break;

            case ProWrite.Core.TimeFormat.Month_of_Year:
                strTime = "MM";
                break;

            case ProWrite.Core.TimeFormat.Seconds:
                strTime = "SS";
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_AMPM:
                strTime = "HH:MM " + DateTime.Now.ToString("tt");
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_o_AMPM:
                strTime = "HH:MM";
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_seconds:
                strTime = "HH:MM:SS";
                break;

            case ProWrite.Core.TimeFormat.Twenty_Four_Hour_Time:
                strTime = "HH:MM";
                break;

            case ProWrite.Core.TimeFormat.Twenty_Four_hour_time_w_seconds:
                strTime = "HH:MM:SS";
                break;

            case ProWrite.Core.TimeFormat.Year:
                strTime = "YYYY";
                break;

            case ProWrite.Core.TimeFormat.Year_short:
                strTime = "YY";
                break;
            }
            return(strTime);
        }
Пример #3
0
        public static string GetTimeByTimeFormatString(ProWrite.Core.TimeFormat timeFormat)
        {
            string strTime = "";

            switch (timeFormat)
            {
            case ProWrite.Core.TimeFormat.Date_US:
                strTime = DateTime.Now.ToString("MM/dd/yy");    // DateTime.Now.GetDateTimeFormats()[2];
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Date_US_Full_Yr:
                strTime = DateTime.Now.ToString("MM/dd/yyyy");    // DateTime.Now.GetDateTimeFormats()[3];
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.DateIntl_1:
                strTime = DateTime.Now.ToString("dd/MM/yy");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.DateIntl_1FullYr:
                strTime = DateTime.Now.ToString("dd/MM/yyyy");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.DateIntl_2:
                strTime = DateTime.Now.ToString("yy/MM/dd");
                break;

            case ProWrite.Core.TimeFormat.DateIntl_2FullYr:
                strTime = DateTime.Now.ToString("yyyy/MM/dd");
                break;

            case ProWrite.Core.TimeFormat.Day_of_Month:
                strTime = DateTime.Now.ToString("dd");    //.Day.ToString();
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Day_of_Week:
                strTime = DateTime.Now.DayOfWeek.ToString();
                break;

            case ProWrite.Core.TimeFormat.Day_of_Week_Abbr:
                strTime = DateTime.Now.DayOfWeek.ToString().Substring(0, 3);
                break;

            case ProWrite.Core.TimeFormat.Hours_12hour:
                strTime = DateTime.Now.ToString("hh");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Hours_24hour:
                strTime = DateTime.Now.ToString("HH");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Minutes:
                strTime = DateTime.Now.ToString("mm");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Month:
                strTime = GetMonth(DateTime.Now.Month);    // DateTime.Now.GetDateTimeFormats()[132].Substring(0, DateTime.Now.GetDateTimeFormats()[132].IndexOf(","));
                break;

            case ProWrite.Core.TimeFormat.Month_Abbr:
                strTime = GetMonth(DateTime.Now.Month).Substring(0, 3);   // DateTime.Now.GetDateTimeFormats()[132].Substring(0, DateTime.Now.GetDateTimeFormats()[132].IndexOf(",")).Substring(0, 3);
                break;

            case ProWrite.Core.TimeFormat.Month_of_Year:
                strTime = DateTime.Now.ToString("MM");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Seconds:
                strTime = DateTime.Now.ToString("ss");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_AMPM:
                strTime = DateTime.Now.ToString("hh:mm tt");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_o_AMPM:
                strTime = DateTime.Now.ToString("hh:mm");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Twelve_hour_time_w_seconds:
                strTime = DateTime.Now.ToString("hh:mm:ss");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Twenty_Four_Hour_Time:
                strTime = DateTime.Now.ToString("HH:mm");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Twenty_Four_hour_time_w_seconds:
                strTime = DateTime.Now.ToString("HH:mm:ss");
                strTime = DeleteZero(strTime);
                break;

            case ProWrite.Core.TimeFormat.Year:
                strTime = DateTime.Now.ToString("yyyy");
                break;

            case ProWrite.Core.TimeFormat.Year_short:
                strTime = DateTime.Now.ToString("yy");
                break;
            }
            return(strTime);
        }