Exemplo n.º 1
0
        private void OnDateChanged(DateTimeValue x)
        {
            HasValue = true;

            DateTime date = DateTime.Now;

            if (x is PersianDateValue)
            {
                date = Persian.ToDateTime();
            }
            else if (x is GregorianDateValue)
            {
                date = Gregorian.ToDateTime();
            }
            else if (x is HebrewDateValue)
            {
                date = Hebrew.ToDateTime();
            }
            else if (x is HijriDateValue)
            {
                date = Hijri.ToDateTime();
            }
            else if (x is JulianDateValue)
            {
                date = Julian.ToDateTime();
            }
            else if (x is KoreanDateValue)
            {
                date = Korean.ToDateTime();
            }
            else if (x is JapaneseDateValue)
            {
                date = Japanese.ToDateTime();
            }
            else if (x is TaiwanDateValue)
            {
                date = Taiwan.ToDateTime();
            }
            else if (x is KoreanLunisolarDateValue)
            {
                date = KoreanLunisolar.ToDateTime();
            }
            else if (x is JapaneseLunisolarDateValue)
            {
                date = JapaneseLunisolar.ToDateTime();
            }
            else if (x is TaiwanLunisolarDateValue)
            {
                date = TaiwanLunisolar.ToDateTime();
            }
            else if (x is ChineseLunisolarDateValue)
            {
                date = ChineseLunisolar.ToDateTime();
            }

            if (persian != null && !(x is PersianDateValue))
            {
                Persian.DateChanged -= OnDateChanged;
                Persian.Read(date);
            }

            if (gregorian != null && !(x is GregorianDateValue))
            {
                Gregorian.DateChanged -= OnDateChanged;
                Gregorian.Read(date);
            }
            if (julian != null && !(x is JulianDateValue))
            {
                Julian.DateChanged -= OnDateChanged;
                Julian.Read(date);
            }
            if (hebrew != null && !(x is HebrewDateValue))
            {
                Hebrew.DateChanged -= OnDateChanged;
                Hebrew.Read(date);
            }
            if (hijri != null && !(x is HijriDateValue))
            {
                Hijri.DateChanged -= OnDateChanged;
                Hijri.Read(date);
            }
            if (korean != null && !(x is KoreanDateValue))
            {
                Korean.DateChanged -= OnDateChanged;
                Korean.Read(date);
            }
            if (japanese != null && !(x is JapaneseDateValue))
            {
                Japanese.DateChanged -= OnDateChanged;
                Japanese.Read(date);
            }
            if (taiwan != null && !(x is TaiwanDateValue))
            {
                Taiwan.DateChanged -= OnDateChanged;
                Taiwan.Read(date);
            }
            if (koreanLunisolar != null && !(x is KoreanLunisolarDateValue))
            {
                KoreanLunisolar.DateChanged -= OnDateChanged;
                KoreanLunisolar.Read(date);
            }
            if (japaneseLunisolar != null && !(x is JapaneseLunisolarDateValue))
            {
                JapaneseLunisolar.DateChanged -= OnDateChanged;
                JapaneseLunisolar.Read(date);
            }
            if (taiwanLunisolar != null && !(x is TaiwanLunisolarDateValue))
            {
                TaiwanLunisolar.DateChanged -= OnDateChanged;
                TaiwanLunisolar.Read(date);
            }
            if (chineseLunisolar != null && !(x is ChineseLunisolarDateValue))
            {
                ChineseLunisolar.DateChanged -= OnDateChanged;
                ChineseLunisolar.Read(date);
            }

            if (persian != null && !(x is PersianDateValue))
            {
                Persian.DateChanged += OnDateChanged;
            }

            if (gregorian != null && !(x is GregorianDateValue))
            {
                Gregorian.DateChanged += OnDateChanged;
            }

            if (julian != null && !(x is JulianDateValue))
            {
                Julian.DateChanged += OnDateChanged;
            }

            if (hebrew != null && !(x is HebrewDateValue))
            {
                Hebrew.DateChanged += OnDateChanged;
            }

            if (hijri != null && !(x is HijriDateValue))
            {
                Hijri.DateChanged += OnDateChanged;
            }

            if (korean != null && !(x is KoreanDateValue))
            {
                Korean.DateChanged += OnDateChanged;
            }

            if (japanese != null && !(x is JapaneseDateValue))
            {
                Japanese.DateChanged += OnDateChanged;
            }

            if (taiwan != null && !(x is TaiwanDateValue))
            {
                Taiwan.DateChanged += OnDateChanged;
            }

            if (koreanLunisolar != null && !(x is KoreanLunisolarDateValue))
            {
                KoreanLunisolar.DateChanged += OnDateChanged;
            }

            if (japaneseLunisolar != null && !(x is JapaneseLunisolarDateValue))
            {
                JapaneseLunisolar.DateChanged += OnDateChanged;
            }

            if (taiwanLunisolar != null && !(x is TaiwanLunisolarDateValue))
            {
                TaiwanLunisolar.DateChanged += OnDateChanged;
            }

            if (chineseLunisolar != null && !(x is ChineseLunisolarDateValue))
            {
                ChineseLunisolar.DateChanged += OnDateChanged;
            }
        }
Exemplo n.º 2
0
 private void initExclusive(DateTimeValue dateValue)
 {
     if (!(dateValue is GregorianDateValue) && gregorian != null)
     {
         dateValue.Read(gregorian.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is PersianDateValue) && persian != null)
     {
         dateValue.Read(persian.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is HijriDateValue) && hijri != null)
     {
         dateValue.Read(hijri.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is HebrewDateValue) && hebrew != null)
     {
         dateValue.Read(hebrew.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is JulianDateValue) && julian != null)
     {
         dateValue.Read(julian.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is KoreanDateValue) && korean != null)
     {
         dateValue.Read(korean.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is JapaneseDateValue) && japanese != null)
     {
         dateValue.Read(japanese.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is TaiwanDateValue) && taiwan != null)
     {
         dateValue.Read(taiwan.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is KoreanLunisolarDateValue) && koreanLunisolar != null)
     {
         dateValue.Read(koreanLunisolar.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is JapaneseLunisolarDateValue) && japaneseLunisolar != null)
     {
         dateValue.Read(japaneseLunisolar.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is TaiwanLunisolarDateValue) && taiwanLunisolar != null)
     {
         dateValue.Read(taiwanLunisolar.ToDateTime());
         HasValue = true;
         return;
     }
     if (!(dateValue is ChineseLunisolarDateValue) && chineseLunisolar != null)
     {
         dateValue.Read(chineseLunisolar.ToDateTime());
         HasValue = true;
         return;
     }
 }