RandomMainPage.axaml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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>
  81. </Expander>
  82. </StackPanel>
  83. </ScrollViewer>
  84. <oxy:PlotView
  85. Grid.Column="1"
  86. Background="Transparent"
  87. Model="{Binding PlotModel}">
  88. <oxy:PlotView.DefaultTrackerTemplate>
  89. <ControlTemplate>
  90. <oxy:TrackerControl
  91. Background="#6F999999"
  92. BorderBrush="Transparent"
  93. CornerRadius="6"
  94. HorizontalLineVisibility="False"
  95. LineExtents="{Binding PlotModel.PlotArea}"
  96. LineStroke="Gray"
  97. Position="{Binding Position}"
  98. ShowPointer="True"
  99. VerticalLineVisibility="True">
  100. <oxy:TrackerControl.Content>
  101. <StackPanel Margin="10">
  102. <TextBlock Text="{DynamicResource Value}" />
  103. <TextBlock>
  104. <Run Text="{Binding XAxis.Title}" />
  105. <Run Text=":" />
  106. <Run Text="{Binding TrackerDatas[0].DataPoint.X, StringFormat='{}{0:F2}'}" />
  107. <Run Text="{Binding XAxis.Unit}" />
  108. </TextBlock>
  109. <ItemsControl ItemsSource="{Binding TrackerDatas}">
  110. <ItemsControl.ItemTemplate>
  111. <DataTemplate>
  112. <TextBlock IsVisible="{Binding Series.IsVisible}">
  113. <Run Text="{Binding Series.Title}" />
  114. <Run Text=":" />
  115. <Run Text="{Binding DataPoint.Y, StringFormat='{}{0:F4}'}" />
  116. <Run Text="{Binding $parent[ItemsControl].DataContext.YAxis.Unit}" />
  117. </TextBlock>
  118. </DataTemplate>
  119. </ItemsControl.ItemTemplate>
  120. </ItemsControl>
  121. </StackPanel>
  122. </oxy:TrackerControl.Content>
  123. </oxy:TrackerControl>
  124. </ControlTemplate>
  125. </oxy:PlotView.DefaultTrackerTemplate>
  126. </oxy:PlotView>
  127. <Button
  128. Grid.Column="1"
  129. Margin="0,0,16,56"
  130. HorizontalAlignment="Right"
  131. VerticalAlignment="Bottom"
  132. Classes="Basic"
  133. Cursor="Hand">
  134. <Interaction.Behaviors>
  135. <EventTriggerBehavior EventName="Click">
  136. <InvokeCommandAction Command="{Binding Source={x:Static vm:PlotConfigViewModel.Instance}, Path=PlotConfigCommand}" CommandParameter="{Binding PlotModel}" />
  137. </EventTriggerBehavior>
  138. </Interaction.Behaviors>
  139. <PathIcon Background="Transparent" Data="{StaticResource SettingGeometry}">
  140. <PathIcon.Styles>
  141. <Style Selector="PathIcon:pointerover">
  142. <Setter Property="Foreground" Value="Black" />
  143. </Style>
  144. <Style Selector="PathIcon">
  145. <Setter Property="Foreground" Value="#AAAAAAAA" />
  146. </Style>
  147. </PathIcon.Styles>
  148. </PathIcon>
  149. </Button>
  150. </Grid>
  151. </UserControl>