This commit is contained in:
sc authored and sc committed 2022-05-27 23:56:41 +08:00
commit 9ede634f3c
115 files changed
+2666 -7523

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace Audit.ViewModel
{
public class MachinesViewModel : ViewModelBase
{
private List<Machines> machiness = new List<Machines>();
public List<Machines> Machines
{
get
{
return machiness;
}
set
{
machiness = value;
RaisePropertyChanged();
}
}
public MachinesViewModel()
{
//machiness = new MachinesProvider().Select();//显示机台
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.1)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (MachinesView.Button_sql == true)//获取按钮状态
{
Machines = new MachinesProvider().Select();//显示机台
MachinesView.Button_sql = false;
}
}
}
}
+19 -27
View File
@@ -1,38 +1,30 @@
using Audit.View;
using GalaSoft.MvvmLight;
using System.ComponentModel;
using System.Web.UI.WebControls;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace Audit.ViewModel
{
/// <summary>
/// This class contains properties that the main View can data bind to.
/// <para>
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// You can also use Blend to data bind with the tool's support.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase
{
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
///
public MainViewModel()
{
////if (IsInDesignMode)
////{
//// // Code runs in Blend --> create design time data.
////}
////else
////{
//// // Code runs "for real"
////}
DispatcherTimer timer = new DispatcherTimer//初始化循环,每1秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(1)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
}
}
}
+51
View File
@@ -0,0 +1,51 @@
using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;
namespace Audit.ViewModel
{
public class PipesViewModel : ViewModelBase
{
private List<Pipes> pipes = new List<Pipes>();
public List<Pipes> Pipes
{
get
{
return pipes;
}
set
{
pipes = value;
RaisePropertyChanged();
}
}
public PipesViewModel()
{
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.1)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (PipesView.Button_pipessql == true)
{
new PipesProvider().Select();
PipesView.Button_pipessql = false;
}
}
}
}
+4 -10
View File
@@ -53,7 +53,7 @@ namespace Audit.ViewModel
/// </summary>
public QueryViewModel()
{
dyelots = new DyelotsProvider().Select();//显示单号
// dyelots = new DyelotsProvider().Select();//显示单号
// dyelotsBulkedRecipe = new DyelotsBulkedRecipeProvider().Select();//显示明显
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
@@ -63,12 +63,12 @@ namespace Audit.ViewModel
timer.Start();
}
int a = 0;//计数器用变量
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (QueryView.sqlButton_Click == 0)
if (QueryView.sqlButton_Click == 10)
{
dyelots = new DyelotsProvider().Select();//显示单号
Dyelots = new DyelotsProvider().Select();//显示单号
QueryView.sqlButton_Click = 0;
}
if (QueryView.sqlButton_Click == 2)
{
@@ -91,12 +91,6 @@ namespace Audit.ViewModel
Dyelots = new DyelotsProvider().SelectMachine(QueryView.Dyelots_Button);//根据单号查询头
QueryView.sqlButton_Click = 0;
}
if (a == 20)//
{
a = 0;
}
else a++;
}
}
}
+80
View File
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace Audit.ViewModel
{
public class ReadIni
{
/// <summary>
/// 为INI文件中指定的节点取得字符串
/// </summary>
/// <param name="lpAppName">欲在其中查找关键字的节点名称</param>
/// <param name="lpKeyName">欲获取的项名</param>
/// <param name="lpDefault">指定的项没有找到时返回的默认值</param>
/// <param name="lpReturnedString">指定一个字串缓冲区,长度至少为nSize</param>
/// <param name="nSize">指定装载到lpReturnedString缓冲区的最大字符数量</param>
/// <param name="lpFileName">INI文件完整路径</param>
/// <returns>复制到lpReturnedString缓冲区的字节数量,其中不包括那些NULL中止字符</returns>
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string lpAppName, string lpKeyName, string lpDefault, StringBuilder lpReturnedString, int nSize, string lpFileName);
/// <summary>
/// 修改INI文件中内容
/// </summary>
/// <param name="lpApplicationName">欲在其中写入的节点名称</param>
/// <param name="lpKeyName">欲设置的项名</param>
/// <param name="lpString">要写入的新字符串</param>
/// <param name="lpFileName">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
[DllImport("kernel32")]
private static extern int WritePrivateProfileString(string lpApplicationName, string lpKeyName, string lpString, string lpFileName);
public static string ReadIniData(string section, string key, string def, string filePath)//读取INI文件
{
StringBuilder sb = new StringBuilder(1024);
GetPrivateProfileString(section, key, def, sb, 1024, filePath);
return sb.ToString();
}
/// <summary>
/// 写INI文件值
/// </summary>
/// <param name="section">欲在其中写入的节点名称</param>
/// <param name="key">欲设置的项名</param>
/// <param name="value">要写入的新字符串</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int WriteData(string section, string key, string value, string filePath)
{
return WritePrivateProfileString(section, key, value, filePath);
}
/// <summary>
/// 删除节
/// </summary>
/// <param name="section">节点名</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int DeleteSection(string section, string filePath)
{
return WriteData(section, null, null, filePath);
}
/// <summary>
/// 删除键的值
/// </summary>
/// <param name="section">节点名</param>
/// <param name="key">键名</param>
/// <param name="filePath">INI文件完整路径</param>
/// <returns>非零表示成功,零表示失败</returns>
public static int DeleteKey(string section, string key, string filePath)
{
return WriteData(section, key, null, filePath);
}
}
}
+90 -3
View File
@@ -1,15 +1,102 @@
using System;
using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Services.Description;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Threading;
namespace Audit.ViewModel
{
///<Summary>
/// StatisticsViewModel
///</Summary>
public class StatisticsViewModel
public class StatisticsViewModel : ViewModelBase
{
}
private List<Product> products = new List<Product>();
private List<Machines> machiness = new List<Machines>();
private List<Dyelots> dyelotss = new List<Dyelots>();
public List<Product> Product
{
get
{
return products;
}
set
{
products = value;
RaisePropertyChanged();
}
}
public List<Machines> Machines
{
get
{
return machiness;
}
set
{
machiness = value;
RaisePropertyChanged();
}
}
public List<Dyelots> Dyelots
{
get
{
return dyelotss;
}
set
{
dyelotss = value;
RaisePropertyChanged();
}
}
public StatisticsViewModel()
{
// products = new ProductProvider().Select();
// machiness = new MachinesProvider().Select();
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.1)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
if (StatisticsView.Button_sql == true)//获取按钮状态
{
if (StatisticsView.Buttontype_sql == -2)
{
Product = new ProductProvider().Select();
StatisticsView.Button_machines_sql = true;
}
if (StatisticsView.Buttontype_sql == -1) Product = new ProductProvider().Select();
if (StatisticsView.Buttontype_sql == 0) Product = new ProductProvider().Selects0();
if (StatisticsView.Buttontype_sql == 1) Product = new ProductProvider().Selects1();
if (StatisticsView.Buttontype_sql == 2) Product = new ProductProvider().Selects2();
if (StatisticsView.Buttontype_sql == 3) Product = new ProductProvider().Selects3();
StatisticsView.Button_sql = false;//清除按钮状态
}
if (StatisticsView.Button_machines_sql == true)
{
Machines = new MachinesProvider().Select();
StatisticsView.Button_machines_sql = false;
}
}
}
}
+2 -1
View File
@@ -42,7 +42,7 @@ namespace Audit.ViewModel
/// </summary>
public StuffViewModel()
{
products = new ProductProvider().Select();
//products = new ProductProvider().Select();
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.1)
@@ -59,6 +59,7 @@ namespace Audit.ViewModel
if (StuffView.Buttontype_sql == 0) Product = new ProductProvider().Selects0();
if (StuffView.Buttontype_sql == 1) Product = new ProductProvider().Selects1();
if (StuffView.Buttontype_sql == 2) Product = new ProductProvider().Selects2();
if (StuffView.Buttontype_sql == 3) Product = new ProductProvider().Selects3();
StuffView.Button_sql = false;//清除按钮状态
}
}
+35
View File
@@ -0,0 +1,35 @@
using Audit.View;
using GalaSoft.MvvmLight;
using Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Services.Description;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Threading;
namespace Audit.ViewModel
{
public class UserViewModel : ViewModelBase
{
public UserViewModel()
{
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
{
Interval = TimeSpan.FromSeconds(0.5)
};
timer.Tick += Tick_Event;
timer.Start();
}
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
{
}
}
}
+34
View File
@@ -48,6 +48,9 @@ namespace Audit.ViewModel
SimpleIoc.Default.Register<StatisticsViewModel>();
SimpleIoc.Default.Register<QueryViewModel>();
SimpleIoc.Default.Register<StuffViewModel>();
SimpleIoc.Default.Register<MachinesViewModel>();
SimpleIoc.Default.Register<PipesViewModel>();
SimpleIoc.Default.Register<UserViewModel>();
}
///<Summary>
@@ -61,6 +64,14 @@ namespace Audit.ViewModel
}
}
public UserViewModel User
{
get
{
return ServiceLocator.Current.GetInstance<UserViewModel>();
}
}
///<Summary>
/// LogViewModel
///</Summary>
@@ -104,6 +115,29 @@ namespace Audit.ViewModel
return ServiceLocator.Current.GetInstance<StuffViewModel>();
}
}
/// <summary>
///
/// </summary>
public MachinesViewModel Machines
{
get
{
return ServiceLocator.Current.GetInstance<MachinesViewModel>();
}
}
/// <summary>
///
/// </summary>
public PipesViewModel Pipes
{
get
{
return ServiceLocator.Current.GetInstance<PipesViewModel>();
}
}
///<Summary>
/// Cleanup
///</Summary>