Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage
This commit is contained in:
commit
f5bf396be5
2 files changed
+30
-15
No files matched your search
@@ -16,14 +16,27 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace formula_manage.ViewModel
|
||||
{
|
||||
///<Summary>
|
||||
/// RRODUCTiewModel
|
||||
///</Summary>
|
||||
///
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
|
||||
public class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if (this.PropertyChanged != null)
|
||||
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
///<Summary>
|
||||
///
|
||||
///
|
||||
///</Summary>
|
||||
///
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
DataTable DissolvedataTable = new DataTable(); //建立Dissolve缓存
|
||||
DataTable STUFFdataTable = new DataTable(); //建立STUFF缓存
|
||||
@@ -32,7 +45,12 @@ public class MainWindowViewModel : ViewModelBase
|
||||
DataTable RecipedataTable = new DataTable(); //建立Recipe缓存
|
||||
|
||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini"; //配置文件路径
|
||||
public string Sys_Time; //显示系统时间
|
||||
public string sys_Time; //显示系统时间
|
||||
public string Sys_Time //通知UI控件参数改变
|
||||
{
|
||||
get { return sys_Time; }
|
||||
set { sys_Time = value; OnPropertyChanged("Sys_Time"); }
|
||||
}
|
||||
|
||||
string TEXT_SQLIP;
|
||||
string TEXT_SQLNAME;
|
||||
@@ -41,7 +59,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
string TEXT_SQLPASWOR;
|
||||
string Connstr_SC;
|
||||
|
||||
private async void sql_()
|
||||
private async void Sql_()
|
||||
{
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
|
||||
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||
@@ -86,7 +104,8 @@ public class MainWindowViewModel : ViewModelBase
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
sql_();
|
||||
CountDown();
|
||||
Sql_();
|
||||
|
||||
stuff_Product = ToObservableCollection<Product>(STUFFdataTable); //stuff_Product表转换
|
||||
mac_Machine = ToObservableCollection<Machine>(MACHINEdataTable);
|
||||
@@ -97,7 +116,7 @@ public class MainWindowViewModel : ViewModelBase
|
||||
public ObservableCollection<Product> stuff_Product { get; set; } //stuff_Product动态表实力化
|
||||
public ObservableCollection<Machine> mac_Machine { get; set; } //mac_Machine动态表实力化
|
||||
public ObservableCollection<Workflow> flow_Workflow { get; set; } //Dissolve动态表实力化
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new()
|
||||
public ObservableCollection<T> ToObservableCollection<T>(DataTable dt) where T : class, new() //DataTable FOR ObservableCollection转换器
|
||||
{
|
||||
Type t = typeof(T);
|
||||
PropertyInfo[] propertys = t.GetProperties();
|
||||
@@ -143,14 +162,12 @@ public class MainWindowViewModel : ViewModelBase
|
||||
lst.Add(entity);
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
} //DataTable FOR ObservableCollection转换器
|
||||
/// <summary>
|
||||
/// 循环事件设定
|
||||
/// </summary>
|
||||
public void CountDown()
|
||||
{
|
||||
//products = new ProductProvider().Select();
|
||||
DispatcherTimer timer = new DispatcherTimer//初始化循环,每0.5秒调用一次Tick_Event
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(0.1)
|
||||
@@ -163,12 +180,10 @@ public class MainWindowViewModel : ViewModelBase
|
||||
// disTimer.Interval = new TimeSpan(10000000); //时间间隔为一秒。
|
||||
// disTimer.Start();//计时开始
|
||||
}
|
||||
|
||||
void Tick_Event(object sender, EventArgs e)//Tick_Event周期执行事件
|
||||
{
|
||||
Sys_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Product //stuff_Product
|
||||
|
||||
Reference in new issue
Block a user