feat: 그래프 화면 열고닫기 기능 추가

hhsung_work
HyungJune Kim 10 months ago
parent 5b60525279
commit 48cfad129e

@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows;
namespace SmartAquaViewer.Helper
{
public static class ImageButtonHelper
{
public static readonly DependencyProperty ImageSourceProperty =
DependencyProperty.RegisterAttached(
"ImageSource",
typeof(ImageSource),
typeof(ImageButtonHelper),
new PropertyMetadata(null));
public static void SetImageSource(UIElement element, ImageSource value)
{
element.SetValue(ImageSourceProperty, value);
}
public static ImageSource GetImageSource(UIElement element)
{
return (ImageSource)element.GetValue(ImageSourceProperty);
}
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SmartAquaViewer.Model
{
class Enums
{
public enum PanelState
{
Hidden,
Normal,
Expanded
}
}
}

@ -63,4 +63,35 @@
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ImageButtonStyle" TargetType="Button">
<Setter Property="Width" Value="58"/>
<Setter Property="Height" Value="42"/>
<Setter Property="Margin" Value="2.5 0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Image x:Name="PART_Image"
Source="{TemplateBinding helper:ImageButtonHelper.ImageSource}"
Stretch="Uniform"/>
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
RecognizesAccessKey="True"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Image" Property="Opacity" Value="0.8"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="PART_Image" Property="Opacity" Value="0.6"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="PART_Image" Property="Opacity" Value="0.4"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary> </ResourceDictionary>

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -19,9 +19,12 @@
<None Remove="Fonts\SCDream7.otf" /> <None Remove="Fonts\SCDream7.otf" />
<None Remove="Fonts\SCDream8.otf" /> <None Remove="Fonts\SCDream8.otf" />
<None Remove="Fonts\SCDream9.otf" /> <None Remove="Fonts\SCDream9.otf" />
<None Remove="Resources\Images\arrow_down.png" />
<None Remove="Resources\Images\arrow_up.png" />
<None Remove="Resources\Images\ListImage.png" /> <None Remove="Resources\Images\ListImage.png" />
<None Remove="Resources\Images\tab_bg.png" /> <None Remove="Resources\Images\tab_bg.png" />
<None Remove="Resources\Images\tab_bg_off.png" /> <None Remove="Resources\Images\tab_bg_off.png" />
<None Remove="Resources\Images\top_bg.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -39,6 +42,8 @@
<Resource Include="Fonts\SCDream7.otf" /> <Resource Include="Fonts\SCDream7.otf" />
<Resource Include="Fonts\SCDream8.otf" /> <Resource Include="Fonts\SCDream8.otf" />
<Resource Include="Fonts\SCDream9.otf" /> <Resource Include="Fonts\SCDream9.otf" />
<Resource Include="Resources\Images\arrow_down.png" />
<Resource Include="Resources\Images\arrow_up.png" />
<Resource Include="Resources\Images\ListImage.png" /> <Resource Include="Resources\Images\ListImage.png" />
<Resource Include="Resources\Images\tab_bg.png"> <Resource Include="Resources\Images\tab_bg.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@ -46,6 +51,7 @@
<Resource Include="Resources\Images\tab_bg_off.png"> <Resource Include="Resources\Images\tab_bg_off.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource> </Resource>
<Resource Include="Resources\Images\top_bg.png" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -4,6 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SmartAquaViewer.View" xmlns:local="clr-namespace:SmartAquaViewer.View"
xmlns:helper="clr-namespace:SmartAquaViewer.Helper"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="940" d:DesignWidth="1650"> d:DesignHeight="940" d:DesignWidth="1650">
<Border> <Border>
@ -11,10 +12,32 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="70"/> <RowDefinition Height="70"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="450"/> <RowDefinition x:Name="rdGraph" Height="450"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid>
<Grid.Background>
<ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/>
</Grid.Background>
</Grid>
<Border Grid.Row="1" Background="#243851" BorderThickness="0 0 0 3" BorderBrush="#455569">
<Grid>
<Button Name="btnVisibilityDown" Tag="down" Click="btnVisibility_Click"
Style="{StaticResource ImageButtonStyle}" Height="33"
VerticalAlignment="Bottom" HorizontalAlignment="Center"
helper:ImageButtonHelper.ImageSource="/Resources/Images/arrow_down.png"/>
<Button Name="btnVisibilityUp" Tag="up" Click="btnVisibility_Click"
Style="{StaticResource ImageButtonStyle}" Height="33"
VerticalAlignment="Bottom" HorizontalAlignment="Center" Visibility="Collapsed"
helper:ImageButtonHelper.ImageSource="/Resources/Images/arrow_up.png"/>
</Grid>
</Border>
<Grid Grid.Row="2" Background="#122136">
</Grid>
</Grid> </Grid>
</Border> </Border>
</UserControl> </UserControl>

@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using static SmartAquaViewer.Model.Enums;
namespace SmartAquaViewer.View namespace SmartAquaViewer.View
{ {
@ -20,9 +21,56 @@ namespace SmartAquaViewer.View
/// </summary> /// </summary>
public partial class MonitoringView : UserControl public partial class MonitoringView : UserControl
{ {
private PanelState _state = PanelState.Normal;
public MonitoringView() public MonitoringView()
{ {
InitializeComponent(); InitializeComponent();
} }
private void btnVisibility_Click(object sender, RoutedEventArgs e)
{
Button button = sender as Button;
if (button == null) return;
bool isDown = button.Tag != null && button.Tag.ToString() == "down";
_state = isDown
? _state switch
{
PanelState.Hidden => PanelState.Normal,
//PanelState.Normal => PanelState.Expanded,
_ => PanelState.Hidden
}
: _state switch
{
PanelState.Hidden => PanelState.Normal,
//PanelState.Expanded => PanelState.Normal,
_ => PanelState.Hidden
};
ApplyState();
}
private void ApplyState()
{
switch (_state)
{
case PanelState.Hidden:
rdGraph.Height = new GridLength(0, GridUnitType.Pixel);
btnVisibilityDown.Visibility = Visibility.Collapsed;
btnVisibilityUp.Visibility = Visibility.Visible;
break;
case PanelState.Normal:
rdGraph.Height = new GridLength(450, GridUnitType.Pixel);
btnVisibilityDown.Visibility = Visibility.Visible;
btnVisibilityUp.Visibility = Visibility.Collapsed;
break;
//case PanelState.Expanded:
// this.Visibility = Visibility.Visible;
// this.Height = 400; // Expanded height
// break;
}
}
} }
} }

Loading…
Cancel
Save