コード例 #1
0
ファイル: App.xaml.cs プロジェクト: wizd/ReduxSimple
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            var rootFrame = (Window.Current.Content as Frame).ToOption()
                            .Match <Frame>()
                            .None().Do(() =>
            {
                var newFrame           = CreateNewFrame(e.PreviousExecutionState);
                Window.Current.Content = newFrame;
                return(newFrame);
            })
                            .Some().Do(f => f)
                            .Result();

            // Enable router store feature
            Store.EnableRouterFeature(rootFrame);

            // Register Effects
            Store.RegisterEffects(
                TrackAction
                );

            if (!e.PrelaunchActivated)
            {
                var rootFrameContentOption = rootFrame.Content.ToOption();

                if (!rootFrameContentOption.HasValue)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                Window.Current.Activate();
            }
        }