コード例 #1
0
        private AdManager()
        {
            DataTracker = new Tracker();
            DataTracker.RegisterNewDeviceIfNotAlready();

            DownloadCloudAppConfig();
        }
コード例 #2
0
        private AdManager()
        {
            DataTracker = new Tracker(AccountName, KeyValue);
            DataTracker.RegisterNewDeviceIfNotAlready();

            DownloadCloudAppConfig();
            //LoadDefaultCloudAppConfig();
        }
コード例 #3
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            //Retrieves locale of the mobile device
            CurrentCulture = Thread.CurrentThread.CurrentCulture.ToString();
            CurrentUICulture = Thread.CurrentThread.CurrentUICulture.ToString();

            var uris = new[]
            {
                GetThemeSettingsUri()
            };

            LoadResources(uris);

            //Creates an instance of the Diagnostics component.
            diagnostics = new RadDiagnostics();

            //Defines the default email where the diagnostics info will be send.
            diagnostics.EmailTo = "*****@*****.**";

            //Initializes this instance.
            diagnostics.Init();

              //Creates a new instance of the RadRateApplicationReminder component.
            rateReminder = new RadRateApplicationReminder();

            //Sets how often the rate reminder is displayed.
            rateReminder.RecurrencePerUsageCount = 2;

            IsTrackImageLoad = false;
            AppVersion = "";

            DataTracker = new Tracker();
            DataTracker.RegisterNewDeviceIfNotAlready();

            DownloadCloudAppConfig();
            //LoadDefaultCloudAppConfig();

            _analytics = Analytics.GetInstance();
            //_timeLaunch = DateTime.Now;

            //Initialize user config
            var u = MiscHelpers.GetItemFromIsolatedStorage<UserConfigModel>("fbd-userconfig.xml");
            if (u == null)
            {
                u = new UserConfigModel
                    {
                        FetchLanguage = FetchLanguages.en,
                        FontSize = FontSizes.medium,
                        //FacebookLogin = FacebookLoginStatus.Logout,
                        FacebppkAccessToken = String.Empty,
                        IsTutorialRead = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
                    };
                MiscHelpers.SaveDataToIsolatedStorage("fbd-userconfig.xml", u, typeof (UserConfigModel));

                //Set default hometiles and fetch the corrsponding context
                HomePagePinTiles.GetInstance().InitTiles();
            }
            DataFetcher dataFetcher2 = DataFetcher.GetInstance();
            dataFetcher2.FetchCategories(null);

            UserConfig.FetchLanguage = u.FetchLanguage;
            UserConfig.FontSize = u.FontSize;
            //UserConfig.FacebookLogin = u.FacebookLogin;
            //UserConfig.FacebppkAccessToken = u.FacebppkAccessToken;
            App.AccessToken = u.FacebppkAccessToken;
            UserConfig.IsTutorialRead = u.IsTutorialRead;
            if (UserConfig.IsTutorialRead == null)
            {
                u.IsTutorialRead = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
                MiscHelpers.SaveDataToIsolatedStorage("fbd-userconfig.xml", u, typeof(UserConfigModel));
            }

            //Initialize categories config
            DataFetcher fetcher = DataFetcher.GetInstance();
            CategoryConfigA.Config = fetcher.GetCategoryConfig(
                new Uri("CategoryConfig_" + CultureSelector.GetCultureLocale(CurrentUICulture) + ".json", UriKind.Relative)
            );
            CategoryConfigB.Config = fetcher.GetCategoryConfig(
                new Uri("CategoryConfig_" + UserConfig.FetchLanguage + ".json", UriKind.Relative)
            );

            BackgroundWorker bw = new BackgroundWorker();
            bw.WorkerSupportsCancellation = true;
            bw.WorkerReportsProgress = true;
            bw.DoWork += delegate
            {
                //Initial file management
                //FileHelper.RemoveAllFeedBoardFiles();
                //Removed all feedboard cache files
                FileHelper.RemoveFeedBoardCaches();
                FileHelper.RemoveRedundantFeedBoardFiles();
                //FileHelper.ViewFiles();

                //Prefetcher
                DataFetcher dataFetcher = DataFetcher.GetInstance();
                dataFetcher.PreFetch();
            };
            bw.RunWorkerAsync();

            //Background agent
            BackgroundAgent b = new BackgroundAgent();
            //b.StartPeriodicAgent();
            b.StartResourceIntensiveAgent();
        }
コード例 #4
0
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (System.Diagnostics.Debugger.IsAttached) {
                // Display the current frame rate counters.
                Application.Current.Host.Settings.EnableFrameRateCounter = true;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }

            //Creates an instance of the Diagnostics component.
            diagnostics = new RadDiagnostics();

            //Defines the default email where the diagnostics info will be send.
            diagnostics.EmailTo = "*****@*****.**";

            //Initializes this instance.
            diagnostics.Init();

            //Creates a new instance of the RadRateApplicationReminder component.
            rateReminder = new RadRateApplicationReminder();

            //Sets how often the rate reminder is displayed.
            rateReminder.RecurrencePerUsageCount = 3;

            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;

            RootFrame.Obscured += Application_Obscured;
            RootFrame.Unobscured += Application_UnObscured;

            CurrentCulture = Thread.CurrentThread.CurrentCulture.ToString();
            CurrentUICulture = Thread.CurrentThread.CurrentUICulture.ToString();
            DataTracker = new Tracker();
            DataTracker.RegisterNewDeviceIfNotAlready();

            DownloadCloudAppConfig();
            //LoadDefaultCloudAppConfig();
            LoadLocalizedResource();
        }