feat: 필터 변경 시 그래프 종류 업데이트

hhsung_work
HyungJune Kim 10 months ago
parent ae31da2035
commit aa65046922

@ -41,7 +41,6 @@ namespace SmartAquaViewer.Controls
if (sender is RadioButton rb && rb.Tag != null)
{
SelectedValue = rb.Tag.ToString();
Debug.WriteLine($"SelectedValue changed to: {SelectedValue}");
}
}
}

@ -95,4 +95,13 @@
</Setter>
</Style>
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="BorderBrush" Value="#404F63"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Background" Value="#323232"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>
</ResourceDictionary>

@ -39,12 +39,17 @@
<PackageReference Include="MaterialDesignColors" Version="5.2.1" />
<PackageReference Include="MaterialDesignThemes" Version="5.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
</ItemGroup>
<ItemGroup>

@ -20,10 +20,14 @@
<Grid.Background>
<ImageBrush ImageSource="/Resources/Images/top_bg.png" Stretch="Fill"/>
</Grid.Background>
<control:SegmentedControl x:Name="segmentedControl" Margin="10 10"
SelectedValue="{Binding CurrentSystem, Mode=TwoWay}"/>
<control:SegmentedControl x:Name="segmentedControl" Margin="20 10"
SelectedValue="{Binding CurrentSystem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="20 20 20 40">
</StackPanel>
<Grid Grid.Row="1" VerticalAlignment="Bottom">
<Button Name="btnVisibilityDown" Tag="down"
Style="{StaticResource ImageButtonStyle}" Height="33" Command="{Binding ChangeDrawerStatusCommand}"
@ -43,9 +47,40 @@
<ColumnDefinition Width="550"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Margin="50 35"
<Border Margin="20"
Background="#384659" BorderBrush="#404F63" BorderThickness="1" CornerRadius="10">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock Text="그래프" FontSize="24" FontFamily="{StaticResource SCDream4}" Foreground="White"
Margin="15 15 15 5"/>
<TextBlock Grid.Row="2" Text="X축" FontSize="24" FontFamily="{StaticResource SCDream4}" Foreground="White"
Margin="15 15 15 5"/>
<TextBlock Grid.Row="4" Text="Y축" FontSize="24" FontFamily="{StaticResource SCDream4}" Foreground="White"
Margin="15 15 15 5"/>
<ComboBox Grid.Row="1" Margin="15 0" Height="50"
Style="{StaticResource ComboBoxStyle}"
ItemsSource="{Binding GraphTypes}"
SelectedItem="{Binding SelectedGraphType}"/>
<ComboBox Grid.Row="3" Margin="15 0" Height="50"
Style="{StaticResource ComboBoxStyle}"></ComboBox>
<ComboBox Grid.Row="5" Margin="15 0" Height="50"
Style="{StaticResource ComboBoxStyle}"></ComboBox>
</Grid>
</Border>
<Border Grid.Column="1" Margin="0 20 20 20"
Background="#384659" BorderBrush="#404F63" BorderThickness="1" CornerRadius="10">
</Border>
</Grid>
</Border>

@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SmartAquaViewer.ViewModel;
using static SmartAquaViewer.Model.Enums;
namespace SmartAquaViewer.View
@ -21,11 +22,20 @@ namespace SmartAquaViewer.View
/// </summary>
public partial class MonitoringView : UserControl
{
private MonitoringViewModel? monitoringViewModel;
private PanelState _state = PanelState.Normal;
public MonitoringView()
{
InitializeComponent();
monitoringViewModel = this.DataContext as MonitoringViewModel;
monitoringViewModel.OnSystemChanged += MonitoringViewModel_OnSystemChanged;
}
private void MonitoringViewModel_OnSystemChanged(string systemName)
{
}
}
}

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
@ -13,6 +15,44 @@ namespace SmartAquaViewer.ViewModel
{
public class MonitoringViewModel : INotifyPropertyChanged
{
public delegate void SystemChangedEventHandler(string systemName);
public event SystemChangedEventHandler OnSystemChanged;
public ObservableCollection<string> GraphTypes { get; }
private string _selectedGraphType;
public string SelectedGraphType
{
get => _selectedGraphType;
set
{
if (_selectedGraphType != value)
{
_selectedGraphType = value;
OnPropertyChanged();
}
}
}
private string _currentSystem;
public string CurrentSystem
{
get => _currentSystem;
set
{
if (_currentSystem != value)
{
_currentSystem = value;
OnPropertyChanged();
Debug.WriteLine($"CurrentSyetem changed to: {_currentSystem}");
SetGraphType();
SelectedGraphType = GraphTypes.FirstOrDefault() ?? string.Empty;
OnSystemChanged?.Invoke(CurrentSystem);
}
}
}
private bool _isOpenMode;
public bool IsOpenMode
{
@ -65,9 +105,43 @@ namespace SmartAquaViewer.ViewModel
IsOpenMode = true;
BtnVisibilityUp = Visibility.Collapsed;
GraphTypes = new ObservableCollection<string>();
CurrentSystem = "Tank"; // Default system
SetGraphType();
ChangeDrawerStatusCommand = new RelayCommand(_ => IsOpenMode = !IsOpenMode);
}
private void SetGraphType()
{
GraphTypes.Clear();
switch (CurrentSystem)
{
case "Tank":
GraphTypes.Add("LINE");
GraphTypes.Add("BOX");
GraphTypes.Add("SCATTER");
break;
case "Filter":
GraphTypes.Add("LINE");
GraphTypes.Add("STEP");
break;
case "Sterilizer":
GraphTypes.Add("LINE");
GraphTypes.Add("STEP");
break;
default:
break;
}
string graphTypes = string.Empty;
foreach (string str in GraphTypes)
graphTypes += (str + ", ");
Debug.WriteLine(graphTypes);
}
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string? name = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));

Loading…
Cancel
Save