添加项目文件。
This commit is contained in:
104
MetroGauges/ViewModel/DgViewModel.cs
Normal file
104
MetroGauges/ViewModel/DgViewModel.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using MetroGauges.Model;
|
||||
using netDxf;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MetroGauges.ViewModel
|
||||
{
|
||||
public class DgViewModel<T>
|
||||
{
|
||||
public DgViewModel()
|
||||
{
|
||||
Items = CreateData();
|
||||
DataType = DataTypes.KineModel;
|
||||
Color = AciColor.Blue;
|
||||
}
|
||||
|
||||
public DataTypes DataType { get; set; }
|
||||
//private bool? _isAllItemsSelected;
|
||||
|
||||
public AciColor Color { get; set; }
|
||||
|
||||
public string LayerName {get;set;}
|
||||
|
||||
public ObservableCollection<T> Items { get; set; }
|
||||
//public bool? IsAllItemsSelected
|
||||
//{
|
||||
// get { return _isAllItemsSelected; }
|
||||
// set
|
||||
// {
|
||||
// if (_isAllItemsSelected == value) return;
|
||||
|
||||
// _isAllItemsSelected = value;
|
||||
|
||||
// if (_isAllItemsSelected.HasValue)
|
||||
// SelectAll(_isAllItemsSelected.Value, Items);
|
||||
|
||||
// OnPropertyChanged();
|
||||
// }
|
||||
//}
|
||||
|
||||
//private static void SelectAll(bool select, IEnumerable<T> models)
|
||||
//{
|
||||
// foreach (var model in models)
|
||||
// {
|
||||
// model.IsSelected = select;
|
||||
// }
|
||||
//}
|
||||
private ObservableCollection<T> CreateData()
|
||||
{
|
||||
return new ObservableCollection<T>
|
||||
{
|
||||
//new CurEquiModel("受电弓","0",0,0)
|
||||
};
|
||||
}
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public IEnumerable<string> StrPositions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (typeof(T) == typeof(KineModel))
|
||||
{
|
||||
yield return "受电弓";
|
||||
yield return "车体";
|
||||
yield return "转向架构架";
|
||||
yield return "簧下";
|
||||
yield return "踏面";
|
||||
yield return "轮缘";
|
||||
yield return "受流器";
|
||||
}
|
||||
else if (typeof(T) == typeof(LiEquiModel))
|
||||
{
|
||||
yield return "受电弓";
|
||||
yield return "车体顶部";
|
||||
yield return "车体底架边梁以上";
|
||||
yield return "车体底架边梁及以下";
|
||||
yield return "转向架";
|
||||
yield return "车下轨内吊挂";
|
||||
yield return "车下轨外吊挂";
|
||||
yield return "轮对";
|
||||
//yield return "车下轨内";
|
||||
//yield return "车下轨外";
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return "受电弓";
|
||||
yield return "车体";
|
||||
yield return "转向架构架";
|
||||
yield return "受流器";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user