Browse Source

图表全局刷新

master
sc 11 months ago
parent
commit
db8d0af797
  1. 7
      SunlightCentralizedControlManagement_SCCM_.csproj
  2. 17
      View/CurveDiagram.xaml
  3. 30
      View/CurveDiagram.xaml.cs
  4. 10
      View/CurveView.xaml
  5. 12
      View/CurveView.xaml.cs
  6. 6
      ViewModel/CurveDiagramViewModel.cs

7
SunlightCentralizedControlManagement_SCCM_.csproj

@ -98,6 +98,9 @@
<Compile Include="ViewModel\CurveDiagramViewModel.cs" />
<Compile Include="ViewModel\MainWindowViewModel.cs" />
<Compile Include="ViewModel\ViewModelLocator.cs" />
<Compile Include="View\CurveDiagram.xaml.cs">
<DependentUpon>CurveDiagram.xaml</DependentUpon>
</Compile>
<Compile Include="View\CurveView.xaml.cs">
<DependentUpon>CurveView.xaml</DependentUpon>
</Compile>
@ -149,6 +152,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="View\CurveDiagram.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\CurveView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

17
View/CurveDiagram.xaml

@ -0,0 +1,17 @@
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.CurveDiagram"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View"
xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.WPF;assembly=LiveChartsCore.SkiaSharpView.WPF"
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
xmlns:viewmodel="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ViewModel"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}"
d:DesignHeight="300" d:DesignWidth="400">
<Grid>
<lvc:CartesianChart x:Name="OscChart" MinWidth="400" MinHeight="300" EasingFunction="{x:Null}" ZoomMode="X"
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}" Margin="0,0,0,0"/>
</Grid>
</UserControl>

30
View/CurveDiagram.xaml.cs

@ -0,0 +1,30 @@
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
/// <summary>
/// CurveDiagram.xaml 的交互逻辑
/// </summary>
public partial class CurveDiagram : UserControl
{
public CurveDiagram()
{
InitializeComponent();
DataContext = new CurveDiagramViewModel();
}
}
}

10
View/CurveView.xaml

@ -11,7 +11,7 @@
xmlns:ConvertMoels="clr-namespace:SunlightCentralizedControlManagement_SCCM_.ConvertMoels"
mc:Ignorable="d"
Loaded="UserControl_Loaded"
d:DataContext="{d:DesignInstance Type=viewmodel:CurveDiagramViewModel}"
d:DesignHeight="900" d:DesignWidth="1800">
<UserControl.Resources>
<ConvertMoels:StateToColorConvert x:Key="StateToColorConvert"/>
@ -108,9 +108,6 @@
</DataGrid.Columns>
</DataGrid>
<lvc:CartesianChart x:Name="OscChart" MinWidth="400" MinHeight="300" EasingFunction="{x:Null}" ZoomMode="X"
Series="{Binding Series}" YAxes="{Binding YAxes}" XAxes="{Binding XAxes}" Margin="0,500,300,60"/>
<StackPanel x:Name="s1cr" VerticalAlignment="Bottom" Height="60" Background="#FF00204E" Orientation="Horizontal">
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Height="60" VerticalAlignment="Center">
@ -157,5 +154,10 @@
</ListViewItem>
</ListView>
</StackPanel>
<Grid Background="White" Margin="0,500,300,60">
<ContentControl x:Name="Picture"/>
</Grid>
</Grid>
</UserControl>

12
View/CurveView.xaml.cs

@ -30,14 +30,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
private SQLiteHelper SQLiteHelpers = null; //定义数据库
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
public static DataTable WorkOrder = new DataTable(); //设备表缓存
public static DataTable WorkOrder = new DataTable(); //物料缓存
public static string CurveDiagram;
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private string SYS_machines =null;
public CurveView()
{
InitializeComponent();
DataContext = new CurveDiagramViewModel();
InitializeComponent();
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language"));
}
@ -66,13 +66,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Sdatepicker.Text = DateTime.Now.ToString("yyyy/MM/dd");
CurveDiagramViewModel.Curve("738891980000");
Picture.Content = new View.CurveDiagram();
}
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
{
CurveDiagramViewModel.Curve(Select_WorkOrderNumder.Text);
// OscChart.CoreChart..;
CurveDiagram =Select_WorkOrderNumder.Text;
Picture.Content = new View.CurveDiagram();
}
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)//前一天

6
ViewModel/CurveDiagramViewModel.cs

@ -26,6 +26,7 @@ using TouchSocket.Core;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows;
using SunlightCentralizedControlManagement_SCCM_.View;
namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
{
@ -128,7 +129,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public CurveDiagramViewModel()
{
Curve("");
Curve(CurveView.CurveDiagram);
}
public static void Curve(string SYSWorkNumder)
{
@ -197,9 +198,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
STLC_values = new ObservableCollection<DateTimePoint>(STLC_items);
}
Series = new ISeries[]
{
new LineSeries<DateTimePoint>

Loading…
Cancel
Save