Exemplo n.º 1
0
        protected override void OnHohoemaNavigatingFrom(NavigatingFromEventArgs e, Dictionary <string, object> viewModelState, bool suspending)
        {
            if (suspending)
            {
                //				viewModelState[nameof(CurrentSettingsKind)] = CurrentSettingsKind.Value.Kind.ToString();
            }
            else
            {
                // Note: ページアンロード中にPivotのSelectedItemが操作されると
                // Xaml側で例外がスローされてしまうようなので
                // サスペンド処理時はCurrentSettingsContentを変更しない
                //CurrentSettingsContent.Value = null;
            }

            // フィルタ
            // NG VideoTitleを複数行NG動画タイトル文字列から再構成
            _NGSettings.NGVideoTitleKeywords.Clear();
            foreach (var ngKeyword in NGVideoTitleKeywords.Value.Split('\r'))
            {
                if (!string.IsNullOrWhiteSpace(ngKeyword))
                {
                    _NGSettings.NGVideoTitleKeywords.Add(new NGKeyword()
                    {
                        Keyword = ngKeyword
                    });
                }
            }

            _NGSettings.Save().ConfigureAwait(false);


            // TVMode有効フラグをXaml側に反映されるようリソースに書き込み
            // 汚いやり方かもしれない
            App.Current.Resources["IsTVModeEnabled"] = Helpers.DeviceTypeHelper.IsXbox || HohoemaApp.UserSettings.AppearanceSettings.IsForceTVModeEnable;


            _RankingSettings.GetFile().ContinueWith(async prevTask =>
            {
                await HohoemaApp.PushToRoamingData(prevTask.Result);
            });
            _NGSettings.GetFile().ContinueWith(async prevTask =>
            {
                await HohoemaApp.PushToRoamingData(prevTask.Result);
            });

            base.OnHohoemaNavigatingFrom(e, viewModelState, suspending);
        }
Exemplo n.º 2
0
        protected override void OnLeave()
        {
            ApplyAllPriorityCategoriesToRankingSettings();

            _RankingSettings.Save().ConfigureAwait(false);
            _NGSettings.Save().ConfigureAwait(false);


            _RankingSettings.GetFile().ContinueWith(async prevTask =>
            {
                await HohoemaApp.PushToRoamingData(prevTask.Result);
            });
            _NGSettings.GetFile().ContinueWith(async prevTask =>
            {
                await HohoemaApp.PushToRoamingData(prevTask.Result);
            });
        }