Esempio n. 1
0
        protected override async Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
        {
#if _DEBUG
// デバッグ用コードをここに突っ込む
            var sw = System.Diagnostics.Stopwatch.StartNew();
            //Models.Filter.Compiler.Compile("(!(User.ScreenName In [\"cucmberium\", \"cucmberium_sub\"] || User.Id !In [10, 20, 30]) && RetweetCount >= FavoriteCount * 10 + 10 / (2 + 3))");

            //Models.Filter.Compiler.Compile("(Text RegexMatch \"(ふらん|フラン)ちゃんかわいい\" || Text Contains \"Flantter\")");

            //Models.Filter.Compiler.Compile("(Text StartsWith \"島風\" || Text EndsWith \"天津風\")");

            Models.Filter.Compiler.Compile("(Random(0, 10) == 0 && Text Contains \"チノちゃん\")");

            sw.Stop();
            System.Diagnostics.Debug.WriteLine(sw.Elapsed);
#endif
            if (BackgroundTaskRegistration.AllTasks.Count > 1)
            {
                foreach (var task in BackgroundTaskRegistration.AllTasks)
                {
                    task.Value.Unregister(true);
                }
            }

            await AdvancedSettingService.AdvancedSetting.LoadFromAppSettings();

            SettingService.Setting.LatestNotificationDate = DateTimeOffset.Now;

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size {
                Width = 320, Height = 500
            });

            if (AdvancedSettingService.AdvancedSetting.Accounts == null ||
                AdvancedSettingService.AdvancedSetting.Accounts.Count == 0)
            {
                NavigationService.Navigate("Initialize", "");
            }
            else
            {
                NavigationService.Navigate("Main", "");
            }

            DeviceGestureService.GoBackRequested += (s, e) =>
            {
                var behavior = ShowSettingsFlyoutAction.GetForCurrentView();
                if (behavior == null)
                {
                    return;
                }

                if (behavior.ShowingPopupCount == 0)
                {
                    return;
                }

                e.Handled = true;
                e.Cancel  = true;
                behavior.HideTopPopup();
            };

            //return Task.FromResult<object>(null);
        }
Esempio n. 2
0
        public MainPage()
        {
            InitializeComponent();

            var version = (ulong.Parse(AnalyticsInfo.VersionInfo.DeviceFamilyVersion) & 0x00000000FFFF0000L) >> 16;

            if (version >= 15063)
            {
                _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

                Loaded += (s, e) =>
                {
                    _hostSprite = _compositor.CreateSpriteVisual();
                    UpdateBackgroundBrush(SettingService.Setting.UseTransparentBackground);
                };
            }

            ThemeService.Theme.ChangeTheme();

            UpdateTitleBar(WindowSizeHelper.Instance.StatusBarHeight > 0);
            WindowSizeHelper.Instance.ObserveProperty(x => x.StatusBarHeight)
            .SubscribeOnUIDispatcher()
            .Subscribe(x => UpdateTitleBar(x > 0));
            SettingService.Setting.ObserveProperty(x => x.UseTransparentBackground)
            .SubscribeOnUIDispatcher()
            .Subscribe(x => UpdateBackgroundBrush(x));
            WindowSizeHelper.Instance.ObserveProperty(x => x.ClientWidth)
            .Merge(WindowSizeHelper.Instance.ObserveProperty(x => x.ClientHeight)
                   )
            .SubscribeOnUIDispatcher()
            .Subscribe(x => UpdateBackgroundBrushSizeChange());

            /*SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
             * {
             *  var behavior = Flantter.MilkyWay.Views.Behaviors.ShowSettingsFlyoutAction.GetForCurrentView();
             *  if (behavior == null)
             *      return;
             *
             *  if (behavior.ShowingPopupCount == 0)
             *      return;
             *
             *  e.Handled = true;
             *  behavior.HideTopPopup();
             * };*/

            Window.Current.CoreWindow.PointerPressed += (s, e) =>
            {
                var behavior = ShowSettingsFlyoutAction.GetForCurrentView();

                var backPressed = e.CurrentPoint.Properties.IsXButton1Pressed;
                var nextPressed = e.CurrentPoint.Properties.IsXButton2Pressed;

                if (behavior != null && behavior.ShowingPopupCount != 0)
                {
                    if (backPressed)
                    {
                        behavior.HideTopPopup();
                    }

                    return;
                }

                // Taboo : 禁忌
                if (backPressed)
                {
                    Notice.Instance.DecrementColumnSelectedIndexCommand.Execute();
                }
                else if (nextPressed)
                {
                    Notice.Instance.IncrementColumnSelectedIndexCommand.Execute();
                }
            };
        }