RandomMainPage.axaml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <UserControl
  2. x:Class="ShakerApp.Views.RandomMainPage"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="using:ShakerApp"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:models="using:Shaker.Models"
  9. xmlns:oxy="http://oxyplot.org/avalonia"
  10. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  11. xmlns:view="using:ShakerApp.Views"
  12. xmlns:vm="using:ShakerApp.ViewModels"
  13. d:DesignHeight="450"
  14. d:DesignWidth="800"
  15. x:DataType="vm:RandomMainPageViewModel"
  16. DataContext="{Binding Source={x:Static vm:RandomMainPageViewModel.Instance}}"
  17. mc:Ignorable="d">
  18. <Grid ColumnDefinitions="220,*">
  19. <ScrollViewer Grid.Column="0">
  20. <StackPanel>
  21. <view:ShakerMiniStatusControl />
  22. <view:OilMinView IsVisible="{Binding Source={x:Static vm:OilSourceStatusViewModel.Instance}, Path=IsEnabled}" />
  23. <Expander ExpandDirection="Down" IsExpanded="True">
  24. <Expander.Header>
  25. <TextBlock
  26. FontSize="24"
  27. FontWeight="Bold"
  28. Text="{DynamicResource TestInfo}" />
  29. </Expander.Header>
  30. <StackPanel Margin="4,0,0,0">
  31. <StackPanel>
  32. <TextBlock>
  33. <Run Text="{DynamicResource RandomTestStep}" />
  34. <Run Text=":" />
  35. </TextBlock>
  36. <TextBlock Text="{local:ResourceBinding RandomTestStepKey}" />
  37. </StackPanel>
  38. <StackPanel>
  39. <TextBlock>
  40. <Run Text="{DynamicResource CurrentIdentifyDisplacement}" />
  41. <Run Text=":" />
  42. </TextBlock>
  43. <TextBlock Text="{Binding CurrentIdentifyDisplacement, StringFormat='{}{0:F4}mm'}" />
  44. </StackPanel>
  45. <StackPanel>
  46. <TextBlock>
  47. <Run Text="{DynamicResource CurrentIdentifyRms}" />
  48. <Run Text=":" />
  49. </TextBlock>
  50. <TextBlock Text="{Binding TimeDomainRMS, StringFormat='{}{0:F4}g'}" />
  51. </StackPanel>
  52. <StackPanel>
  53. <TextBlock>
  54. <Run Text="{DynamicResource IdentifyIndex}" />
  55. <Run Text=":" />
  56. </TextBlock>
  57. <TextBlock Text="{Binding IdentifyIndex}" />
  58. </StackPanel>
  59. <StackPanel IsVisible="{Binding RandomTestStep, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static models:RandomTestStep.Test}}">
  60. <TextBlock>
  61. <Run Text="{DynamicResource CurrentTestLevel}" />
  62. <Run Text=":" />
  63. </TextBlock>
  64. <TextBlock Text="{Binding CurrentTestLevel, StringFormat='{}{0:F1}dB'}" />
  65. </StackPanel>
  66. <StackPanel IsVisible="{Binding RandomTestStep, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static models:RandomTestStep.Test}}">
  67. <TextBlock>
  68. <Run Text="{DynamicResource CurrentTestTime}" />
  69. <Run Text=":" />
  70. </TextBlock>
  71. <TextBlock Text="{Binding CurrentTestTime, Converter={StaticResource TimeToStringConverter}}" />
  72. </StackPanel>
  73. <StackPanel IsVisible="{Binding RandomTestStep, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static models:RandomTestStep.Test}}">
  74. <TextBlock>
  75. <Run Text="{DynamicResource CurrentLevelTestMaxTime}" />
  76. <Run Text=":" />
  77. </TextBlock>
  78. <TextBlock Text="{Binding CurrentLevelTestMaxTime, Converter={StaticResource TimeToStringConverter}}" />
  79. </StackPanel>
  80. <StackPanel IsVisible="{Binding RandomTestStep, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static models:RandomTestStep.Test}}">
  81. <TextBlock>
  82. <Run Text="{DynamicResource RunTime}" />
  83. <Run Text=":" />
  84. </TextBlock>
  85. <TextBlock
  86. FontSize="24"
  87. FontWeight="Black"
  88. Text="{Binding TestTotalRunTime, Converter={StaticResource TimeToStringConverter}}" />
  89. </StackPanel>
  90. <view:RandomLevelView IsVisible="{Binding NextButtonVisilily}" />
  91. </StackPanel>
  92. </Expander>
  93. </StackPanel>
  94. </ScrollViewer>
  95. <oxy:PlotView
  96. Grid.Column="1"
  97. Background="Transparent"
  98. Model="{Binding PlotModel}">
  99. <oxy:PlotView.DefaultTrackerTemplate>
  100. <ControlTemplate>
  101. <oxy:TrackerControl
  102. Background="#6F999999"
  103. BorderBrush="Transparent"
  104. CornerRadius="6"
  105. HorizontalLineVisibility="False"
  106. LineExtents="{Binding PlotModel.PlotArea}"
  107. LineStroke="Gray"
  108. Position="{Binding Position}"
  109. ShowPointer="True"
  110. VerticalLineVisibility="True">
  111. <oxy:TrackerControl.Content>
  112. <StackPanel Margin="10">
  113. <TextBlock Text="{DynamicResource Value}" />
  114. <TextBlock>
  115. <Run Text="{Binding XAxis.Title}" />
  116. <Run Text=":" />
  117. <Run Text="{Binding TrackerDatas[0].DataPoint.X, StringFormat='{}{0:F2}'}" />
  118. <Run Text="{Binding XAxis.Unit}" />
  119. </TextBlock>
  120. <ItemsControl ItemsSource="{Binding TrackerDatas}">
  121. <ItemsControl.ItemTemplate>
  122. <DataTemplate>
  123. <TextBlock IsVisible="{Binding Series.IsVisible}">
  124. <Run Text="{Binding Series.Title}" />
  125. <Run Text=":" />
  126. <Run Text="{Binding DataPoint.Y, StringFormat='{}{0:F4}'}" />
  127. <Run Text="{Binding $parent[ItemsControl].DataContext.YAxis.Unit}" />
  128. </TextBlock>
  129. </DataTemplate>
  130. </ItemsControl.ItemTemplate>
  131. </ItemsControl>
  132. </StackPanel>
  133. </oxy:TrackerControl.Content>
  134. </oxy:TrackerControl>
  135. </ControlTemplate>
  136. </oxy:PlotView.DefaultTrackerTemplate>
  137. </oxy:PlotView>
  138. <Button
  139. Grid.Column="1"
  140. Margin="0,0,16,56"
  141. HorizontalAlignment="Right"
  142. VerticalAlignment="Bottom"
  143. Classes="Basic"
  144. Cursor="Hand">
  145. <Interaction.Behaviors>
  146. <EventTriggerBehavior EventName="Click">
  147. <InvokeCommandAction Command="{Binding Source={x:Static vm:PlotConfigViewModel.Instance}, Path=PlotConfigCommand}" CommandParameter="{Binding PlotModel}" />
  148. </EventTriggerBehavior>
  149. </Interaction.Behaviors>
  150. <PathIcon Background="Transparent" Data="{StaticResource SettingGeometry}">
  151. <PathIcon.Styles>
  152. <Style Selector="PathIcon:pointerover">
  153. <Setter Property="Foreground" Value="Black" />
  154. </Style>
  155. <Style Selector="PathIcon">
  156. <Setter Property="Foreground" Value="#AAAAAAAA" />
  157. </Style>
  158. </PathIcon.Styles>
  159. </PathIcon>
  160. </Button>
  161. </Grid>
  162. </UserControl>