Ejemplo n.º 1
0
        public AboutPage()
        {
            InitializeComponent();

            _webConfig = ((App)Application.Current).WebConfig;

            TitleTextBlock.Text = _webConfig.Settings.Title;
            HeaderTextBlock.Text = _webConfig.Settings.Header;

            Visibility darkBackgroundVisibility =
                    (Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"];

            // Write the theme background value.
            if (darkBackgroundVisibility == Visibility.Visible)
            {
                AboutBrowser.Background = new SolidColorBrush(Colors.Black);
            }
            else
            {
                AboutBrowser.Background = new SolidColorBrush(Colors.White);
            }
            AboutBrowser.Visibility = System.Windows.Visibility.Collapsed;
            AboutBrowser.Navigated += AboutBrowser_Navigated;
            AboutBrowser.LoadCompleted += AboutBrowser_LoadCompleted;
        }
Ejemplo n.º 2
0
        private async Task LoadConfig()
        {
            // Get a file from the installation folder with the ms-appx URI scheme.
            var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Config/config.json"));

            using (Stream stream = await file.OpenStreamForReadAsync())
            {
                using (StreamReader sr = new StreamReader(stream))
                {
                    string configJSON = sr.ReadToEnd();
                    _webConfig = WebConfig.CreateConfig(configJSON);
                }
            }
        }
Ejemplo n.º 3
0
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            Browser.Width = Application.Current.Host.Content.ActualWidth;

            // Overlay
            this.popup = new Popup();
            LayoutRoot.Children.Add(popup);

            overlay = new site2App.WP8.Overlay();
            this.popup.Child = overlay;

            _webConfig = ((App)Application.Current).WebConfig;

            // Handle orientation changes
            OrientationChanged += MainPage_OrientationChanged;

            PhoneApplicationService.Current.Activated += Current_Activated;
            PhoneApplicationService.Current.Deactivated += Current_Deactivated;
            PhoneApplicationService.Current.Closing += Current_Closing;

            try
            {
                _currentUrl = (Uri)(userSettings["deactivatedUrl"]);
            }
            catch (System.Collections.Generic.KeyNotFoundException)
            {
            }
            catch (Exception exn)
            {
                Debug.WriteLine(exn.ToString());
            }
        }
Ejemplo n.º 4
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            if (_webConfig == null)
            {
                if (((App)Application.Current).WebConfig == null)
                    await ((App)Application.Current).ManualConfigLoad();

                _webConfig = ((App)Application.Current).WebConfig;
            }

            if (_webConfig != null)
            {
                BuildLocalizedApplicationBar();
            }

            if (e.NavigationMode == NavigationMode.Back)
            {
                // Navigated back from backstack, use the current page
            }
            else if (_currentUrl != null && e.NavigationMode != NavigationMode.Reset)
            {
                Browser.Navigate(_currentUrl);
            }
            else
            {
                if (_webConfig.MobileURLString != "" && Uri.IsWellFormedUriString(_webConfig.MobileURLString, UriKind.Absolute))
                {
                    Browser.Navigate(_webConfig.MobileBaseURL);
                }
                else if (Uri.IsWellFormedUriString(_webConfig.BaseURLString, UriKind.Absolute))
                {
                    Browser.Navigate(_webConfig.BaseURL);
                }
            }
        }
Ejemplo n.º 5
0
 public static string CreateJson(WebConfig config)
 {
     return(JsonConvert.SerializeObject(config));
 }
Ejemplo n.º 6
0
 public static string CreateJson(WebConfig config)
 {
     return JsonConvert.SerializeObject(config);
 }