NetworkSettingView.axaml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <UserControl
  2. x:Class="ShakerApp.NetworkSettingView"
  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:model="using:ShakerApp.Models"
  9. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  10. xmlns:vm="using:ShakerApp.ViewModels"
  11. d:DesignHeight="450"
  12. d:DesignWidth="800"
  13. x:DataType="vm:ShakerSettingViewModel"
  14. DataContext="{Binding Source={x:Static vm:ShakerSettingViewModel.Instance}}"
  15. mc:Ignorable="d">
  16. <suki:GlassCard
  17. Width="600"
  18. Height="420"
  19. Margin="4"
  20. VerticalAlignment="Top">
  21. <Grid>
  22. <Grid.RowDefinitions>
  23. <RowDefinition Height="*" />
  24. <RowDefinition Height="36" />
  25. </Grid.RowDefinitions>
  26. <suki:GroupBox Header="{DynamicResource WorkingMode}">
  27. <UniformGrid Margin="0,4,0,0" Columns="2">
  28. <StackPanel
  29. Height="{StaticResource ItemHeight}"
  30. VerticalAlignment="Top"
  31. Orientation="Horizontal">
  32. <TextBlock
  33. HorizontalAlignment="Center"
  34. VerticalAlignment="Center"
  35. Text="{DynamicResource WorkingMode}" />
  36. <ComboBox
  37. Width="120"
  38. ItemsSource="{Binding WorkingMode, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
  39. SelectedValue="{Binding Path=WorkingMode}"
  40. SelectedValueBinding="{Binding Value}">
  41. <ComboBox.ItemTemplate>
  42. <DataTemplate>
  43. <TextBlock Text="{local:ResourceBinding Key}" />
  44. </DataTemplate>
  45. </ComboBox.ItemTemplate>
  46. </ComboBox>
  47. </StackPanel>
  48. <StackPanel
  49. Height="{StaticResource ItemHeight}"
  50. VerticalAlignment="Top"
  51. IsVisible="{Binding WorkingMode, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static model:WorkingMode.Local}}"
  52. Orientation="Horizontal">
  53. <TextBlock VerticalAlignment="Center" Text="{DynamicResource EnabledRemote}" />
  54. <ToggleSwitch Classes="Switch" IsChecked="{Binding EnabledRemote}" />
  55. </StackPanel>
  56. <StackPanel
  57. Height="{StaticResource ItemHeight}"
  58. VerticalAlignment="Top"
  59. Orientation="Horizontal">
  60. <TextBlock VerticalAlignment="Center" Text="{DynamicResource RemoteControlModel}" />
  61. <ComboBox
  62. Width="120"
  63. IsEnabled="{Binding !ServieIsStart}"
  64. ItemsSource="{Binding RemoteControlModel, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
  65. SelectedValue="{Binding Path=RemoteControlModel}"
  66. SelectedValueBinding="{Binding Value}">
  67. <ComboBox.ItemTemplate>
  68. <DataTemplate>
  69. <TextBlock Text="{local:ResourceBinding Key}" />
  70. </DataTemplate>
  71. </ComboBox.ItemTemplate>
  72. </ComboBox>
  73. </StackPanel>
  74. <StackPanel
  75. Height="{StaticResource ItemHeight}"
  76. VerticalAlignment="Top"
  77. IsEnabled="{Binding EnabledRemote}"
  78. IsVisible="{Binding WorkingMode, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static model:WorkingMode.Local}}"
  79. Orientation="Horizontal">
  80. <TextBlock VerticalAlignment="Center" Text="{DynamicResource AutoStartService}" />
  81. <ToggleSwitch Classes="Switch" IsChecked="{Binding AutoStartService}" />
  82. <Ellipse
  83. Width="12"
  84. Height="12"
  85. Classes.Start="{Binding ServieIsStart}">
  86. <Ellipse.Styles>
  87. <Style Selector="Ellipse">
  88. <Setter Property="Fill" Value="Red" />
  89. </Style>
  90. <Style Selector="Ellipse.Start">
  91. <Setter Property="Fill" Value="Green" />
  92. </Style>
  93. <Style Selector="Ellipse:disabled">
  94. <Setter Property="Fill" Value="Gray" />
  95. </Style>
  96. </Ellipse.Styles>
  97. </Ellipse>
  98. </StackPanel>
  99. <StackPanel
  100. Height="{StaticResource ItemHeight}"
  101. VerticalAlignment="Top"
  102. IsEnabled="{Binding !ServieIsStart}"
  103. Orientation="Horizontal">
  104. <TextBlock VerticalAlignment="Center" Text="{DynamicResource RemoteIP}" />
  105. <TextBox Width="120" Text="{Binding RemoteIP}" />
  106. </StackPanel>
  107. <StackPanel
  108. Height="{StaticResource ItemHeight}"
  109. VerticalAlignment="Top"
  110. IsEnabled="{Binding !ServieIsStart}"
  111. Orientation="Horizontal">
  112. <TextBlock VerticalAlignment="Center" Text="{DynamicResource RemotePort}" />
  113. <NumericUpDown
  114. Width="120"
  115. Margin="4,0,0,0"
  116. Increment="1"
  117. Maximum="65535"
  118. Minimum="1"
  119. Value="{Binding RemotePort}" />
  120. </StackPanel>
  121. </UniformGrid>
  122. </suki:GroupBox>
  123. <StackPanel
  124. Grid.Row="1"
  125. HorizontalAlignment="Center"
  126. VerticalAlignment="Center"
  127. IsEnabled="{Binding EnabledRemote}"
  128. IsVisible="{Binding WorkingMode, Converter={StaticResource EnumToBooleanConverter}, ConverterParameter={x:Static model:WorkingMode.Local}}"
  129. Orientation="Horizontal">
  130. <Button
  131. Width="106"
  132. Height="36"
  133. Command="{Binding StartServiceCommand}"
  134. Content="{DynamicResource StartService}"
  135. IsEnabled="{Binding !ServieIsStart}" />
  136. <Button
  137. Width="106"
  138. Height="36"
  139. Margin="120,0,0,0"
  140. Command="{Binding StopServiceCommand}"
  141. Content="{DynamicResource StopService}"
  142. IsEnabled="{Binding ServieIsStart}" />
  143. </StackPanel>
  144. </Grid>
  145. </suki:GlassCard>
  146. </UserControl>