Esempio n. 1
0
        protected override void OnStart()
        {
            Debug.Print(ScreenWidth + " --- " + ScreenHeight);
            // Handle when your app starts
            if (Application.Current.Properties.ContainsKey("stateController"))
            {
                _stateController = LocalStorage.DeserializeFromJson<StateController>(Application.Current.Properties["stateController"].ToString());
            }
                
            if (_stateController == null)
            {
                _stateController = new StateController();

                //Create sections
                _stateController.ArticleController.Sections.Add(new Section("FORSIDE", "finanswatch/content/frontpagearticles?max=30"));
                _stateController.ArticleController.Sections.Add(new Section("PENGEINSTITUTTER", "finanswatch/content/latest?hoursago=500&max=30&section=fw_finansnyt_penge"));
                _stateController.ArticleController.Sections.Add(new Section("FORSIKRINGER", "finanswatch/content/latest?hoursago=500&max=30&section=fw_forsikring"));
                _stateController.ArticleController.Sections.Add(new Section("PENSION", "finanswatch/content/latest?hoursago=500&max=30&section=fw_pension"));
                _stateController.ArticleController.Sections.Add(new Section("REALKREDIT", "finanswatch/content/latest?hoursago=500&max=30&section=fw_finansnyt_real"));
                _stateController.ArticleController.Sections.Add(new Section("NAVNE OG JOB", "finanswatch/content/latest?hoursago=500&max=30&section=fw_finansliv"));
                _stateController.ArticleController.Sections.Add(new Section("KLUMMER", "finanswatch/content/latest?hoursago=500&max=30&section=fw_klumme"));
            }
               
            MainPage = new NavigationPage(new MasterDetailView(_stateController));

            NavigationPage.SetBackButtonTitle(MainPage, "");

            if (App.Navigation == null)
            {
                App.Navigation = MainPage.Navigation;
            }
        }
        public void DeserializeFromJsonShouldReturnEqualObject()
        {
            //arrange
            string str           = "serialize me";
            string strSerialized = LocalStorage.SerializeToJson(str);

            //act
            string strDeserialized = LocalStorage.DeserializeFromJson <string>(strSerialized);

            //assert
            Assert.IsTrue(str.Equals(strDeserialized));
        }