MainWindow.axaml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <Window xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:vm="using:YZWater.Core.ViewModels"
  4. xmlns:views="using:YZWater.Avalonia.Views"
  5. xmlns:conv="using:YZWater.Avalonia.Converters"
  6. xmlns:th="using:YZWater.Avalonia.Controls"
  7. x:Class="YZWater.Avalonia.Views.MainWindow"
  8. x:DataType="vm:MainViewModel"
  9. Title="{Binding Title}"
  10. Width="1280" Height="800"
  11. MinWidth="1024" MinHeight="700"
  12. WindowStartupLocation="CenterScreen"
  13. Background="{DynamicResource AppBgBrush}">
  14. <Window.DataContext>
  15. <vm:MainViewModel/>
  16. </Window.DataContext>
  17. <DockPanel>
  18. <!-- ═══ 底部导航栏 ═══ -->
  19. <Border x:Name="NavBar" DockPanel.Dock="Bottom" Background="{DynamicResource NavBgBrush}"
  20. BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0" Padding="4,0">
  21. <Grid ColumnDefinitions="*,Auto,Auto">
  22. <!-- 导航按钮 -->
  23. <StackPanel Grid.Column="0" Orientation="Horizontal" HorizontalAlignment="Center" Spacing="0">
  24. <Button Command="{Binding ShowViewACommand}" Padding="20,8" BorderThickness="0" Background="Transparent">
  25. <StackPanel Orientation="Horizontal" Spacing="6">
  26. <Border Width="3" Height="14" CornerRadius="1"
  27. Background="{Binding IsTabAActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  28. <TextBlock Text="{Binding NavProcess}" FontFamily="Consolas, monospace" FontSize="11"
  29. FontWeight="{Binding IsTabAActive, Converter={x:Static conv:BoolConverters.ToFontWeight}}"
  30. Foreground="{Binding IsTabAActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  31. </StackPanel>
  32. </Button>
  33. <Border Background="{DynamicResource BorderBrush}" Width="1" Height="20" VerticalAlignment="Center"/>
  34. <Button Command="{Binding ShowViewBCommand}" Padding="20,8" BorderThickness="0" Background="Transparent">
  35. <StackPanel Orientation="Horizontal" Spacing="6">
  36. <Border Width="3" Height="14" CornerRadius="1"
  37. Background="{Binding IsTabBActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  38. <TextBlock Text="{Binding NavParams}" FontFamily="Consolas, monospace" FontSize="11"
  39. FontWeight="{Binding IsTabBActive, Converter={x:Static conv:BoolConverters.ToFontWeight}}"
  40. Foreground="{Binding IsTabBActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  41. </StackPanel>
  42. </Button>
  43. <Border Background="{DynamicResource BorderBrush}" Width="1" Height="20" VerticalAlignment="Center"/>
  44. <Button Command="{Binding ShowViewCCommand}" Padding="20,8" BorderThickness="0" Background="Transparent">
  45. <StackPanel Orientation="Horizontal" Spacing="6">
  46. <Border Width="3" Height="14" CornerRadius="1"
  47. Background="{Binding IsTabCActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  48. <TextBlock Text="{Binding NavFlow}" FontFamily="Consolas, monospace" FontSize="11"
  49. FontWeight="{Binding IsTabCActive, Converter={x:Static conv:BoolConverters.ToFontWeight}}"
  50. Foreground="{Binding IsTabCActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  51. </StackPanel>
  52. </Button>
  53. <Border Background="{DynamicResource BorderBrush}" Width="1" Height="20" VerticalAlignment="Center"/>
  54. <Button Command="{Binding ShowViewDCommand}" Padding="20,8" BorderThickness="0" Background="Transparent">
  55. <StackPanel Orientation="Horizontal" Spacing="6">
  56. <Border Width="3" Height="14" CornerRadius="1"
  57. Background="{Binding IsTabDActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  58. <TextBlock Text="{Binding NavAlarm}" FontFamily="Consolas, monospace" FontSize="11"
  59. FontWeight="{Binding IsTabDActive, Converter={x:Static conv:BoolConverters.ToFontWeight}}"
  60. Foreground="{Binding IsTabDActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  61. </StackPanel>
  62. </Button>
  63. <Border Background="{DynamicResource BorderBrush}" Width="1" Height="20" VerticalAlignment="Center"/>
  64. <Button Command="{Binding ShowViewECommand}" Padding="20,8" BorderThickness="0" Background="Transparent">
  65. <StackPanel Orientation="Horizontal" Spacing="6">
  66. <Border Width="3" Height="14" CornerRadius="1"
  67. Background="{Binding IsTabEActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  68. <TextBlock Text="{Binding NavAbout}" FontFamily="Consolas, monospace" FontSize="11"
  69. FontWeight="{Binding IsTabEActive, Converter={x:Static conv:BoolConverters.ToFontWeight}}"
  70. Foreground="{Binding IsTabEActive, Converter={x:Static conv:BoolConverters.ToBrush}}"/>
  71. </StackPanel>
  72. </Button>
  73. </StackPanel>
  74. <!-- 主题切换 -->
  75. <Button Grid.Column="1" Command="{Binding ToggleThemeCommand}" Classes="btn-toggle" Margin="8,0">
  76. <StackPanel Orientation="Horizontal" Spacing="6">
  77. <TextBlock Text="{Binding ThemeIcon}" FontSize="14" VerticalAlignment="Center"/>
  78. <TextBlock Text="THEME" FontSize="10" VerticalAlignment="Center"
  79. Foreground="{DynamicResource TextSecondaryBrush}"/>
  80. </StackPanel>
  81. </Button>
  82. <!-- 语言切换 -->
  83. <Button Grid.Column="2" Command="{Binding ToggleLanguageCommand}" Classes="btn-toggle" Margin="0,0,8,0">
  84. <StackPanel Orientation="Horizontal" Spacing="6">
  85. <TextBlock Text="{Binding LangIcon}" FontSize="12" FontWeight="Bold" VerticalAlignment="Center"/>
  86. <TextBlock Text="LANG" FontSize="10" VerticalAlignment="Center"
  87. Foreground="{DynamicResource TextSecondaryBrush}"/>
  88. </StackPanel>
  89. </Button>
  90. </Grid>
  91. </Border>
  92. <!-- ═══ 主内容区域 ═══ -->
  93. <TabControl SelectedIndex="{Binding SelectedTabIndex}" Background="{DynamicResource AppBgBrush}">
  94. <TabItem Header="PROCESS" IsVisible="False">
  95. <views:ViewAView/>
  96. </TabItem>
  97. <TabItem Header="PARAMS" IsVisible="False">
  98. <views:ViewBView/>
  99. </TabItem>
  100. <TabItem Header="FLOW" IsVisible="False">
  101. <views:ViewCView/>
  102. </TabItem>
  103. <TabItem Header="ALARM" IsVisible="False">
  104. <views:ViewDView/>
  105. </TabItem>
  106. <TabItem Header="ABOUT" IsVisible="False">
  107. <views:ViewEView/>
  108. </TabItem>
  109. </TabControl>
  110. </DockPanel>
  111. </Window>