private void SetItemFilterAndNavigateNext(CommandButtonDescriptor button)
        {
            using (IScopedFlowManagerService flowManagerService = App.ServiceProvider.GetRequiredService <IScopedFlowManagerService>())
            {
                flowManagerService.CopyFlowItems();

                flowManagerService.SetFlowDataCacheItem
                (
                    typeof(FilterLambdaOperatorParameters).FullName,
                    this.getItemFilterBuilder.CreateFilter
                    (
                        this.FormSettings.ItemFilterGroup,
                        typeof(TModel),
                        this.entity
                    )
                );

                flowManagerService.Next
                (
                    new CommandButtonRequest
                {
                    NewSelection = button.ShortString
                }
                );
            }
        }
Esempio n. 2
0
 private async void Start()
 {
     using (IScopedFlowManagerService flowManagerService = App.ServiceProvider.GetRequiredService <IScopedFlowManagerService>())
     {
         await flowManagerService.Start();
     }
 }
Esempio n. 3
0
        public void DataFromTheSameScopeMustMatch()
        {
            IScopedFlowManagerService scopedFlowManagerService1 = serviceProvider.GetRequiredService <IScopedFlowManagerService>();

            scopedFlowManagerService1.SetFlowDataCacheItem("A", new List <string> {
                "First", "Second"
            });
            object aList = scopedFlowManagerService1.GetFlowDataCacheItem("A");

            Assert.Equal("Second", ((List <string>)aList)[1]);
        }
Esempio n. 4
0
        public void DataFromDifferentScopesCanBeDifferent()
        {
            IScopedFlowManagerService scopedFlowManagerService1 = serviceProvider.GetRequiredService <IScopedFlowManagerService>();
            IScopedFlowManagerService scopedFlowManagerService2 = serviceProvider.GetRequiredService <IScopedFlowManagerService>();

            scopedFlowManagerService1.SetFlowDataCacheItem("A", new List <string> {
                "First", "Second"
            });

            Assert.Empty(scopedFlowManagerService2.FlowManager.FlowDataCache.Items);
            Assert.Equal("Second", ((List <string>)scopedFlowManagerService1.FlowManager.FlowDataCache.Items["A"])[1]);
        }
 protected Task NavigateNext(CommandButtonDescriptor button)
 {
     using (IScopedFlowManagerService flowManagerService = App.ServiceProvider.GetRequiredService <IScopedFlowManagerService>())
     {
         flowManagerService.CopyFlowItems();
         return(flowManagerService.Next
                (
                    new CommandButtonRequest
         {
             NewSelection = button.ShortString
         }
                ));
     }
 }
Esempio n. 6
0
        private async void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.CurrentSelection.Count != 1)
            {
                return;
            }

            if (!(e.CurrentSelection.First() is NavigationMenuItemDescriptor item))
            {
                return;
            }

            if (item.Active)
            {
                return;
            }

            DisposeCurrentPageBindingContext(Detail);

            using (IScopedFlowManagerService flowManagerService = App.ServiceProvider.GetRequiredService <IScopedFlowManagerService>())
            {
                flowManagerService.CopyPersistentFlowItems();
                await flowManagerService.NewFlowStart
                (
                    new Flow.Requests.NewFlowRequest {
                    InitialModuleName = item.InitialModule
                }
                );
            }

            void DisposeCurrentPageBindingContext(Page detail)
            {
                if (detail is not NavigationPage navigationPage)
                {
                    return;
                }

                if (navigationPage?.RootPage.BindingContext is not IDisposable disposable)
                {
                    return;
                }

                disposable.Dispose();
            }
        }