Merge branch 'master' of http://www.scserverddns.top:13000/sc/formula_manage
This commit is contained in:
commit
c884ef0c34
6 files changed
+137
-91
No files matched your search
@@ -3,15 +3,18 @@ using formula_manage.ViewModel;
|
||||
using formula_manage.Windows;
|
||||
using GalaSoft.MvvmLight;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Threading;
|
||||
|
||||
|
||||
@@ -72,64 +75,97 @@ public class MainWindowViewModel : ViewModelBase
|
||||
Dissolve_data.Fill(DissolvedataTable); //machine查询结果存入缓存
|
||||
|
||||
conn_SC.Close(); //关闭连接
|
||||
//DataGridStuff.ItemsSource = dataTable.DefaultView; //数据加入表格
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
System.Windows.MessageBox.Show("请求原料信息失败,检查连接");
|
||||
return;
|
||||
}
|
||||
DataView defaultView = MACHINEdataTable.DefaultView;
|
||||
|
||||
// IEnumerable STUFFdata = STUFFdataTable.DefaultView;
|
||||
// Machine.ItemsSource = MACHINEdataTable.DefaultView; // MACHINEdataTable数据集传递到ComboBox:machine
|
||||
// Workflow.ItemsSource = DissolvedataTable.DefaultView; // DissolvedataTable数据集传递到ComboBox:Workflow
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
sql_();
|
||||
|
||||
|
||||
BarCollection = new ObservableCollection<BarModel>
|
||||
{
|
||||
new BarModel { Id = 1, Name = "Bar 1", },
|
||||
new BarModel { Id = 2, Name = "Bar 2", },
|
||||
new BarModel { Id = 3, Name = "Bar 3", },
|
||||
};
|
||||
// public ObservableCollection (System.Collections.Generic.List<T> list);
|
||||
// BarCollection = (ObservableCollection<BarModel>)STUFFdataTable.AsDataView();
|
||||
// var qwe = STUFFdataTable.DefaultView;
|
||||
var product = STUFFdataTable.DefaultView;
|
||||
|
||||
FooCollection = new ObservableCollection<FooViewModel>
|
||||
|
||||
// BarCollection = (ObservableCollection<Product>)STUFFdata;
|
||||
|
||||
|
||||
|
||||
/* BarCollection = new ObservableCollection<Product>
|
||||
{
|
||||
new Product { ProductCode = "Bar 10", },
|
||||
new Product { ProductCode = "Bar 20", },
|
||||
new Product { ProductCode = "Bar 30", },
|
||||
};*/
|
||||
|
||||
/* FooCollection = new ObservableCollection<FooViewModel>
|
||||
{
|
||||
new FooViewModel{ Id = 1, },
|
||||
new FooViewModel{ Id = 2, },
|
||||
new FooViewModel{ Id = 3, },
|
||||
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* product = new ObservableCollection<Product>;
|
||||
foreach (DataRow row in STUFFdataTable.Rows)
|
||||
{
|
||||
product.Add(new Product((int)row[0], (string)row[1], (string)row[2]));
|
||||
|
||||
} */
|
||||
|
||||
_product = new ObservableCollection<Product>
|
||||
{
|
||||
new FooViewModel{ Id = 1, },
|
||||
new FooViewModel{ Id = 2, },
|
||||
new FooViewModel{ Id = 3, },
|
||||
new Product{ ProductCode= "132",ProductName= "123", ProductType= 12,Concentration= 12}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ObservableCollection<BarModel> BarCollection { get; set; }
|
||||
public ObservableCollection<FooViewModel> FooCollection { get; set; }
|
||||
|
||||
|
||||
|
||||
// private ObservableCollection<string> _selectionList = new ObservableCollection<string>(); //这个是实现的重要一步
|
||||
|
||||
public ObservableCollection<Product> _product { get; set; }
|
||||
// public ObservableCollection<FooViewModel> FooCollection { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class FooViewModel : ViewModelBase
|
||||
{
|
||||
private BarModel _bar;
|
||||
/* public class FooViewModel : ViewModelBase
|
||||
{
|
||||
private BarModel _bar;
|
||||
|
||||
public int Id { get; set; }
|
||||
public BarModel Bar { get => _bar; set => Set(ref _bar, value); }
|
||||
}
|
||||
public int Id { get; set; }
|
||||
public BarModel Bar { get => _bar; set => Set(ref _bar, value); }
|
||||
}*/
|
||||
|
||||
public class BarModel
|
||||
public class Product
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string ProductCode { get; set; }
|
||||
public string ProductName { get; set; }
|
||||
public int ProductType { get; set; }
|
||||
public int Concentration { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
return ProductCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// StuffViewModeldl
|
||||
@@ -150,5 +186,5 @@ public class MainWindowViewModel : ViewModelBase
|
||||
|
||||
}*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user