Ejemplo n.º 1
0
 public Activity()
 {
     this.InitializeComponent();
     StatusBar.GetForCurrentView().BackgroundColor = Windows.UI.Color.FromArgb(1, 67, 197, 144);
 }
Ejemplo n.º 2
0
        private async void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            try
            {
                // BLogger.Logger.Info("Loading frame started...");
                Frame rootFrame = Window.Current.Content as Frame;

                var vm = App.Current.Resources["AlbumArtistVM"];
                // Do not repeat app initialization when the Window already has content
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context
                    rootFrame = new Frame();
                    // BLogger.Logger.Info("New frame created.");
                    //if (args.PreviousExecutionState == ApplicationExecutionState.Suspended)
                    //{
                    //    //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                    //    //TODO: Load state from previously suspended application
                    //}

                    rootFrame.NavigationFailed += OnNavigationFailed;
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;

                    BLogger.Logger.Info("Content set to Window successfully...");
                }
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    BLogger.Logger.Info("Navigating to Shell...");
                    rootFrame.Navigate(typeof(Shell), arguments);
                }

                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(360, 100));
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    BLogger.Logger.Info("Trying to hide status bar.");
                    await StatusBar.GetForCurrentView().HideAsync();

                    BLogger.Logger.Info("Status bar hidden.");
                }
                else
                {
                    CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
                    coreTitleBar.ExtendViewIntoTitleBar = true;
                }
                if (args.Kind != ActivationKind.File)
                {
                    CoreWindowLogic.LoadSettings();
                }
                else
                {
                    CoreWindowLogic.LoadSettings(true);
                }
                Window.Current.Activate();
            }
            catch (Exception ex)
            {
                BLogger.Logger?.Info("Exception occured in LoadFrame Method", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 在应用程序由最终用户正常启动时进行调用。
        /// 将在启动应用程序以打开特定文件等情况下使用。
        /// </summary>
        /// <param name="e">有关启动请求和过程的详细信息。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar")) //手机状态栏
            {
                StatusBar statusBar = StatusBar.GetForCurrentView();
                statusBar.BackgroundOpacity = 1;
                statusBar.BackgroundColor   = Color.FromArgb(100, 58, 177, 181); //标题栏背景色
                statusBar.ForegroundColor   = Colors.White;                      //标题栏前景色
            }
            else //PC状态栏
            {
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.BackgroundColor            = Color.FromArgb(100, 43, 160, 164); //标题栏背景色
                titleBar.ForegroundColor            = Colors.White;                      //标题栏前景色
                titleBar.ButtonHoverBackgroundColor = Color.FromArgb(100, 43, 160, 164); //鼠标悬浮在三键上时的颜色
                titleBar.ButtonBackgroundColor      = Color.FromArgb(100, 43, 160, 164); //三键背景色
                titleBar.ButtonForegroundColor      = Colors.White;
            }

            if (appdata.Values.ContainsKey("Open_Weather"))//判断是否设置了刷呀天气的使用或关闭
            {
                open_weather = (int)appdata.Values["Open_Weather"];
            }

            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif
            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // 当导航堆栈尚未还原时,导航到第一页,
                    // 并通过将所需信息作为导航参数传入来配置
                    // 参数
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }
                // 确保当前窗口处于活动状态
                Window.Current.Activate();
            }
        }
Ejemplo n.º 4
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     progressbar = StatusBar.GetForCurrentView().ProgressIndicator;
     this.navigationHelper.OnNavigatedTo(e);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

                //Xamarin.Forms.DependencyService.Register<XamarinFormsToast>();

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.ButtonBackgroundColor = Colors.DarkGray;
                    titleBar.ButtonForegroundColor = Colors.White;
                    titleBar.BackgroundColor       = Colors.Black;
                    titleBar.ForegroundColor       = Colors.White;
                }
            }

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundOpacity = 1;
                    statusBar.BackgroundColor   = Colors.Black;
                    statusBar.ForegroundColor   = Colors.White;
                }
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 6
0
        public MainPage()
        {
            this.InitializeComponent();

            ApplicationDataContainer AppSettings = ApplicationData.Current.LocalSettings;

            if (AppSettings.Values.ContainsKey("tsLett"))
            {
                tsLett.IsOn = (bool)AppSettings.Values["tsLett"];
            }
            if (AppSettings.Values.ContainsKey("tsNumb"))
            {
                tsNumb.IsOn = (bool)AppSettings.Values["tsNumb"];
            }
            if (AppSettings.Values.ContainsKey("tsSymb"))
            {
                tsSymb.IsOn = (bool)AppSettings.Values["tsSymb"];
            }
            if (AppSettings.Values.ContainsKey("tsSimi"))
            {
                tsSimi.IsOn = (bool)AppSettings.Values["tsSimi"];
            }
            if (AppSettings.Values.ContainsKey("sLeng"))
            {
                sLeng.Value = (double)AppSettings.Values["sLeng"];
            }

            string deviceFamilyVersion = AnalyticsInfo.VersionInfo.DeviceFamilyVersion;
            ulong  osVersion           = ulong.Parse(deviceFamilyVersion);
            int    build = Convert.ToInt32((osVersion & 0x00000000FFFF0000L) >> 16);

            if (build >= 16299)
            {
                bgMain.Background = Resources["SystemControlAccentAcrylicWindowAccentMediumHighBrush"] as Brush;
            }

            var colorBar = Application.Current.Resources["SystemControlForegroundAccentBrush"] as SolidColorBrush;

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundColor   = colorBar.Color;
                    statusBar.BackgroundOpacity = 1;
                }
            }
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;

                if (titleBar != null && ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase") && build >= 16299)
                {
                    CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                    titleBar.ButtonBackgroundColor         = Colors.Transparent;
                    titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                }
                else if (titleBar != null && ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.XamlCompositionBrushBase"))
                {
                    titleBar.ButtonBackgroundColor = colorBar.Color;
                    titleBar.BackgroundColor       = colorBar.Color;
                }
            }
            Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().IsScreenCaptureEnabled = false;
        }
Ejemplo n.º 7
0
        // When page is navigated to set data context to selected item in list
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            await ViewModel.Initialize();

            BuildLocalizedMenu();
            BuildContextMenu();
            UpdateAudioControls(ViewModel.AudioPlayerState);

            // Hide status bar
            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
            {
                var statusBar = StatusBar.GetForCurrentView();
                await statusBar.HideAsync();
            }

            NavigationData parameters = e.Parameter as NavigationData;

            if (parameters == null)
            {
                parameters = new NavigationData();
            }

            ViewModel.CurrentPageNumber = SettingsUtils.Get <int>(Constants.PREF_LAST_PAGE);

            //Monitor property changes
            ViewModel.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "CurrentPageIndex")
                {
                    if (ViewModel.CurrentPageIndex != -1)
                    {
                        radSlideView.SelectedItem = ViewModel.Pages[ViewModel.CurrentPageIndex];
                    }
                }
                if (args.PropertyName == "AudioPlayerState")
                {
                    UpdateAudioControls(ViewModel.AudioPlayerState);
                }
                if (args.PropertyName == "CurrentPageBookmarked")
                {
                    SetBookmarkNavigationLink();
                }
            };

            //Try extract translation from query
            var translation = SettingsUtils.Get <string>(Constants.PREF_ACTIVE_TRANSLATION);

            if (!string.IsNullOrEmpty(translation))
            {
                if (ViewModel.TranslationFile != translation.Split('|')[0] ||
                    ViewModel.ShowTranslation != SettingsUtils.Get <bool>(Constants.PREF_SHOW_TRANSLATION) ||
                    ViewModel.ShowArabicInTranslation != SettingsUtils.Get <bool>(Constants.PREF_SHOW_ARABIC_IN_TRANSLATION))
                {
                    ViewModel.Pages.Clear();
                }
                ViewModel.TranslationFile = translation.Split('|')[0];
                if (await ViewModel.HasTranslationFile())
                {
                    ViewModel.ShowTranslation = SettingsUtils.Get <bool>(Constants.PREF_SHOW_TRANSLATION);
                }
                else
                {
                    ViewModel.ShowTranslation = false;
                }
                ViewModel.ShowArabicInTranslation = SettingsUtils.Get <bool>(Constants.PREF_SHOW_ARABIC_IN_TRANSLATION);
            }
            else
            {
                ViewModel.TranslationFile         = null;
                ViewModel.ShowTranslation         = false;
                ViewModel.ShowArabicInTranslation = false;
            }

            // set KeepInfoOverlay according to setting
            ViewModel.KeepInfoOverlay = SettingsUtils.Get <bool>(Constants.PREF_KEEP_INFO_OVERLAY);

            //Select ayah
            if (parameters.Surah != null && parameters.Ayah != null)
            {
                ViewModel.SelectedAyah = new QuranAyah(parameters.Surah.Value, parameters.Ayah.Value);
            }
            else
            {
                ViewModel.SelectedAyah = null;
            }

            // Listen to share requests
            _dataTransferManager = DataTransferManager.GetForCurrentView();
            _dataTransferManager.DataRequested += DataShareRequested;
        }
Ejemplo n.º 8
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            firstContentPresenter = GetTemplateChild("FirstContentPresenter") as ContentControl;
            if (firstContentPresenter != null)
            {
                appFrame = firstContentPresenter.Content as Frame;
            }

            loadMenuAndBar(true);
            appFrame.Navigated += (sender, e) => loadMenuAndBar();

            topBar     = GetTemplateChild("TopBar") as ContentControl;
            topBarGrid = GetTemplateChild("TopBarGrid") as Grid;
            menu       = GetTemplateChild("Menu") as ContentControl;

            menuButton         = GetTemplateChild("MenuButton") as Border;
            menuButton.Tapped += (sender, e) =>
            {
                if (isMenuOpened)
                {
                    CloseMenu();
                }
                else
                {
                    OpenMenu();
                }
            };

            mainGrid = GetTemplateChild("MainGrid") as Grid;

            var view = ApplicationView.GetForCurrentView();

            if (view != null && view.DesiredBoundsMode != ApplicationViewBoundsMode.UseCoreWindow)
            {
                view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
            }

            var statusBar = StatusBar.GetForCurrentView();

            if (statusBar != null)
            {
                statusBar.BackgroundColor = new Color()
                {
                    R = 0, G = 0, B = 0
                };
                statusBar.ForegroundColor = new Color()
                {
                    R = 255, G = 255, B = 255
                };
                statusBar.BackgroundOpacity = 0;
            }

            gestureHandler();
            if (onApplyTemplate != null)
            {
                onApplyTemplate(this, new EventArgs());
            }

            DisplayInformation.GetForCurrentView().OrientationChanged += FrameContainer_OrientationChanged;
        }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            if (e.PrelaunchActivated)
            {
                return;
            }

            // Initialize the constant for the app display name, used for tile and toast previews
            if (Constants.ApplicationDisplayName == null)
            {
                Constants.ApplicationDisplayName = (await Package.Current.GetAppListEntriesAsync())[0].DisplayInfo.DisplayName;
            }

            // Set title bar colors
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                var   titleBar       = ApplicationView.GetForCurrentView().TitleBar;
                Color blueBrush      = default(Color);
                Color lightGreyBrush = default(Color);
                Color greyBrush03    = default(Color);
                Color greyBrush01    = default(Color);
                blueBrush      = (Color)Resources["Blue-01"];
                lightGreyBrush = (Color)Resources["Grey-04"];
                greyBrush03    = (Color)Resources["Grey-03"];
                greyBrush01    = (Color)Resources["Grey-01"];

                if (titleBar != null)
                {
                    titleBar.ButtonBackgroundColor = greyBrush03;
                    titleBar.ButtonForegroundColor = lightGreyBrush;
                    titleBar.BackgroundColor       = greyBrush01;
                    titleBar.ForegroundColor       = lightGreyBrush;
                }
            }

            DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait | DisplayOrientations.PortraitFlipped;

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    rootFrame.Navigate(typeof(Shell), e.Arguments);
                }

                // Status bar
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") &&
                    ApiInformation.IsMethodPresent("Windows.UI.ViewManagement.StatusBar", nameof(StatusBar.HideAsync)))
                {
                    StatusBar statusBar = StatusBar.GetForCurrentView();

                    // Hide the status bar
                    await statusBar.HideAsync();
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Ejemplo n.º 10
0
 public static async Task Show()
 {
     StatusBar sB = StatusBar.GetForCurrentView();
     await sB.ShowAsync();
 }
Ejemplo n.º 11
0
        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            var keys = PageKeys <Pages>();

            keys.TryAdd(Pages.History, typeof(HistoryPage));
            keys.TryAdd(Pages.Home, typeof(HomePage));
            keys.TryAdd(Pages.Master, typeof(MasterPage));
            keys.TryAdd(Pages.Saved, typeof(SavedPage));
            keys.TryAdd(Pages.Search, typeof(SearchPage));
            keys.TryAdd(Pages.Settings, typeof(SettingsPage));
            keys.TryAdd(Pages.Trending, typeof(TrendingPage));
            keys.TryAdd(Pages.Video, typeof(VideoPage));

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;

            var display = DisplayInformation.GetForCurrentView();

            display.OrientationChanged += OnDisplayOrientationChanged;

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.BackgroundColor = "#0000".ToColor();
                    titleBar.ForegroundColor = "#FFF".ToColor();

                    titleBar.InactiveBackgroundColor = "#0000".ToColor();
                    titleBar.InactiveForegroundColor = "#FFF".ToColor();

                    titleBar.ButtonBackgroundColor = "#0000".ToColor();
                    titleBar.ButtonForegroundColor = "#FFF".ToColor();

                    titleBar.ButtonHoverBackgroundColor = "#19FFFFFF".ToColor();
                    titleBar.ButtonHoverForegroundColor = "#FFF".ToColor();

                    titleBar.ButtonPressedBackgroundColor = "#33FFFFFF".ToColor();
                    titleBar.ButtonPressedForegroundColor = "#FFF".ToColor();

                    titleBar.ButtonInactiveBackgroundColor = "#0000".ToColor();
                    titleBar.ButtonInactiveForegroundColor = "#FFF".ToColor();
                }
            }

            var statusBarHideTask = Task.CompletedTask;

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundOpacity = 0;

                    statusBar.ForegroundColor = "#B2FFFFFF".ToColor();

                    if (display.CurrentOrientation == DisplayOrientations.Landscape || display.CurrentOrientation == DisplayOrientations.LandscapeFlipped)
                    {
                        statusBarHideTask = statusBar.HideAsync().AsTask();
                    }
                }
            }

            RegisterBackgroundTask();

            await statusBarHideTask;
        }
Ejemplo n.º 12
0
 public static async Task Hide()
 {
     StatusBar sB = StatusBar.GetForCurrentView();
     await sB.HideAsync();
 }
Ejemplo n.º 13
0
        private async void Page_Loaded(object sender, RoutedEventArgs e)
        {
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Landscape;
                await StatusBar.GetForCurrentView().HideAsync();
            }
            else
            {
                WindowManager.HandleTitleBarForControl(topGrid);
            }

            if (_model.StorageFile == null)
            {
                await UIUtilities.ShowErrorDialogAsync(_strings.GetString("CannotEditClipTitle"), _strings.GetString("CannotEditClipMessage"));

                Close();
                return;
            }

            if (_model.Composition == null)
            {
                _createdNew = true;

                var name = Path.ChangeExtension(_model.StorageFile.Name, "uni-cmp");
                try
                {
                    _model.CompositionFile = _model.CompositionFile ?? await ApplicationData.Current.LocalFolder.GetFileAsync(name);

                    if (await UIUtilities.ShowYesNoDialogAsync(_strings.GetString("LoadPreviousEditsTitle"), _strings.GetString("LoadPreviousEditsMessage")))
                    {
                        _model.Composition = await MediaComposition.LoadAsync(_model.CompositionFile);
                    }
                    else
                    {
                        _model.Composition = new MediaComposition();
                    }
                }
                catch
                {
                    _model.Composition = new MediaComposition();
                }
            }

            if (_model.Composition.Clips.Count == 0)
            {
                var clip = await MediaClip.CreateFromFileAsync(_model.StorageFile);

                _model.Composition.Clips.Add(clip);
                _model.Clip = clip;
            }
            else
            {
                _model.Clip = _model.Composition.Clips.First();
            }

            rangeSelector.Maximum  = _model.Clip.OriginalDuration.TotalSeconds;
            rangeSelector.RangeMin = _model.Clip.TrimTimeFromStart.TotalSeconds;
            rangeSelector.RangeMax = _model.Clip.OriginalDuration.TotalSeconds - _model.Clip.TrimTimeFromEnd.TotalSeconds;
            rangeSelector.Value    = rangeSelector.RangeMin;
            startPointText.Text    = _model.Clip.TrimTimeFromStart.ToString("mm\\:ss");
            endPointText.Text      = (_model.Clip.OriginalDuration - _model.Clip.TrimTimeFromEnd).ToString("mm\\:ss");

            _ready = true;
            UpdateMediaElementSource();
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected async override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            // enable if desired...
            //if (Debugger.IsAttached)
            //{
            //    DebugSettings.EnableFrameRateCounter = true;
            //}
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // hide windows phone status bar
                if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    await statusBar.HideAsync();
                }

                // change color of uwp title bar
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
                {
                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    if (titleBar != null)
                    {
                        var desiredColor = Color.FromArgb(255, 00, 96, 180); // deep blue
                        titleBar.BackgroundColor       = desiredColor;
                        titleBar.ButtonBackgroundColor = desiredColor;
                        titleBar.ForegroundColor       = Colors.White;
                        titleBar.ButtonForegroundColor = Colors.White;
                    }
                }

                Initialize(); // initiliaze Caliburn.Micro
                Xamarin.Forms.Forms.Init(e, RendererAssemblies());
                // TODO: Initialize other xamarin.form 3rd party components

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // TODO: Create an appropriate data model for your problem domain to replace the sample data
            //var sampleDataGroup = await SampleDataSource.GetGroupAsync("Group-4");

            //Task<Session> LoginTask = null;
            Task LoadingIndexTask     = null;
            Task LoadingRecommandTask = null;
            //Task LoadingFavouriteTask = null;
            //Task LoadingRecentTask = null;
            Task LoginTask = null;

            ViewModel.IsLoading = true;

            if (App.Current.RecentList == null)
            {
                await App.Current.LoadHistoryDataAsync();
            }
            if (App.Current.RecentList.Count > 0)
            {
                ViewModel.LastReadSection = new HistoryItemViewModel(App.Current.RecentList[App.Current.RecentList.Count - 1]);
                await ViewModel.RecentSection.LoadLocalAsync(true);
            }
            else
            {
                ViewModel.LastReadSection = new HistoryItemViewModel
                {
                    Position = new NovelPositionIdentifier
                    {
                        SeriesId  = "337",
                        VolumeNo  = 0,
                        VolumeId  = "1138",
                        ChapterNo = 0,
                        ChapterId = "8683"
                    },
                    SeriesTitle   = "机巧少女不会受伤",
                    VolumeTitle   = "第一卷 ",
                    Description   = "机巧魔术──那是由内藏魔术回路的自动人偶与人偶使所使用的魔术。在英国最高学府的华尔普吉斯皇家机巧学院里,正举行着一场选出顶尖人偶使「魔王」的战斗「夜会」。来自日本的留学生雷真和他的搭档──少女型态的人偶夜夜,为了参加「夜会」,打算挑战其他入选者,夺取对方的资格。他们锁定的目标是下届魔王呼声极高的候选人,别名「暴龙」的美少女夏琳!然而就在雷真向她挑战时,突然出现意外的伏兵……? 交响曲式学园战斗动作剧,第一集登场!",
                    CoverImageUri = "http://lknovel.lightnovel.cn/illustration/image/20120813/20120813085826_34455.jpg"
                };
            }

            if (!ViewModel.RecommandSection.IsLoaded && !ViewModel.RecommandSection.IsLoading)
            {
                LoadingRecommandTask = ViewModel.RecommandSection.LoadAsync();
            }
            if (ViewModel.SeriesIndex == null)
            {
                LoadingIndexTask = ViewModel.LoadSeriesIndexDataAsync().ContinueWith(async task =>
                {
                    await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                    {
                        if (SeriesIndexViewSource.View == null)
                        {
                            SeriesIndexViewSource.IsSourceGrouped = true;
                            SeriesIndexViewSource.Source          = ViewModel.SeriesIndex;
                        }
                        if (SeriesIndexViewSource.View != null)
                        {
                            ViewModel.SeriesIndexGroupView = SeriesIndexViewSource.View.CollectionGroups;
                        }
                    });
                });
            }

            if (!App.Current.IsSignedIn)
            {
                LoginTask = ViewModel.TryLogInWithStoredCredentialAsync().ContinueWith(async task =>
                {
                    if (task.Result)
                    {
                        await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
                        {
                            await ViewModel.FavoriteSection.LoadAsync();
                        });
                    }
                });
            }
            else
            {
                ViewModel.IsSignedIn = true;
                ViewModel.UserName   = App.Current.User.UserName;
                LoginTask            = ViewModel.FavoriteSection.LoadAsync();
            }

#if WINDOWS_APP
            if (HubScrollViewer != null)
            {
                HubScrollViewer.ViewChanged += HubScrollViewer_ViewChanged;
            }
#else //WINDOWS_PHONE_APP
            var statusBar = StatusBar.GetForCurrentView();
            statusBar.ProgressIndicator.Text          = "Synchronizing...";
            statusBar.ProgressIndicator.ProgressValue = null;
            statusBar.ForegroundColor = ((SolidColorBrush)App.Current.Resources["AppBackgroundBrush"]).Color;
            await statusBar.HideAsync();

            await statusBar.ProgressIndicator.ShowAsync();
#endif

            if (LoadingRecommandTask != null)
            {
                await LoadingRecommandTask;
            }
            if (LoadingIndexTask != null)
            {
                await LoadingIndexTask;
            }
            if (LoginTask != null)
            {
                await LoginTask;
            }

            UpdateTile();

            ViewModel.IsLoading = false;

#if  WINDOWS_APP
            foreach (var group in ViewModel.RecommandSection)
            {
                foreach (var item in group)
                {
                    try
                    {
                        await item.LoadDescriptionAsync();
                    }
                    catch (Exception exception)
                    {
                        Debug.WriteLine("Exception in loading volume description : ({0},{1}), exception : {3}", item.Title, item.Id, exception.Message);
                    }
                }
            }

            UpdateTile();
#else
            await statusBar.ProgressIndicator.HideAsync();
#endif
        }
Ejemplo n.º 16
0
        private async void CoursesToggle_Click(object sender, RoutedEventArgs e)
        {
            var statusBar = StatusBar.GetForCurrentView();

            statusBar.ProgressIndicator.Text          = ResourceLoader.GetForCurrentView("Resources").GetString("DownloadingMessage");
            statusBar.ProgressIndicator.ProgressValue = null;
            await statusBar.ProgressIndicator.ShowAsync();

            this.CoursesToggle.IsEnabled = false;

            var Label = (sender as AppBarButton).Label.ToString();

            if (Label == ResourceLoader.GetForCurrentView("Resources").GetString("CoursesToggleOne"))
            {
                var FourthGroup = await MainPageSource.GetGroupAsync(VegetariaCoursesPivotItemName);

                if (FourthGroup == null)
                {
                    await ShowErrorAsync();
                }
                else
                {
                    this.DefaultViewModel[CoursesPivotItemName] = FourthGroup;

                    if (FourthGroup.NextPageUri == null)
                    {
                        this.CoursesScroll.ViewChanged -= Scroll_ViewChanged;
                    }
                    else
                    {
                        this.CoursesScroll.ViewChanged += Scroll_ViewChanged;
                    }

                    if (this.CoursesMessage.Visibility == Visibility.Visible)
                    {
                        this.CoursesMessage.Visibility = Visibility.Collapsed;
                        this.RefreshButton.Visibility  = Visibility.Collapsed;
                    }

                    this.CoursesToggle.Label = ResourceLoader.GetForCurrentView("Resources").GetString("CoursesToggleTwo");
                }
            }
            else if (Label == ResourceLoader.GetForCurrentView("Resources").GetString("CoursesToggleTwo"))
            {
                var ThirdGroup = await MainPageSource.GetGroupAsync(CoursesPivotItemName);

                if (ThirdGroup == null)
                {
                    await ShowErrorAsync();
                }
                else
                {
                    this.DefaultViewModel[CoursesPivotItemName] = ThirdGroup;

                    if (ThirdGroup.NextPageUri == null)
                    {
                        this.CoursesScroll.ViewChanged -= Scroll_ViewChanged;
                    }
                    else
                    {
                        this.CoursesScroll.ViewChanged += Scroll_ViewChanged;
                    }

                    if (this.CoursesMessage.Visibility == Visibility.Visible)
                    {
                        this.CoursesMessage.Visibility = Visibility.Collapsed;
                        this.RefreshButton.Visibility  = Visibility.Collapsed;
                    }

                    this.CoursesToggle.Label = ResourceLoader.GetForCurrentView("Resources").GetString("CoursesToggleOne");
                }
            }

            await statusBar.ProgressIndicator.HideAsync();

            this.CoursesToggle.IsEnabled = true;
        }
Ejemplo n.º 17
0
        protected override void OnActivated(IActivatedEventArgs args)
        {
            base.OnActivated(args);
            #region Start app

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }
            #endregion
            try
            {
                StatusBar.GetForCurrentView().ForegroundColor = Colors.Black;
            }
            catch { }
            StartFluent();
            Resources["ToggleButtonBackgroundChecked"]            = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlHighlightListAccentLowBrush"] = Color.FromArgb(255, 96, 165, 255);
            Resources["ToggleSwitchFillOn"]                 = Color.FromArgb(255, 96, 165, 255);
            Resources["HyperlinkButtonForeground"]          = Color.FromArgb(255, 96, 165, 255);
            Resources["SystemControlBackgroundAccentBrush"] = Color.FromArgb(255, 96, 165, 255);
            SplashScreen         splashScreen = args.SplashScreen;
            ExtendedSplashScreen eSplash      = null;

            if (args.Kind == ActivationKind.VoiceCommand)
            {
                var voiceArgs = (VoiceCommandActivatedEventArgs)args;
                var Rule      = voiceArgs.Result.RulePath.FirstOrDefault();
                var input     = voiceArgs.Result.SemanticInterpretation.Properties.Where(x => x.Key == "UserInput").FirstOrDefault().Value.FirstOrDefault();
                if (Rule == "DirectionsCommand")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen, new Uri("https://google.com/maps/@searchplace=" + input, UriKind.RelativeOrAbsolute));
                }
                if (Rule == "FindPlace")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen, new Uri("https://google.com/maps/@searchplace=" + input, UriKind.RelativeOrAbsolute));
                }
                if (Rule == "WhereAmI")
                {
                    eSplash = new ExtendedSplashScreen(splashScreen);
                }
            }
            if (args.Kind == ActivationKind.Protocol)
            {
                var protocolArgs = (ProtocolActivatedEventArgs)args;
                var x            = protocolArgs.Uri.ToString();

                // Register an event handler to be executed when the splash screen has been dismissed.
                //Type deepLinkPageType = typeof(PageLogin);
                if (rootFrame.Content == null)
                {
                    try
                    {
                        switch (protocolArgs.Uri.AbsolutePath.ToLower().Replace("/maps", string.Empty).Split('/')[1].ToString())
                        {
                        case "search":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        case "dir":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        case "@":
                            eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                            break;

                        default:
                            eSplash = new ExtendedSplashScreen(splashScreen);
                            break;
                        }
                    }
                    catch
                    {
                        eSplash = new ExtendedSplashScreen(splashScreen, protocolArgs.Uri);
                    }
                }
            }
            Window.Current.Content = eSplash;
            Window.Current.Activate();
        }
Ejemplo n.º 18
0
        private async void Scroll_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
        {
            if (!e.IsIntermediate)
            {
                var Sender = sender as ScrollViewer;
                if (Sender.ScrollableHeight - Sender.VerticalOffset == 0)
                {
                    lock (IncrementalLoadingHelper)
                    {
                        if (isIncrementalLoadingStarted)
                        {
                            return;
                        }
                        else
                        {
                            isIncrementalLoadingStarted = true;
                        }
                    }

                    var GroupName = Sender.Tag.ToString();

                    var ThisGroup = this.DefaultViewModel[GroupName] as Group;

                    if (ThisGroup.NextPageUri != null)
                    {
                        var statusBar = StatusBar.GetForCurrentView();
                        statusBar.ProgressIndicator.Text          = ResourceLoader.GetForCurrentView("Resources").GetString("DownloadingMessage");
                        statusBar.ProgressIndicator.ProgressValue = null;
                        await statusBar.ProgressIndicator.ShowAsync();

                        bool isSuccessful = await MainPageSource.LoadMoreItemsAsync(GroupName);

                        await statusBar.ProgressIndicator.HideAsync();

                        if (isSuccessful)
                        {
                            var Group = await MainPageSource.GetGroupAsync(GroupName);

                            if (Group.NextPageUri == null)
                            {
                                if (GroupName == RestaurantsPivotItemName)
                                {
                                    this.RestaurantsScroll.ViewChanged -= Scroll_ViewChanged;
                                }
                                else if (GroupName == PromotedRestaurantsPivotItemName)
                                {
                                    this.PromotedRestaurantsScroll.ViewChanged -= Scroll_ViewChanged;
                                }
                                else if (GroupName == CoursesPivotItemName || GroupName == VegetariaCoursesPivotItemName)
                                {
                                    this.CoursesScroll.ViewChanged -= Scroll_ViewChanged;
                                }
                                else if (GroupName == CategoriesPivotItemName)
                                {
                                    this.CategoriesScroll.ViewChanged -= Scroll_ViewChanged;
                                }
                            }
                        }
                        else
                        {
                            await ShowErrorAsync();
                        }
                    }
                    else
                    {
                        if (GroupName == RestaurantsPivotItemName)
                        {
                            this.RestaurantsScroll.ViewChanged -= Scroll_ViewChanged;
                        }
                        else if (GroupName == PromotedRestaurantsPivotItemName)
                        {
                            this.PromotedRestaurantsScroll.ViewChanged -= Scroll_ViewChanged;
                        }
                        else if (GroupName == CoursesPivotItemName || GroupName == VegetariaCoursesPivotItemName)
                        {
                            this.CoursesScroll.ViewChanged -= Scroll_ViewChanged;
                        }
                        else if (GroupName == CategoriesPivotItemName)
                        {
                            this.CategoriesScroll.ViewChanged -= Scroll_ViewChanged;
                        }
                    }

                    lock (IncrementalLoadingHelper)
                    {
                        isIncrementalLoadingStarted = false;
                    }
                }
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            var tileId = e.TileId.ToString();

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active.
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page.
                rootFrame = new Frame();

                // Associate the frame with a SuspensionManager key.
                SuspensionManager.RegisterFrame(rootFrame, "AppFrame");

                await GetSettings();

                await StatusBar.GetForCurrentView().HideAsync();

                await SampleDataSource.GetGroupsAsync();

                if (AppAccentColor != resourceLoader.GetString("Indigo"))
                {
                    if (AppAccentColor == resourceLoader.GetString("Light Blue"))
                    {
                        Resources["AppMainColor"]    = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 2, 136, 209));
                        Resources["CheckBoxBGColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 2, 150, 229));
                    }

                    else if (AppAccentColor == resourceLoader.GetString("Teal"))
                    {
                        Resources["AppMainColor"]    = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 121, 107));
                        Resources["CheckBoxBGColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 0, 140, 124));
                    }
                    else
                    {
                        Resources["AppMainColor"]    = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 198, 40, 40));
                        Resources["CheckBoxBGColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 224, 45, 45));
                    }
                }

                if (AppBGColor == resourceLoader.GetString("Light"))
                {
                    rootFrame.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 245, 245, 245));
                }
                else
                {
                    rootFrame.Background = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 20, 20, 20));

                    Resources["AppBackgroundColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 20, 20, 20));

                    Resources["CommandBarBackgroundColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 25, 25, 25));

                    Resources["ItemForegroundColor"] = new SolidColorBrush(Colors.White);

                    Resources["TextBlockColor"]           = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 30, 30, 30));
                    Resources["TextBoxBorderBrush"]       = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 10, 10, 10));
                    Resources["TextBlockForegroundColor"] = new SolidColorBrush(Colors.White);

                    Resources["ItemPageTextBoxColor"] = new SolidColorBrush(Windows.UI.Color.FromArgb(255, 30, 30, 30));
                }

                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        // Something went wrong restoring state.
                        // Assume there is no state and continue.
                    }
                }

                // Place the frame in the current Window.
                Window.Current.Content = rootFrame;
            }

            else
            {
                if (tileId.Contains("id"))
                {
                    if (!rootFrame.Navigate(typeof(SectionPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }

                    rootFrame.BackStack.Clear();
                }
                else if (tileId.Contains("App"))
                {
                    if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }

                    rootFrame.BackStack.Clear();
                }
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter.
                if (tileId.Contains("id"))
                {
                    if (!rootFrame.Navigate(typeof(SectionPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
                else
                {
                    if (!rootFrame.Navigate(typeof(HubPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
            }

            // Ensure the current window is active.
            Window.Current.Activate();
        }
Ejemplo n.º 20
0
        private async void RefreshButton_Click(object sender, RoutedEventArgs e)
        {
            this.RefreshButton.IsEnabled = false;
            string GroupName = RestaurantsPivotItemName;

            if (this.MainPagePivot.SelectedIndex.Equals(PromotedRestaurantsPivotItemIndex))
            {
                GroupName = PromotedRestaurantsPivotItemName;
            }
            else if (this.MainPagePivot.SelectedIndex.Equals(CoursesPivotItemIndex))
            {
                GroupName = CoursesPivotItemName;
            }
            else if (this.MainPagePivot.SelectedIndex.Equals(CategoriesPivotItemIndex))
            {
                GroupName = CategoriesPivotItemName;
            }

            if (!this.DefaultViewModel.ContainsKey(GroupName))
            {
                var statusBar = StatusBar.GetForCurrentView();
                statusBar.ProgressIndicator.Text          = ResourceLoader.GetForCurrentView("Resources").GetString("DownloadingMessage");
                statusBar.ProgressIndicator.ProgressValue = null;
                await statusBar.ProgressIndicator.ShowAsync();

                var Group = await MainPageSource.GetGroupAsync(GroupName);

                await statusBar.ProgressIndicator.HideAsync();

                if (Group == null)
                {
                    this.RefreshButton.IsEnabled = true;

                    this.CoursesMessage.Visibility = Visibility.Visible;
                    this.CoursesMessage.Text       = ResourceLoader.GetForCurrentView("Resources").GetString("ErrorMessage");

                    this.RefreshButton.Visibility = Visibility.Visible;
                    await ShowErrorAsync();
                }
                else
                {
                    this.RefreshButton.IsEnabled  = true;
                    this.RefreshButton.Visibility = Visibility.Collapsed;
                    if (GroupName == RestaurantsPivotItemName)
                    {
                        this.RestarauntsMessage.Visibility = Visibility.Collapsed;
                    }
                    else if (GroupName == PromotedRestaurantsPivotItemName)
                    {
                        this.PromotedRestaurantsMessage.Visibility = Visibility.Collapsed;
                    }
                    else if (GroupName == CoursesPivotItemName)
                    {
                        this.CoursesMessage.Visibility = Visibility.Collapsed;
                    }
                    else if (GroupName == CategoriesPivotItemName)
                    {
                        this.CategoriesMessage.Visibility = Visibility.Collapsed;
                    }
                    this.DefaultViewModel[GroupName] = Group;
                }
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = false;
            }
#endif

            DispatcherHelper.Initialize();

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new KlivaApplicationFrame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter

                bool stravaTokenAvailabe = !string.IsNullOrEmpty(await ServiceLocator.Current.GetInstance <ISettingsService>().GetStoredStravaAccessTokenAsync());

                rootFrame.Navigate(stravaTokenAvailabe ? typeof(MainPage) : typeof(LoginPage), e.Arguments);
            }

            //TODO: Glenn - refactor with actual screen size?
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
            {
                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(width: 800, height: 600));

                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.InactiveBackgroundColor = titleBar.BackgroundColor = titleBar.ButtonInactiveBackgroundColor = titleBar.ButtonBackgroundColor = (Color)Current.Resources["KlivaMainColor"];
                    titleBar.ForegroundColor         = titleBar.ButtonForegroundColor = Colors.White;
                }
            }

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                statusBar.BackgroundOpacity = 100;
                statusBar.BackgroundColor   = (Color)Current.Resources["KlivaMainColor"];
                statusBar.ForegroundColor   = Colors.White;

                DisplayInformation.AutoRotationPreferences = DisplayOrientations.Portrait |
                                                             DisplayOrientations.PortraitFlipped;
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;

                // 每次导航到新页面的时候都根据页面能否回退来显示后退按钮
                rootFrame.Navigated += OnNavigated;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;

                // 注册后退事件
                SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

                // 显示PC设备TitleBar上的的后退按钮
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    rootFrame.CanGoBack ?
                    AppViewBackButtonVisibility.Visible :
                    AppViewBackButtonVisibility.Collapsed;

                // Mobile设备设置为全屏模式,并隐藏StatusBar
                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    ApplicationView.GetForCurrentView().SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                    await StatusBar.GetForCurrentView().HideAsync();
                }
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (client.UUID == null)
                {
                    if (!rootFrame.Navigate(typeof(UserLogin), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
                else
                {
                    if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                    {
                        throw new Exception("Failed to create initial page");
                    }
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        private async void OpenArticle(ItemClickEventArgs e)
        {
            stpArticle.ScrollToVerticalOffset(0);
            articleOpened = true;

            selectedArticle = (Article)e.ClickedItem;

            if (ApiInformation.IsApiContractPresent("Windows.Phone.PhoneContract", 1, 0))
            {
                StatusBar statusBar = StatusBar.GetForCurrentView();
                await statusBar.HideAsync();
            }

            txtVideoError.Visibility = Visibility.Collapsed;

            if (selectedArticle.Video != "" && selectedArticle.Video != null)
            {
                metArticleVideo.Visibility = Visibility.Visible;
                imgArticleImage.Visibility = Visibility.Collapsed;
                metArticleVideo.Source     = new Uri(selectedArticle.Video, UriKind.Absolute);
            }
            else
            {
                if (selectedArticle.Image != "" && selectedArticle.Image != null)
                {
                    metArticleVideo.Visibility = Visibility.Collapsed;
                    imgArticleImage.Visibility = Visibility.Visible;
                    imgArticleImage.Source     = new BitmapImage(new Uri(selectedArticle.Image, UriKind.RelativeOrAbsolute));
                }
                else
                {
                    metArticleVideo.Visibility = Visibility.Collapsed;
                    imgArticleImage.Visibility = Visibility.Collapsed;
                }
            }

            txtArticleTitle.Text       = selectedArticle.Title;
            txtArticleTitle.FontSize   = (double)localSettings.Values["fontSize"] + 8;
            txtArticleDate.FontSize    = (double)localSettings.Values["fontSize"] - 4;
            txtArticleDate.Text        = FormatDate(selectedArticle.Date);
            linkArticleUrl.Content     = selectedArticle.Url;
            linkArticleUrl.NavigateUri = new Uri(selectedArticle.Url, UriKind.Absolute);

            txtArticleContent.Blocks.Clear();

            MatchCollection paragraphs = Regex.Matches(selectedArticle.Content, @"#(p|headline)#.+?#\/(p|headline)#");

            foreach (var item in paragraphs)
            {
                string value = item.ToString();

                Paragraph paragraph = new Paragraph();
                Run       run       = new Run();

                if (Regex.IsMatch(value, "#headline#"))
                {
                    paragraph.Foreground = new SolidColorBrush((Color)Application.Current.Resources["SystemAccentColor"]);
                    paragraph.FontSize   = (double)localSettings.Values["fontSize"] + 6;
                    paragraph.FontWeight = FontWeights.Normal;
                    paragraph.Margin     = new Thickness(0, 20, 0, 5);
                }
                else
                {
                    paragraph.FontSize      = (double)localSettings.Values["fontSize"];
                    paragraph.TextAlignment = TextAlignment.Justify;
                    paragraph.Margin        = new Thickness(0, 0, 0, 10);
                }

                run.Text = Regex.Replace(value, "#.+?#", "");
                paragraph.Inlines.Add(run);
                txtArticleContent.Blocks.Add(paragraph);
            }

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            btnDiscussion.Visibility = (string.IsNullOrEmpty(selectedArticle.Discussion_Url)) ? Visibility.Collapsed : Visibility.Visible;

            articleContainer.Visibility  = Visibility.Visible;
            cmbArticleActions.Visibility = Visibility.Visible;
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();

            //PC customization
            if (ApiInformation.IsTypePresent(
                    "Windows.UI.ViewManagement.ApplicationView"))
            {
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (titleBar != null)
                {
                    titleBar.ButtonBackgroundColor = Colors.Black;
                    titleBar.ButtonForegroundColor = Colors.MediumSeaGreen;
                    titleBar.BackgroundColor       = Colors.Black;
                    titleBar.ForegroundColor       = Colors.MediumSeaGreen;
                }
            }

            //Mobile customization
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                var statusBar = StatusBar.GetForCurrentView();
                if (statusBar != null)
                {
                    statusBar.BackgroundOpacity = 25;
                    statusBar.BackgroundOpacity = 1;
                    statusBar.BackgroundColor   = Colors.Black;
                    statusBar.ForegroundColor   = Colors.MediumSeaGreen;
                    HideStatusBar(statusBar);
                }
            }
        }
Ejemplo n.º 25
0
        void LoadFrame(IActivatedEventArgs args, object arguments)
        {
            try
            {
                var stop = Stopwatch.StartNew();
                BLogger.Logger.Info("Loading frame started...");
                Frame rootFrame = Window.Current.Content as Frame;

                // Do not repeat app initialization when the Window already has content
                if (rootFrame == null)
                {
                    // Create a Frame to act as the navigation context
                    rootFrame = new Frame();
                    BLogger.Logger.Info("New frame created.");
                    if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                    {
                        //CoreWindowLogic.ShowMessage("HellO!!!!!", "we are here");
                        //TODO: Load state from previously suspended application
                    }
                    rootFrame.NavigationFailed += OnNavigationFailed;
                    // Place the frame in the current Window
                    Window.Current.Content = rootFrame;
                    BLogger.Logger.Info("Content set to Window successfully...");
                }
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing required information as a navigation
                    // parameter
                    BLogger.Logger.Info("Navigating to Shell...");
                    rootFrame.Navigate(typeof(Shell), arguments);
                }

                // CoreWindowLogic logic = new CoreWindowLogic();
                var view = ApplicationView.GetForCurrentView();
                view.SetPreferredMinSize(new Size(360, 100));
                if (RequestedTheme == ApplicationTheme.Dark)
                {
                    view.TitleBar.BackgroundColor       = Color.FromArgb(20, 20, 20, 1);
                    view.TitleBar.ButtonBackgroundColor = Color.FromArgb(20, 20, 20, 1);
                }
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    //view.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                    var statusBar = StatusBar.GetForCurrentView();
                    statusBar.BackgroundColor   = RequestedTheme == ApplicationTheme.Light ? (App.Current.Resources["PhoneAccentBrush"] as SolidColorBrush).Color : Color.FromArgb(20, 20, 20, 1);
                    statusBar.BackgroundOpacity = 1;
                    statusBar.ForegroundColor   = Colors.White;
                }
                if (args.Kind != ActivationKind.File)
                {
                    CoreWindowLogic.LoadSettings();
                }
                else
                {
                    CoreWindowLogic.LoadSettings(true);
                }
                Window.Current.Activate();
                stop.Stop();
                Debug.Write(stop.ElapsedMilliseconds.ToString() + "\r\n");
            }
            catch (Exception ex)
            {
                BLogger.Logger?.Info("Exception occured in LoadFrame Method", ex);
            }
        }
Ejemplo n.º 26
0
        public static void HandleTitleBarForWindow(FrameworkElement titleBar, FrameworkElement contentRoot)
        {
            lock (_handledElements)
            {
                //if (_handledElements.Contains(titleBar))
                //    return;

                var applicationView     = ApplicationView.GetForCurrentView();
                var coreApplicationView = CoreApplication.GetCurrentView();

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    if (statusBar != null)
                    {
                        void OnApplicationViewBoundsChanged(ApplicationView sender, object args)
                        {
                            var visibleBounds  = sender.VisibleBounds;
                            var bounds         = coreApplicationView.CoreWindow.Bounds;
                            var occludedHeight = bounds.Height - visibleBounds.Height - statusBar.OccludedRect.Height;
                            var margin         = contentRoot.Margin;

                            contentRoot.Margin = new Thickness(margin.Left, margin.Top, margin.Right, occludedHeight);
                        }

                        statusBar.BackgroundOpacity = 0;
                        statusBar.ForegroundColor   = (Color?)Application.Current.Resources["SystemChromeAltLowColor"];

                        if (titleBar != null)
                        {
                            titleBar.Height = statusBar.OccludedRect.Height;
                        }

                        applicationView.VisibleBoundsChanged += OnApplicationViewBoundsChanged;
                        applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);
                        OnApplicationViewBoundsChanged(applicationView, null);
                    }
                }
                else
                {
                    var coreTitleBar = coreApplicationView.TitleBar;
                    coreTitleBar.ExtendViewIntoTitleBar = true;

                    var baseTitlebar = applicationView.TitleBar;
                    baseTitlebar.ButtonBackgroundColor         = Colors.Transparent;
                    baseTitlebar.ButtonInactiveBackgroundColor = Colors.Transparent;
                    baseTitlebar.ButtonForegroundColor         = (Color?)Application.Current.Resources["SystemChromeAltLowColor"];
                    baseTitlebar.ButtonInactiveForegroundColor = (Color?)Application.Current.Resources["SystemChromeAltLowColor"];

                    if (titleBar != null)
                    {
                        // this method captures "titleBar" meaning the GC might not be able to collect it.
                        void UpdateTitleBarLayout(CoreApplicationViewTitleBar sender, object ev)
                        {
                            titleBar.Height = sender.Height;
                        }

                        // i *believe* this handles it? not 100% sure
                        void ElementUnloaded(object sender, RoutedEventArgs e)
                        {
                            coreTitleBar.LayoutMetricsChanged     -= UpdateTitleBarLayout;
                            (sender as FrameworkElement).Unloaded -= ElementUnloaded;

                            lock (_handledElements)
                            {
                                _handledElements.Remove(sender as FrameworkElement);
                            }
                        }

                        coreTitleBar.LayoutMetricsChanged += UpdateTitleBarLayout;
                        titleBar.Unloaded  += ElementUnloaded;
                        titleBar.Visibility = Visibility.Visible;

                        Window.Current.SetTitleBar(titleBar);
                    }
                }
            }
        }
Ejemplo n.º 27
0
 public static async void ShowStatusBar()
 {
     await StatusBar.GetForCurrentView().ShowAsync();
 }
Ejemplo n.º 28
0
        private async Task GetResults()
        {
            try
            {
                string url = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1080&height=1920";
                bool   pc  = SettingHelper.IsPc();
                if (pc)
                {
                    img.Stretch = Stretch.Uniform;
                    url         = "http://app.bilibili.com/x/splash?plat=0&build=414000&channel=master&width=1920&height=1080";
                }

                string Result = await WebClientClass.GetResults(new Uri(url));

                LoadModel obj = JsonConvert.DeserializeObject <LoadModel>(Result);

                if (obj.code == 0)
                {
                    if (obj.data.Count != 0)
                    {
                        var buff = await WebClientClass.GetBuffer(new Uri(obj.data[0].image));

                        BitmapImage bit = new BitmapImage();
                        await bit.SetSourceAsync(buff.AsStream().AsRandomAccessStream());

                        if (!pc)
                        {
                            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                            {
                                var applicationView = ApplicationView.GetForCurrentView();
                                applicationView.SetDesiredBoundsMode(ApplicationViewBoundsMode.UseCoreWindow);

                                // StatusBar.GetForCurrentView().HideAsync();
                                StatusBar statusBar = StatusBar.GetForCurrentView();
                                statusBar.ForegroundColor   = Colors.Gray;
                                statusBar.BackgroundColor   = Color.FromArgb(255, 55, 63, 76);
                                statusBar.BackgroundOpacity = 0;
                            }
                        }
                        else
                        {
                            img_bg.Source = bit;
                            InitializedFrostedGlass(GlassHost);
                        }
                        img.Source = bit;
                        _url       = obj.data[0].param;
                        maxnum     = 5;
                        //await Task.Delay(3000);
                        //this.Frame.Navigate(typeof(MainPage), m);
                    }
                    else
                    {
                        // await Task.Delay(2000);
                    }
                }
                else
                {
                    // await Task.Delay(2000);
                    //this.Frame.Navigate(typeof(MainPage), m);
                }
            }
            catch (Exception)
            {
                // await Task.Delay(2000);
                //this.Frame.Navigate(typeof(MainPage), m);
            }
            finally
            {
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            // Set the right theme-depending color for the alternating rows
            if (SettingsService.Get <bool>(SettingsKeys.AppLightThemeEnabled))
            {
                XAMLHelper.AssignValueToXAMLResource("OddAlternatingRowsBrush",
                                                     new SolidColorBrush {
                    Color = Color.FromArgb(0x08, 0, 0, 0)
                });
            }

            CustomFrame rootFrame = Window.Current.Content as CustomFrame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new CustomFrame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    // When the navigation stack isn't restored navigate to the first page,
                    // configuring the new page by passing a boolean as navigation parameter,
                    // indicating whether the user is logged in or not

                    if (await AuthService.checkAuth())
                    {
                        await rootFrame.Navigate(typeof(MainPage), true);
                    }
                    else
                    {
                        await rootFrame.Navigate(typeof(MainPage), false);
                    }
                }

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationView"))
                {
                    var view = ApplicationView.GetForCurrentView();
                    view.SetPreferredMinSize(new Size(width: 800, height: 600));

                    var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                    if (titleBar != null)
                    {
                        titleBar.BackgroundColor = titleBar.ButtonBackgroundColor = (Color)App.Current.Resources["SystemAltHighColor"];
                    }
                }

                if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    statusBar.BackgroundOpacity = 100;
                    statusBar.BackgroundColor   = (Color)Current.Resources["SystemAltHighColor"];
                }

                // Ensure the current window is active
                Window.Current.Activate();
            }
        }
Ejemplo n.º 30
0
        protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            Windows.Storage.ApplicationDataContainer localSettings   = Windows.Storage.ApplicationData.Current.LocalSettings;
            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;

            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                title.Margin = new Thickness(0, 10, 0, 10);
                if (Application.Current.RequestedTheme == ApplicationTheme.Light)
                {
                    var statusBar = StatusBar.GetForCurrentView();
                    statusBar.ForegroundColor = Colors.Black;
                }
            }
            if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.ApplicationViewTitleBar"))
            {
                if (!ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                {
                    titlebarName.Visibility = Visibility.Visible;
                }
                ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(500, 730));
                var titleBar = ApplicationView.GetForCurrentView().TitleBar;
                if (Application.Current.RequestedTheme == ApplicationTheme.Dark)
                {
                    titleBar.BackgroundColor       = Colors.Black;
                    titleBar.ButtonBackgroundColor = Colors.Black;
                    titleBar.ButtonForegroundColor = Colors.White;
                }
                else
                {
                    titleBar.BackgroundColor       = Colors.White;
                    titleBar.ForegroundColor       = Colors.Black;
                    titleBar.ButtonBackgroundColor = Colors.White;
                    titleBar.ButtonForegroundColor = Colors.Black;
                }
            }

            Loaded += async(s, ev) =>
            {
                var      logger = StoreServicesCustomEventLogger.GetDefault();
                string[] temp = ((string)roamingSettings.Values["usagelog"]).Split('|');
                int      usage, lastday;
                int.TryParse(temp[1], out usage);
                int.TryParse(temp[0], out lastday);

                if (lastday != DateTime.Today.Day)
                {
                    usage++;
                    roamingSettings.Values["usagelog"] = DateTime.Today.Day + "|" + usage;
                    switch (usage)
                    {
                    case 20:
                        logger.Log("engagement 20");     // ~1 month once per day
                        break;

                    case 60:
                        logger.Log("engagement 60");     // ~3 months
                        break;

                    case 100:
                        logger.Log("engagement 100");     // ~5 months
                        break;

                    case 140:
                        logger.Log("engagement 140");     // ~7 months
                        break;

                    case 240:
                        logger.Log("engagement 240");     // ~1 year
                        break;
                    }
                }

                if (localSettings.Values["version"] == null)
                {
                    localSettings.Values["version"] = App.VERSION;
                    logger.Log("Install");
                }
                if ((string)localSettings.Values["version"] != App.VERSION)
                {
                    logger.Log("Update");

                    if ((bool)roamingSettings.Values["showlog"])
                    {
                        localSettings.Values["version"] = App.VERSION;
                        var popup = new ContentDialog();
                        popup.Content                = new ChangelogWindow(Window.Current.Bounds.Width, Window.Current.Bounds.Height);
                        popup.PrimaryButtonText      = resourceLoader.GetString("Closebutton");
                        popup.IsPrimaryButtonEnabled = true;

                        if (ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
                        {
                            popup.FullSizeDesired = true;
                        }
                        else
                        {
                            popup.MinHeight = ActualHeight * 0.7;
                            popup.MaxHeight = ActualHeight * 0.7;
                            popup.MinWidth  = 440;
                            popup.MaxWidth  = 440;
                        }

                        await popup.ShowAsync();
                    }
                }
            };

            if (Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported())
            {
                AppbarFeedback.Visibility = Visibility.Visible;
            }

            if (localSettings.Values["location"] == null && AnalyticsInfo.VersionInfo.DeviceFamily != "Windows.Xbox")
            {
                var dialog = new MessageDialog(resourceLoader.GetString("InitialLocation"));
                dialog.Commands.Add(new UICommand(resourceLoader.GetString("Yes"), async(command) =>
                {
                    if (await Utilities.LocationFinder.IsLocationAllowed())
                    {
                        localSettings.Values["location"] = true;
                    }
                    else
                    {
                        localSettings.Values["location"] = false;
                    }
                }));
                dialog.Commands.Add(new UICommand(resourceLoader.GetString("No"), (command) =>
                {
                    localSettings.Values["location"] = false;
                }));
                dialog.CancelCommandIndex  = 1;
                dialog.DefaultCommandIndex = 0;
                await dialog.ShowAsync();
            }

            await getSavedData();
        }