Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            // If these are not used the ToString for DateTime throws an exception in some cultures
            // For more information: https://forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale
            var c1  = new System.Globalization.ChineseLunisolarCalendar();
            var c2  = new System.Globalization.GregorianCalendar();
            var c3  = new System.Globalization.HebrewCalendar();
            var c4  = new System.Globalization.HijriCalendar();
            var c5  = new System.Globalization.JapaneseCalendar();
            var c6  = new System.Globalization.JapaneseLunisolarCalendar();
            var c7  = new System.Globalization.JulianCalendar();
            var c8  = new System.Globalization.KoreanCalendar();
            var c9  = new System.Globalization.KoreanLunisolarCalendar();
            var c10 = new System.Globalization.PersianCalendar();
            var c11 = new System.Globalization.TaiwanCalendar();
            var c12 = new System.Globalization.TaiwanLunisolarCalendar();
            var c13 = new System.Globalization.ThaiBuddhistCalendar();
            var c14 = new System.Globalization.UmAlQuraCalendar();

            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.SetVmPolicy(builder.Build());

            base.OnCreate(bundle);

            CrossCurrentActivity.Current.Init(this, bundle);
            PermissionsHelper.Activity = this;

            this.SetTheme(Resource.Style.Theme_Design_Light);

            //CachedImageRenderer.Init(false);
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(false);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // If these are not used the ToString for DateTime throws an exception in some cultures
            // For more information: https://forums.xamarin.com/discussion/42899/datetime-tostring-throws-argumentoutofrangeexception-in-thai-locale
            var c1  = new System.Globalization.ChineseLunisolarCalendar();
            var c2  = new System.Globalization.GregorianCalendar();
            var c3  = new System.Globalization.HebrewCalendar();
            var c4  = new System.Globalization.HijriCalendar();
            var c5  = new System.Globalization.JapaneseCalendar();
            var c6  = new System.Globalization.JapaneseLunisolarCalendar();
            var c7  = new System.Globalization.JulianCalendar();
            var c8  = new System.Globalization.KoreanCalendar();
            var c9  = new System.Globalization.KoreanLunisolarCalendar();
            var c10 = new System.Globalization.PersianCalendar();
            var c11 = new System.Globalization.TaiwanCalendar();
            var c12 = new System.Globalization.TaiwanLunisolarCalendar();
            var c13 = new System.Globalization.ThaiBuddhistCalendar();
            var c14 = new System.Globalization.UmAlQuraCalendar();

            AnalyticsHelper.Initialize(Xamarin.Forms.Device.iOS);

            global::Xamarin.Forms.Forms.Init();

            CachedImageRenderer.Init();

            LoadApplication(new App());

            UITextField.Appearance.TintColor = Xamarin.Forms.Color.FromHex("#2548D8").ToUIColor();
#if __TESTS__
            Xamarin.Calabash.Start();
#endif
            return(base.FinishedLaunching(app, options));
        }
Пример #3
0
        public void CorrectArgumentsPassed_ReturnedCorrectRrn()
        {
            var now           = DateTime.Today;
            var yearLastDigit = now.Year % 10;
            var julianDate    = new System.Globalization.JulianCalendar()
                                .ToDateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second,
                                            now.Millisecond).DayOfYear.ToString().PadLeft(3, '0');
            var uniqueInterfaceId = "00";
            var result            = yearLastDigit + julianDate + uniqueInterfaceId + "123456";

            RetRefNumberGenerator rrn = new RetRefNumberGenerator("123456");

            Assert.AreEqual(result, rrn.GenerateUniqueNumber(DateTime.Today));
        }
        public string GenerateUniqueNumber(DateTime now, string uniqueNumber)
        {
            const string uniqueInterfaceId = "00";

            if (uniqueNumber.ToString().Length != 6)
            {
                var result = "Passed argument does not satisfy requirements for RRN generation.";
                return(result);
            }

            var yearLastDigit = now.Year % 10;

            var julianDate = new System.Globalization.JulianCalendar()
                             .ToDateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second,
                                         now.Millisecond).DayOfYear.ToString().PadLeft(3, '0');

            var sixDigits = uniqueNumber;

            return(yearLastDigit + julianDate + uniqueInterfaceId + sixDigits);
        }
 private int GetJulianMonthFromJulianDay(int yr, int mo, int d)
 {
     //System.Globalization.GregorianCalendar gc = new System.Globalization.GregorianCalendar();
     System.Globalization.JulianCalendar jc = new System.Globalization.JulianCalendar();
     return jc.GetMonth(new DateTime(yr,mo,d,jc));
 }
Пример #6
0
 private int GetJulianMonthFromJulianDay(int yr, int mo, int d)
 {
     System.Globalization.JulianCalendar jc = new System.Globalization.JulianCalendar();
     return(jc.GetMonth(new DateTime(yr, mo, d, jc)));
 }