Since I just posted about the dialog box and the timer to catch the value.
It makes sense to do a small third post mixing it all together with a DataListPanel in a Dialog window.
Again, there was problem starting the DataListPanel with values in the DialogBox. But solved the same way as previous.
Link to Timer: Using the timer .
Link to Dialog: Creating a Dialog Window.
The layout here is not very sexy as it’s still under construction, but it’s an idea worth sharing.
The whole point is to be able to add extra lines to the purchase orders based on calculations done in the background with SQL from Web Service, and start the DataListPanel on startup in a new Dialog Window.
This is not a complete working xaml file, but part of the Dialog window containing the DataListPanel
<Grid Height="700" Width="1200" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ui="clr-namespace:Mango.UI.Controls;assembly=Mango.UI" xmlns:mashup="clr-namespace:Mango.UI.Services.Mashup;assembly=Mango.UI" xmlns:m3="clr-namespace:MForms.Mashup;assembly=MForms" xmlns:clr="clr-namespace:System;assembly=mscorlib" xmlns:Services="clr-namespace:Mango.Services;assembly=Mango.Core" xmlns:ps="clr-namespace:PF.Client.Mashup;assembly=PF.Client"> <Grid.Resources> <mashup:CurrentItemValue x:Key="CurrentItemValue" /> <clr:String x:Key="BaseUri">{mashup:ProfileValue Path=M3/WebService/url}"</clr:String> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="50" /> <RowDefinition Height="500" /> <RowDefinition Height="50" /> </Grid.RowDefinitions> <StackPanel Orientation="Vertical" Grid.Row="0"> <mashup:Dialog Name="MyDialog" Uri="DialogAddPO.xaml" Grid.Column="0" Grid.Row="0"> </mashup:Dialog> <TextBox Name="SupplierNumber" Grid.Row="0" Grid.Column="3" MinWidth="115" MinHeight="20" MaxWidth="115" MaxHeight="50" HorizontalAlignment="Left" MaxLength="18" Text="{Binding Converter={StaticResource CurrentItemValue}, ConverterParameter=Result, Mode=OneTime}" IsEnabled="False" /> <TextBox Name="PONumber" Grid.Row="0" Grid.Column="3" MinWidth="115" MinHeight="20" MaxWidth="115" MaxHeight="50" HorizontalAlignment="Left" MaxLength="18" Text="{Binding Converter={StaticResource CurrentItemValue}, ConverterParameter=PONumber, Mode=OneWay}" IsEnabled="False" /> </StackPanel> <!-- Timer to catch the SupplierNumber value andprovide it to the DataListPanel --> <ps:TriggerPanel Name="SQLReorderTrigger" IsDataAreaInSession="False" IsAsynchronous="True" IsAutoLayoutEnabled="True" IsConversionEnabled="True" IsResponseValidationEnabled="False"> <ps:TriggerPanel.Events> <mashup:Events> <mashup:Event TargetName="SQLTriggerTimer" SourceEventName="Startup" TargetEventName="Start" /> </mashup:Events> </ps:TriggerPanel.Events> </ps:TriggerPanel> <mashup:Timer Name="SQLTriggerTimer" Interval="0:0:01" ElapsedCount="1" Count="1" MinInterval="0:0:01" /> <!-- Hidden TextBlock to get the CurrentSystem. Dynamic for PRD/TST/DEV/MIG --> <TextBlock Name="ProfileName" DataContext="{x:Static Services:ApplicationServices.SystemProfile}" Text="{Binding Name}" Grid.Row="0" Visibility="Hidden" /> <mashup:DataListPanel Name="SQLReorderPointPanel" Grid.Row="1"> <mashup:DataListPanel.Events> <mashup:Events> <mashup:Event SourceEventName="Elapsed" TargetName="SQLReorderPointPanel" TargetEventName="Read" Debug="True" SourceName="SQLTriggerTimer"> <mashup:Parameter TargetKey="BaseUri" Value="{mashup:ProfileValue Path=M3/WebService/url}" /> <mashup:Parameter TargetKey="Profile" Value="{Binding ElementName=ProfileName, Path=Text}" /> <mashup:Parameter TargetKey="WS.Wsdl" Value="{}{BaseUri}/LWSSQL{}{Profile}/SQL_Reorderpoint?wsdl" /> <mashup:Parameter TargetKey="WS.Address" Value="{}{BaseUri}/LWSSQL{}{Profile}/SQL_Reorderpoint" /> <mashup:Parameter TargetKey="WS.MaxReceivedMessageSize" Value="2000000" /> </mashup:Event> </mashup:Events> </mashup:DataListPanel.Events> <mashup:DataListPanel.DataService> <mashup:DataService Type="WS"> <mashup:DataService.Operations> <mashup:DataOperation Name="Read"> <mashup:DataParameter Key="WS.CredentialSource" Value="Current" /> <mashup:DataParameter Key="WS.Operation" Value="GetList" /> <mashup:DataParameter Key="WS.Contract" Value="SQL_Reorderpoint" /> </mashup:DataOperation> </mashup:DataService.Operations> </mashup:DataService> </mashup:DataListPanel.DataService> <DataGrid Name="Reorder" ItemsSource="{Binding ResultSetCollection, Mode=OneWay}" Grid.Row="1" Style="{DynamicResource styleDataGrid}" CanUserDeleteRows="True" SelectionMode="Single" SelectedIndex="0" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn Header="Item" Binding="{Binding MBITNO}" /> <DataGridTextColumn Header="Description" Binding="{Binding MMFUDS}" /> <DataGridTextColumn Header="Min" Binding="{Binding MBREOP, StringFormat=f0}" /> <DataGridTextColumn Header="Max" Binding="{Binding MBMXST, StringFormat=f0}" /> <DataGridTextColumn Header="Usage" Binding="{Binding MBUSYE, StringFormat=f0}" /> <DataGridTextColumn Header="On-Hand" Binding="{Binding MBAVAL, StringFormat=f0}" /> <DataGridTextColumn Header="In Order" Binding="{Binding MBORQT, StringFormat=f0}" /> <DataGridTextColumn Header="Lead Time" Binding="{Binding MBLEA1, StringFormat=f0}" /> <DataGridTextColumn Header="Supplier" Binding="{Binding IDSUNM}" /> <DataGridTemplateColumn Header="Qty"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Vertical"> <TextBox Text="0" MinWidth="50" MaxLength="5" MaxWidth="50" /> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> <DataGridTemplateColumn Header="Add to PO"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Name="ProfileName2" DataContext="{x:Static Services:ApplicationServices.SystemProfile}" Text="{Binding Name}" Visibility="Hidden" /> <Button Name="AddReorderLine" Content="Add" VerticalAlignment="Top"> <Button.CommandParameter> <mashup:Events> <mashup:Event SourceEventName="Click" TargetName="WSReorderAddLine" TargetEventName="Read" Debug="True"> <mashup:Parameter TargetKey="BaseUri" Value="{mashup:ProfileValue Path=M3/WebService/url}" /> <mashup:Parameter TargetKey="Profile" Value="{Binding ElementName=ProfileName2, Path=Text}" /> <mashup:Parameter TargetKey="WS.Wsdl" Value="{}{BaseUri}/lws_{}{Profile}/PPS200_AddLine?wsdl" /> <mashup:Parameter TargetKey="WS.Address" Value="{}{BaseUri}/lws_{}{Profile}/PPS200_AddLine" /> <mashup:Parameter TargetKey="WS.MaxReceivedMessageSize" Value="2000000" /> </mashup:Event> </mashup:Events> </Button.CommandParameter> </Button> </StackPanel> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> </mashup:DataListPanel> <mashup:DataPanel Name="WSReorderAddLine"> <mashup:DataPanel.DataService> <mashup:DataService Type="WS"> <mashup:DataService.Operations> <mashup:DataOperation Name="Read"> <mashup:DataParameter Key="WS.Operation" Value="PPS200_AddLine" /> <mashup:DataParameter Key="WS.Contract" Value="PPS200_AddLine" /> <mashup:DataParameter Key="WS.CredentialSource" Value="Current" /> </mashup:DataOperation> </mashup:DataService.Operations> </mashup:DataService> </mashup:DataPanel.DataService> </mashup:DataPanel> <StackPanel Grid.Row="3"> <Button Content="Close"> <Button.CommandParameter> <mashup:Events> <mashup:Event SourceEventName="Click" TargetEventName="Close"> <mashup:Parameter TargetKey="Result" Value="{Binding ElementName=ProfileName, Path=Text}" /> </mashup:Event> </mashup:Events> </Button.CommandParameter> </Button> </StackPanel> </Grid>
Regards
Ken Eric
Hi Ken,
When you are sure that you’ll have return from the SQL WS by testing in tool://wstest what could be the cause of the panel not showing the rows(header are showing fine)?
LikeLike