Browse Source

添加细节信息

master
Administrator 2 months ago
parent
commit
d8c28f25e2
  1. 225
      InfoDetail.xaml
  2. 75
      InfoDetail.xaml.cs
  3. 13
      Models/DataSource.cs
  4. 3
      NotificationView/MessagePage.xaml
  5. 5
      NotificationView/MessagePage.xaml.cs

225
InfoDetail.xaml

@ -9,141 +9,144 @@
<converters:StringToImageConverter x:Key="StringToImageConverter" /> <converters:StringToImageConverter x:Key="StringToImageConverter" />
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
<VerticalStackLayout> <Grid RowDefinitions="Auto, *, *" ColumnDefinitions="*, Auto" >
<Grid> <Grid BackgroundColor="#CCCCCC" Padding="10" Grid.Row="0" Grid.Column="0" >
<Grid> <HorizontalStackLayout>
<VerticalStackLayout> <!-- 图片 -->
<Grid BackgroundColor="#CCCCCC" Padding="10"> <Image WidthRequest="150" HeightRequest="150"
<HorizontalStackLayout>
<!-- 图片 -->
<Image WidthRequest="150" HeightRequest="150"
Source="{Binding Path=Model, Converter={StaticResource StringToImageConverter}}"/> Source="{Binding Path=Model, Converter={StaticResource StringToImageConverter}}"/>
<!-- 设备状态 --> <!-- 设备状态 -->
<VerticalStackLayout> <VerticalStackLayout>
<Label Text="{Binding Name}" FontAttributes="Bold" <Label Text="{Binding Name}" FontAttributes="Bold"
FontSize="24" TextColor="Black" Padding="5"/> FontSize="24" TextColor="Black" Padding="5"/>
<HorizontalStackLayout> <HorizontalStackLayout>
<Label Text="状态: " FontAttributes="Bold" <Label Text="状态: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold" <Label Text="{Binding State}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
<HorizontalStackLayout> <HorizontalStackLayout>
<Label Text="机台: " FontAttributes="Bold" <Label Text="机台: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding Machine}" FontAttributes="Bold" <Label Text="{Binding Machine}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
</VerticalStackLayout>
</HorizontalStackLayout>
</Grid>
<BoxView HeightRequest="3" Color="#CCCCCC" />
<HorizontalStackLayout BackgroundColor="#F0F0F0" HeightRequest="50">
<Button Text="实时信息" Clicked="Button_real" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="设备信息" Clicked="Button_machine" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="执行历史" Clicked="Button_history" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="远程控制" Clicked="Button_control" BackgroundColor="Transparent" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</VerticalStackLayout>
<Grid x:Name="_real" > </HorizontalStackLayout>
<!-- 设备信息 --> </Grid>
<Label Text="{Binding ModelA}" FontAttributes="Bold" FontSize="22" TextColor="Black" <!-- 选项 -->
<Grid Grid.Row="1" Grid.Column="0" HeightRequest="50">
<HorizontalStackLayout BackgroundColor="#F0F0F0" HeightRequest="50">
<Button Text="实时信息" Clicked="Button_real" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="设备信息" Clicked="Button_machine" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="执行历史" Clicked="Button_history" BackgroundColor="Transparent" TextColor="Black"/>
<Button Text="远程控制" Clicked="Button_control" BackgroundColor="Transparent" TextColor="Black"/>
</HorizontalStackLayout>
</Grid>
<Grid x:Name="_real" Grid.Row="2" Grid.Column="0" >
<VerticalStackLayout VerticalOptions="Center">
<!-- 设备信息 -->
<Label Text="{Binding ModelA}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelA, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelA, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding ModelB}" FontAttributes="Bold" FontSize="22" TextColor="Black" <Label Text="{Binding ModelB}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelB, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelB, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding ModelC}" FontAttributes="Bold" FontSize="22" TextColor="Black" <Label Text="{Binding ModelC}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelC, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelC, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding ModelD}" FontAttributes="Bold" FontSize="22" TextColor="Black" <Label Text="{Binding ModelD}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelD, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelD, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding ModelE}" FontAttributes="Bold" FontSize="22" TextColor="Black" <Label Text="{Binding ModelE}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelE, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelE, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding ModelF}" FontAttributes="Bold" FontSize="22" TextColor="Black" <Label Text="{Binding ModelF}" FontAttributes="Bold" FontSize="22" TextColor="Black"
IsVisible="{Binding Path=ModelF, Converter={StaticResource StringToBoolConverter}}"/> IsVisible="{Binding Path=ModelF, Converter={StaticResource StringToBoolConverter}}"/>
<Label Text="{Binding Information}" FontAttributes="Bold" <Label Text="{Binding Information}" FontAttributes="Bold" FontSize="22" TextColor="Black"/>
FontSize="22" TextColor="Black"/> </VerticalStackLayout>
</Grid> </Grid>
<!-- 设备内容 --> <!-- 设备内容 -->
<Grid x:Name="_machine" IsVisible="False"> <Grid x:Name="_machine" IsVisible="False" Grid.Row="2" Grid.Column="0" BackgroundColor="#F0F0F0">
<CollectionView x:Name="CardCollectionView_machine" <CollectionView x:Name="CardCollectionView_machine" RemainingItemsThreshold="5">
RemainingItemsThreshold="5"> <CollectionView.ItemTemplate>
<CollectionView.ItemTemplate> <DataTemplate>
<DataTemplate> <Border BackgroundColor="White" Stroke="#CCCCCC"
<Border BackgroundColor="White" Stroke="#CCCCCC" StrokeThickness="2" Margin="10,0,10,10" StrokeShape="RoundRectangle 10">
StrokeThickness="2" Margin="10,0,10,10" <VerticalStackLayout VerticalOptions="Center">
StrokeShape="RoundRectangle 10"> <HorizontalStackLayout>
<VerticalStackLayout VerticalOptions="Center"> <Label Text="名称: " FontAttributes="Bold"
<HorizontalStackLayout> FontSize="22" TextColor="Black"/>
<Label Text="名称: " FontAttributes="Bold" <Label Text="{Binding ProductName}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold" </HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="代码: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding ProductCode}" FontAttributes="Bold"
<Label Text="代码: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold" </HorizontalStackLayout>
<HorizontalStackLayout>
<Label Text="状态: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding ProductState}" FontAttributes="Bold"
<Label Text="状态: " FontAttributes="Bold" FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
<BoxView HeightRequest="3" Color="#CCCCCC" />
<HorizontalStackLayout>
<Label Text="信息: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold" <Label Text="{Binding ProductInf}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
<Label Text="信息: " FontAttributes="Bold" <!-- 历史 -->
<Grid x:Name="_history" IsVisible="False" Grid.Row="2" Grid.Column="0" BackgroundColor="#F0F0F0">
<CollectionView x:Name="CardCollectionView_history" RemainingItemsThreshold="5">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border BackgroundColor="White" Stroke="#CCCCCC"
StrokeThickness="2" Margin="10,0,10,10"
StrokeShape="RoundRectangle 10">
<VerticalStackLayout VerticalOptions="Center">
<HorizontalStackLayout>
<Label Text="工单: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold" <Label Text="{Binding Dyelot}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/> FontSize="22" TextColor="Black"/>
</HorizontalStackLayout> </HorizontalStackLayout>
</VerticalStackLayout> <HorizontalStackLayout>
</Border> <Label Text="染机: " FontAttributes="Bold"
</DataTemplate> FontSize="22" TextColor="Black"/>
</CollectionView.ItemTemplate> <Label Text="{Binding Machine}" FontAttributes="Bold"
</CollectionView> FontSize="22" TextColor="Black"/>
</Grid> </HorizontalStackLayout>
<HorizontalStackLayout>
<!-- 历史 --> <Label Text="时间: " FontAttributes="Bold"
<Grid x:Name="_history" IsVisible="False"> FontSize="22" TextColor="Black"/>
<CollectionView x:Name="CardCollectionView_history" <Label Text="{Binding EndTime}" FontAttributes="Bold"
RemainingItemsThreshold="5"> FontSize="22" TextColor="Black"/>
<CollectionView.ItemTemplate> </HorizontalStackLayout>
<DataTemplate> <BoxView HeightRequest="3" Color="#CCCCCC" />
<Border BackgroundColor="White" Stroke="#CCCCCC" <HorizontalStackLayout>
StrokeThickness="2" Margin="10,0,10,10" <Label Text="信息: " FontAttributes="Bold"
StrokeShape="RoundRectangle 10"> FontSize="22" TextColor="Black"/>
<VerticalStackLayout VerticalOptions="Center"> <Label Text="{Binding Information}" FontAttributes="Bold"
<HorizontalStackLayout> FontSize="22" TextColor="Black"/>
<Label Text="工单: " FontAttributes="Bold" </HorizontalStackLayout>
FontSize="22" TextColor="Black"/> </VerticalStackLayout>
<Label Text="{Binding State}" FontAttributes="Bold" </Border>
FontSize="22" TextColor="Black"/> </DataTemplate>
<Label Text="染机: " FontAttributes="Bold" </CollectionView.ItemTemplate>
FontSize="22" TextColor="Black"/> </CollectionView>
<Label Text="{Binding State}" FontAttributes="Bold" </Grid>
FontSize="22" TextColor="Black"/>
<Label Text="时间: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="信息: " FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
<Label Text="{Binding State}" FontAttributes="Bold"
FontSize="22" TextColor="Black"/>
</HorizontalStackLayout>
</VerticalStackLayout>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
<!-- 远程 --> <!-- 远程 -->
<Grid x:Name="_control" IsVisible="False"> <Grid x:Name="_control" IsVisible="False" Grid.Row="2" Grid.Column="0" BackgroundColor="#F0F0F0">
</Grid>
</VerticalStackLayout>
</Grid>
</Grid> </Grid>
</VerticalStackLayout>
</Grid>
</ContentPage> </ContentPage>

75
InfoDetail.xaml.cs

@ -1,17 +1,90 @@
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using SunlightAggregationTerminal.Models; using SunlightAggregationTerminal.Models;
using System.Collections.ObjectModel;
using System.Reflection.PortableExecutable; using System.Reflection.PortableExecutable;
namespace SunlightAggregationTerminal; namespace SunlightAggregationTerminal;
public partial class InfoDetail : ContentPage public partial class InfoDetail : ContentPage
{ {
public InfoDetail(InfoItem item) public static ObservableCollection<ProbuctItem> InfoProbuctItems { get; set; } = new();
public static ObservableCollection<DyelotItem> InfoDyelotItems { get; set; } = new();
public InfoDetail(InfoItem item)
{ {
InitializeComponent(); InitializeComponent();
this.BindingContext = item; this.BindingContext = item;
InfoProbuctItems.Add(new ProbuctItem { ProductName="cs", ProductCode="cs", ProductState="", ProductInf="" });
InfoProbuctItems.Add(new ProbuctItem { ProductName = "c23s", ProductCode = "cweds", ProductState = "", ProductInf = "" });
InfoProbuctItems.Add(new ProbuctItem { ProductName = "arf", ProductCode = "af", ProductState = "", ProductInf = "" });
InfoProbuctItems.Add(new ProbuctItem { ProductName = "afars", ProductCode = "cs", ProductState = "", ProductInf = "" });
InfoDyelotItems.Add(new DyelotItem { Dyelot = "2134566", Machine = "g01", CreationTime = "", CallTime = "" ,
FabricName = "21345122343566",
ColorName = "g01",
CustomerName = "",
EndTime = "",
StartTime = "",
Information = "yyjjy\nfxfxdsdg\n",
});
InfoDyelotItems.Add(new DyelotItem
{
Dyelot = "231423134566",
Machine = "g01",
CreationTime = "",
CallTime = "",
FabricName = "2134566",
ColorName = "g01",
CustomerName = "",
EndTime = "",
StartTime = "",
Information = "yyjjy\nfxfxdsdg\n",
});
InfoDyelotItems.Add(new DyelotItem
{
Dyelot = "2131324354566",
Machine = "g01",
CreationTime = "",
CallTime = "",
FabricName = "2134566",
ColorName = "g01",
CustomerName = "",
EndTime = "",
StartTime = "",
Information = "yyjjy\nfxfxdsdg\n",
});
InfoDyelotItems.Add(new DyelotItem
{
Dyelot = "2134123243566",
Machine = "g01",
CreationTime = "",
CallTime = "",
FabricName = "2134566",
ColorName = "g01",
CustomerName = "",
EndTime = "",
StartTime = "",
Information = "yyjjy\nfxfxdsdg\n",
});
InfoDyelotItems.Add(new DyelotItem
{
Dyelot = "2134566",
Machine = "g01",
CreationTime = "",
CallTime = "",
FabricName = "2134566",
ColorName = "g01",
CustomerName = "",
EndTime = "",
StartTime = "",
Information = "yyjjy\nfxfxdsdg\n",
});
CardCollectionView_machine.ItemsSource = InfoProbuctItems;
CardCollectionView_history.ItemsSource = InfoDyelotItems;
} }
private void Button_real(object sender, EventArgs e) private void Button_real(object sender, EventArgs e)

13
Models/DataSource.cs

@ -41,15 +41,26 @@ namespace SunlightAggregationTerminal.Models
public string? ModelE { get; set; } public string? ModelE { get; set; }
public string? ModelF { get; set; } public string? ModelF { get; set; }
} }
public partial class ProbuctItem
{
public string? ProductName { get; set; }
public string? ProductCode { get; set; }
public string? ProductState { get; set; }
public string? ProductInf { get; set; }
}
public class DyelotItem public class DyelotItem
{ {
public string? Dyelot { get; set; } public string? Dyelot { get; set; }
public string? Machine { get; set; } public string? Machine { get; set; }
public string? CreationTime { get; set; } public string? CreationTime { get; set; }
public string? CallTime { get; set; }
public string? FabricName { get; set; } public string? FabricName { get; set; }
public string? ColorName { get; set; } public string? ColorName { get; set; }
public string? CustomerName { get; set; } public string? CustomerName { get; set; }
public string? EndTime { get; set; }
public string? StartTime { get; set; }
public string? Information { get; set; }
} }
public static class DataService public static class DataService

3
NotificationView/MessagePage.xaml

@ -5,8 +5,7 @@
Title="信息"> Title="信息">
<CollectionView x:Name="CardCollectionView" <CollectionView x:Name="CardCollectionView"
ItemsSource="{Binding MessageItems}" ItemsSource="{Binding MessageItems}"
RemainingItemsThreshold="5" RemainingItemsThreshold="5">
RemainingItemsThresholdReached="CardCollectionView_RemainingItemsThresholdReached">
<!-- 保持滚动条 --> <!-- 保持滚动条 -->
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>

5
NotificationView/MessagePage.xaml.cs

@ -34,8 +34,5 @@ public partial class MessagePage : ContentPage
} }
} }
private void CardCollectionView_RemainingItemsThresholdReached(object sender, EventArgs e)
{
}
} }
Loading…
Cancel
Save