67 lines
1.8 KiB
C#
67 lines
1.8 KiB
C#
using System;
|
|
|
|
namespace MECF.Framework.UI.Client.RecipeEditorLib.RecipeModel.Params
|
|
{
|
|
public class PathFileParam : ParamBaseWithGenericValue<string>
|
|
{
|
|
|
|
//TODO 系统所有的配方文件保存在“Sic\xxx\”路径下,"Sic"前缀可以通过系统配置设置,此处为了省事写死。
|
|
private const string SYS_NAME = "Sic";
|
|
|
|
#region Constructors
|
|
|
|
public PathFileParam()
|
|
{
|
|
|
|
}
|
|
|
|
public PathFileParam(string name, bool isEnabled, string prefixPath)
|
|
{
|
|
Name = name;
|
|
IsEnabled = isEnabled;
|
|
PrefixPath = prefixPath;
|
|
}
|
|
|
|
#endregion
|
|
|
|
public override string Value
|
|
{
|
|
get => _value;
|
|
set
|
|
{
|
|
Set(ref _value, value);
|
|
ColumnPermChangedCallback?.Invoke(this);
|
|
|
|
if (string.IsNullOrEmpty(_value))
|
|
{
|
|
FileName = "";
|
|
}
|
|
else
|
|
{
|
|
// Remove the prefix "Sic\xxx\", and leave the folder name of the recipe/seq file.
|
|
var index = _value.LastIndexOf("\\", StringComparison.Ordinal);
|
|
FileName = index > -1 ? _value.Replace($"{PrefixWithSysName}\\", "") : _value;
|
|
}
|
|
|
|
IsSaved = false;
|
|
}
|
|
}
|
|
|
|
public string PrefixWithSysName => $"{SYS_NAME}\\{PrefixPath}";
|
|
|
|
private string _fileName;
|
|
public string FileName
|
|
{
|
|
get => _fileName;
|
|
set => Set(ref _fileName, value);
|
|
}
|
|
|
|
private string _prefixPath;
|
|
public string PrefixPath
|
|
{
|
|
get => _prefixPath;
|
|
set => Set(ref _prefixPath, value);
|
|
}
|
|
}
|
|
}
|