Beispiel #1
0
        private void SetCulture()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            if (JsRuntime is IJSInProcessRuntime)
            {
                culture = CultureInfo.DefaultThreadCurrentCulture ?? Thread.CurrentThread.CurrentCulture;
                if (!(culture.Calendar is GregorianCalendar))
                {
                    culture.DateTimeFormat = CultureInfo.InvariantCulture.DateTimeFormat;
                }
            }
            Intl.SetCulture(culture);
        }
Beispiel #2
0
        public static string GetFormattedValue(object value, string format)
        {
            List <string> source = new List <string>()
            {
                "Double",
                "Int64",
                "Int32",
                "Int16",
                "Decimal",
                "Single"
            };

            if (value?.GetType().Name == "DateTime" || value?.GetType().Name == "DateTimeOffset")
            {
                return(Intl.GetDateFormat <object>(value, format));
            }
            return(value != null && source.Any <string>((Func <string, bool>)(t => value.GetType().Name.Contains(t))) ? Intl.GetNumericFormat <object>(value, format) : (string)value);
        }
        public void TestGetDefaultMacroSheetInternationalized()
        {
            Intl manuallyCreatedIntlRecord = new Intl();

            byte[] intlBytes = manuallyCreatedIntlRecord.GetBytes();

            BiffRecord rec = new BiffRecord(intlBytes);

            Intl convertedRecord = rec.AsRecordType <Intl>();

            Assert.AreEqual(convertedRecord.GetBytes(), manuallyCreatedIntlRecord.GetBytes());

            WorkbookStream    wbs          = TestHelpers.GetDefaultMacroTemplate();
            List <BiffRecord> sheetRecords = wbs.GetRecordsForBOFRecord(wbs.GetAllRecordsByType <BOF>().Last());

            WorkbookStream internationalWbs = new WorkbookStream(sheetRecords);
            var            intlRecord       = new Intl();

            internationalWbs = internationalWbs.InsertRecord(intlRecord, internationalWbs.GetAllRecordsByType <b2xtranslator.Spreadsheet.XlsFileFormat.Records.Index>().First());
            Assert.IsTrue(internationalWbs.ContainsRecord(intlRecord));
            var nextRecord = internationalWbs.Records.SkipWhile(r => r.Id != RecordType.Intl).Skip(1).Take(1).First();

            Assert.IsTrue(nextRecord.Id == RecordType.CalcMode);
        }
        public IFacebookApi Initialize(IFacebookSession session)
        {
            AuthToken = string.Empty;

            #if !SILVERLIGHT
            InstalledCulture = CultureInfo.InstalledUICulture;
            #else
            InstalledCulture = CultureInfo.CurrentUICulture;
            #endif

            Session = session;

            Auth = new Auth(Session);
            Video = new Video(Session);
            Marketplace = new Marketplace(Session);
            Admin = new Admin(Session);
            Photos = new Photos(Session);
            Users = new Users(Session);
            Friends = new Friends(Users, Session);
            Events = new Events(Session);
            Groups = new Groups(Session);
            Notifications = new Notifications(Session);
            Profile = new Profile(Session);
            Fbml = new Fbml(Session);
            Feed = new Feed(Session);
            Fql = new Fql(Session);
            LiveMessage = new LiveMessage(Session);
            Message = new Message(Session);
            Batch = new Batch(Session);
            Pages = new Pages(Session);
            Application = new Application(Session);
            Data = new Data(Session);
            Permissions = new Permissions(Session);
            Connect = new Connect(Session);
            Comments = new Comments(Session);
            Stream = new Stream(Session);
            Status = new Status(Session);
            Links = new Links(Session);
            Notes = new Notes(Session);
            Intl = new Intl(Session);

            Batch.Batch = Batch;
            Permissions.Permissions = Permissions;
            Batch.Permissions = Permissions;
            Permissions.Batch = Batch;

            foreach (IRestBase restBase in new IRestBase[] {Auth, Video, Marketplace, Admin, Photos, Users, Friends, Events,
                Groups, Notifications, Profile, Fbml, Feed, Fql, LiveMessage, Message, Pages, Application, Data, Connect, Comments,
                Stream, Status, Links, Notes})
            {
                restBase.Batch = Batch;
                restBase.Permissions = Permissions;
            }

            return this;
        }