MainWindow.xaml 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <Window x:Class="PingHandler.MainWindow"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. Title="Network Latency Monitor"
  5. Width="85"
  6. Height="45"
  7. Topmost="True"
  8. WindowStyle="None"
  9. AllowsTransparency="True"
  10. Background="Transparent"
  11. ResizeMode="NoResize"
  12. MouseDown="Window_MouseDown"
  13. LocationChanged="Window_LocationChanged"
  14. MouseEnter="Window_MouseEnter"
  15. MouseLeave="Window_MouseLeave">
  16. <Window.Resources>
  17. <Style x:Key="ColoredProgressBar" TargetType="ProgressBar">
  18. <Setter Property="Template">
  19. <Setter.Value>
  20. <ControlTemplate TargetType="ProgressBar">
  21. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="5">
  22. <Grid x:Name="PART_Track" Background="Transparent">
  23. <Rectangle x:Name="PART_Indicator" HorizontalAlignment="Left" Fill="{TemplateBinding Foreground}" />
  24. </Grid>
  25. </Border>
  26. </ControlTemplate>
  27. </Setter.Value>
  28. </Setter>
  29. <Setter Property="BorderBrush" Value="Black"/>
  30. <Setter Property="Foreground" Value="Green"/>
  31. <Setter Property="Height" Value="20"/>
  32. </Style>
  33. <Style x:Key="VerticalProgressBar" TargetType="ProgressBar">
  34. <Setter Property="Template">
  35. <Setter.Value>
  36. <ControlTemplate TargetType="ProgressBar">
  37. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" CornerRadius="5">
  38. <Grid x:Name="PART_Track" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
  39. <Rectangle x:Name="PART_Indicator" VerticalAlignment="Bottom" Fill="{TemplateBinding Foreground}" Width="20" HorizontalAlignment="Stretch" />
  40. </Grid>
  41. </Border>
  42. </ControlTemplate>
  43. </Setter.Value>
  44. </Setter>
  45. <Setter Property="BorderBrush" Value="Black"/>
  46. <Setter Property="Foreground" Value="Green"/>
  47. <Setter Property="Width" Value="20"/>
  48. </Style>
  49. </Window.Resources>
  50. <Grid>
  51. <Border x:Name="MainBorder" Background="#80000000" CornerRadius="5">
  52. <Grid>
  53. <Border BorderBrush="Black" BorderThickness="1" CornerRadius="5" Margin="5">
  54. <TextBlock x:Name="LatencyText"
  55. VerticalAlignment="Center"
  56. HorizontalAlignment="Center"
  57. FontWeight="Bold"
  58. Padding="5"/>
  59. </Border>
  60. <ProgressBar x:Name="LatencyProgressBar"
  61. VerticalAlignment="Bottom"
  62. Margin="5"
  63. Minimum="0"
  64. Maximum="200"
  65. Height="4"
  66. Style="{StaticResource ColoredProgressBar}"/>
  67. <Border x:Name="DragArea"
  68. Background="Transparent"
  69. HorizontalAlignment="Stretch"
  70. VerticalAlignment="Top"
  71. Height="20"
  72. MouseDown="Window_MouseDown"/>
  73. </Grid>
  74. </Border>
  75. </Grid>
  76. </Window>