首次提交:添加src文件夹代码
This commit is contained in:
50
Cowain.Bake.Main/Models/LogModel.cs
Normal file
50
Cowain.Bake.Main/Models/LogModel.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Main.Models
|
||||
{
|
||||
public class LogModel : BindableBase
|
||||
{
|
||||
private DateTime logTime;
|
||||
/// <summary>
|
||||
/// 日志时间
|
||||
/// </summary>
|
||||
public DateTime LogTime
|
||||
{
|
||||
get => logTime;
|
||||
set => SetProperty(ref logTime, value);
|
||||
}
|
||||
private string logText;
|
||||
/// <summary>
|
||||
/// 日志内容
|
||||
/// </summary>
|
||||
public string LogText
|
||||
{
|
||||
get => logText;
|
||||
set => SetProperty(ref logText, value);
|
||||
}
|
||||
private string logLevel;
|
||||
/// <summary>
|
||||
/// 日志等级
|
||||
/// </summary>
|
||||
public string LogLevel
|
||||
{
|
||||
get => logLevel;
|
||||
set => SetProperty(ref logLevel, value);
|
||||
}
|
||||
|
||||
private string fontColor;
|
||||
/// <summary>
|
||||
/// 日志等级字体颜色
|
||||
/// </summary>
|
||||
public string FontColor
|
||||
{
|
||||
get => fontColor;
|
||||
set => SetProperty(ref fontColor, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Cowain.Bake.Main/Models/MainHeaderModel.cs
Normal file
18
Cowain.Bake.Main/Models/MainHeaderModel.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Main.Models
|
||||
{
|
||||
public class RibbonMenuModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
public double MenuWidth { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string Header { get; set; }
|
||||
public string FilePath { get; set; }
|
||||
}
|
||||
}
|
||||
25
Cowain.Bake.Main/Models/MainRowDefinition.cs
Normal file
25
Cowain.Bake.Main/Models/MainRowDefinition.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Cowain.Bake.BLL;
|
||||
using System.Linq;
|
||||
using Unity;
|
||||
|
||||
|
||||
namespace Cowain.Bake.Main.Models
|
||||
{
|
||||
public class MainRowDefinition
|
||||
{
|
||||
public static float UpperSpacing = 6;
|
||||
public static float UpperHeight = 0;
|
||||
public static float MidHeight = 3;
|
||||
public static float LowerHeight = 0;
|
||||
public static float LowerSpacing = 1.5f;
|
||||
public static float TotalHeight = 0;
|
||||
|
||||
public MainRowDefinition(IUnityContainer unityContainer)
|
||||
{
|
||||
var memory = unityContainer.Resolve<MemoryDataProvider>();
|
||||
UpperHeight = memory.AllStation.Where(x => x.PosX == 1).Max(x => x.Layers)+1;
|
||||
LowerHeight = memory.AllStation.Where(x => x.PosX == 3).Max(x => x.Layers)+1; //1:就是抬头
|
||||
TotalHeight = UpperSpacing + LowerSpacing + UpperHeight + LowerHeight + MidHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Cowain.Bake.Main/Models/MenuItemModel.cs
Normal file
58
Cowain.Bake.Main/Models/MenuItemModel.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using Prism.Commands;
|
||||
using Prism.Mvvm;
|
||||
using Prism.Regions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Cowain.Bake.Main.Models
|
||||
{
|
||||
public class MenuItemModel : BindableBase
|
||||
{
|
||||
public string MenuIcon { get; set; }
|
||||
public string MenuHeader { get; set; }
|
||||
public string HeaderName { get; set; }
|
||||
public string TargetView { get; set; }
|
||||
|
||||
private bool isExpanded;
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return isExpanded; }
|
||||
set { SetProperty(ref isExpanded, value); }
|
||||
}
|
||||
|
||||
private bool isDefault;
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get { return isDefault; }
|
||||
set { SetProperty(ref isDefault, value); }
|
||||
}
|
||||
|
||||
public List<MenuItemModel> Children { get; set; }
|
||||
|
||||
public ICommand OpenViewCommand
|
||||
{
|
||||
get => new DelegateCommand(() =>
|
||||
{
|
||||
if ((this.Children == null || this.Children.Count == 0) &&
|
||||
!string.IsNullOrEmpty(this.TargetView))
|
||||
{
|
||||
// 页面跳转 使用IRegionManager.RequestNavigate()跳转到目标页面
|
||||
_regionManager.RequestNavigate("MainContentRegion", this.TargetView);
|
||||
}
|
||||
else
|
||||
this.IsExpanded = !this.IsExpanded;
|
||||
});
|
||||
}
|
||||
IRegionManager _regionManager = null;
|
||||
public MenuItemModel(IRegionManager regionManager)
|
||||
{
|
||||
_regionManager = regionManager;
|
||||
}
|
||||
}
|
||||
}
|
||||
127
Cowain.Bake.Main/Models/MultiComboBox.cs
Normal file
127
Cowain.Bake.Main/Models/MultiComboBox.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Cowain.Bake.Main.Views
|
||||
{
|
||||
public class MultiComboBox:ComboBox
|
||||
{
|
||||
static MultiComboBox()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(MultiComboBox), new FrameworkPropertyMetadata(typeof(MultiComboBox)));
|
||||
}
|
||||
|
||||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
d.SetValue(e.Property, e.NewValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 选中项列表
|
||||
/// </summary>
|
||||
public ObservableCollection<MultiCbxBaseData> ChekedItems = new ObservableCollection<MultiCbxBaseData>();
|
||||
|
||||
/// <summary>
|
||||
/// ListBox竖向列表
|
||||
/// </summary>
|
||||
private ListBox _ListBoxV;
|
||||
|
||||
/// <summary>
|
||||
/// ListBox横向列表
|
||||
/// </summary>
|
||||
private ListBox _ListBoxH;
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
_ListBoxV = Template.FindName("PART_ListBox", this) as ListBox;
|
||||
_ListBoxH = Template.FindName("PART_ListBoxChk", this) as ListBox;
|
||||
_ListBoxH.ItemsSource = ChekedItems;
|
||||
_ListBoxV.SelectionChanged += _ListBoxV_SelectionChanged;
|
||||
_ListBoxH.SelectionChanged += _ListBoxH_SelectionChanged;
|
||||
|
||||
if (ItemsSource != null)
|
||||
{
|
||||
foreach (var item in ItemsSource)
|
||||
{
|
||||
MultiCbxBaseData bdc = item as MultiCbxBaseData;
|
||||
if (bdc.IsCheck)
|
||||
{
|
||||
_ListBoxV.SelectedItems.Add(bdc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _ListBoxH_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
foreach (var item in e.RemovedItems)
|
||||
{
|
||||
MultiCbxBaseData datachk = item as MultiCbxBaseData;
|
||||
|
||||
for (int i = 0; i < _ListBoxV.SelectedItems.Count; i++)
|
||||
{
|
||||
MultiCbxBaseData datachklist = _ListBoxV.SelectedItems[i] as MultiCbxBaseData;
|
||||
if (datachklist.Id == datachk.Id)
|
||||
{
|
||||
_ListBoxV.SelectedItems.Remove(_ListBoxV.SelectedItems[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _ListBoxV_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
foreach (var item in e.AddedItems)
|
||||
{
|
||||
MultiCbxBaseData datachk = item as MultiCbxBaseData;
|
||||
datachk.IsCheck = true;
|
||||
if (ChekedItems.IndexOf(datachk) < 0)
|
||||
{
|
||||
ChekedItems.Add(datachk);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in e.RemovedItems)
|
||||
{
|
||||
MultiCbxBaseData datachk = item as MultiCbxBaseData;
|
||||
datachk.IsCheck = false;
|
||||
ChekedItems.Remove(datachk);
|
||||
}
|
||||
}
|
||||
public class MultiCbxBaseData
|
||||
{
|
||||
private int _id;
|
||||
public int Id
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
private string _viewName;
|
||||
public string ViewName
|
||||
{
|
||||
get { return _viewName; }
|
||||
set
|
||||
{
|
||||
_viewName = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isCheck;
|
||||
/// <summary>
|
||||
/// 是否选中
|
||||
/// </summary>
|
||||
public bool IsCheck
|
||||
{
|
||||
get { return _isCheck; }
|
||||
set { _isCheck = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
Cowain.Bake.Main/Models/PallletTemp.cs
Normal file
14
Cowain.Bake.Main/Models/PallletTemp.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Cowain.Bake.Main.Common
|
||||
{
|
||||
public class PallletTemp
|
||||
{
|
||||
public string HeadName { set; get; }
|
||||
public float Value { set; get; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user