|
|
|
using MaterialDesignThemes.Wpf;
|
|
|
|
using OpenTK.Graphics.ES11;
|
|
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Data;
|
|
|
|
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.Markup;
|
|
|
|
using System.Windows.Media;
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
using System.Xaml;
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// CurveView.xaml 的交互逻辑
|
|
|
|
/// </summary>
|
|
|
|
public partial class CurveView : UserControl
|
|
|
|
{
|
|
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
|
|
|
|
|
|
|
public CurveView()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
DataContext = new CurveDiagramViewModel();
|
|
|
|
|
|
|
|
Sdatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language"));
|
|
|
|
Edatepicker.Language = XmlLanguage.GetLanguage(Configini.IniReadvalue("SYS", "Language"));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static object Selet_Machines(DataTable DB, string name, int key)//查询
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
lock (DB)
|
|
|
|
{
|
|
|
|
DataRow drEmployee = DB.Rows[key];
|
|
|
|
object index = drEmployee.Field<object>(name);
|
|
|
|
return index;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception)
|
|
|
|
{
|
|
|
|
// LogGing.LogGingDATA("SDTD:" + ex.ToString());
|
|
|
|
return "ERR";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
// Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
|
|
|
ListViewItem[] listViewItems =new ListViewItem[999];
|
|
|
|
|
|
|
|
ListView[] listView = new ListView[999];
|
|
|
|
|
|
|
|
for (int i = 0; i < MainWindowViewModel.Machines.Rows.Count; i++)
|
|
|
|
{
|
|
|
|
StackPanel stackPanel = new StackPanel();
|
|
|
|
stackPanel.Orientation = Orientation.Horizontal;
|
|
|
|
|
|
|
|
TextBlock textBlock = new TextBlock();
|
|
|
|
|
|
|
|
PackIcon packIcon = new PackIcon();
|
|
|
|
packIcon.Kind = PackIconKind.ChartBellCurve; //曲线图标
|
|
|
|
packIcon.Width = 25;
|
|
|
|
packIcon.Height = 40;
|
|
|
|
packIcon.VerticalAlignment = VerticalAlignment.Center;
|
|
|
|
|
|
|
|
stackPanel.Children.Add(packIcon);
|
|
|
|
stackPanel.Children.Add(textBlock);
|
|
|
|
|
|
|
|
|
|
|
|
/* inf[i] = new View.info(); Width="25" Height="40" Margin="10" VerticalAlignment="Center"/>
|
|
|
|
inf[i].Margin = new Thickness(5, 5, 0, 5);
|
|
|
|
inf[i].Width = 300;
|
|
|
|
inf[i].Height = 400;
|
|
|
|
inf[i].name.Text = Selet_Machines(MainWindowViewModel.Machines, "name", i).ToString();
|
|
|
|
|
|
|
|
string State_ = Selet_Machines(MainWindowViewModel.Machines, "State", i).ToString();
|
|
|
|
if (State_ == "101")
|
|
|
|
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(100, 100, 100)); }
|
|
|
|
else if (State_ == "201")
|
|
|
|
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); }
|
|
|
|
else if (State_ == "202")
|
|
|
|
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 255, 0)); }
|
|
|
|
else
|
|
|
|
{ inf[i].name.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }
|
|
|
|
|
|
|
|
inf[i].temp.Text = (Selet_Machines(MainWindowViewModel.Machines, "Temperature", i) + "°C").ToString();
|
|
|
|
inf[i].Process.Text = Selet_Machines(MainWindowViewModel.Machines, "Process", i).ToString();
|
|
|
|
inf[i].Step.Text = Selet_Machines(MainWindowViewModel.Machines, "Step", i).ToString();
|
|
|
|
inf[i].Message.Text = Selet_Machines(MainWindowViewModel.Machines, "Message", i).ToString();
|
|
|
|
inf[i].Orders.Text = Selet_Machines(MainWindowViewModel.Machines, "Orders", i).ToString();
|
|
|
|
inf[i].time.Text = Selet_Machines(MainWindowViewModel.Machines, "time", i).ToString();
|
|
|
|
|
|
|
|
WholeView.Children.Add(inf[i]);*/
|
|
|
|
listViewItems[i]= new ListViewItem();
|
|
|
|
listViewItems[i].Tag = stackPanel;
|
|
|
|
// listViewItems[i].
|
|
|
|
|
|
|
|
// listView[i].Template = Selet_Machines(MainWindowViewModel.Machines,"name",i);
|
|
|
|
|
|
|
|
machines.Items.Add(listView[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void DatePicker_Today(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void WorkOrderNumder_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ListViewItem_Before(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ListViewItem_Today(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ListViewItem_DayAfter(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|