2022-09-19 09:16:33 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace RecipeEditorLib.RecipeModel.Params
|
|
|
|
|
{
|
2022-09-26 10:49:29 +08:00
|
|
|
|
public class PathFileParam : ParamBaseWithGenericValue<string>
|
2022-09-19 09:16:33 +08:00
|
|
|
|
{
|
2022-09-26 10:49:29 +08:00
|
|
|
|
|
|
|
|
|
public override string Value
|
2022-09-19 09:16:33 +08:00
|
|
|
|
{
|
2022-09-26 10:49:29 +08:00
|
|
|
|
get => _value;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
set
|
|
|
|
|
{
|
2022-09-26 10:49:29 +08:00
|
|
|
|
_value = value;
|
|
|
|
|
Feedback?.Invoke(this);
|
2022-09-19 09:16:33 +08:00
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(_value))
|
|
|
|
|
{
|
|
|
|
|
FileName = "";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2022-09-26 10:49:29 +08:00
|
|
|
|
var index = _value.LastIndexOf("\\", StringComparison.Ordinal);
|
|
|
|
|
FileName = index > -1 ? _value.Substring(index + 1) : _value;
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-09-26 10:49:29 +08:00
|
|
|
|
NotifyOfPropertyChange(nameof(Value));
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string _fileName;
|
|
|
|
|
public string FileName
|
|
|
|
|
{
|
|
|
|
|
get { return _fileName; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_fileName = value;
|
2022-09-26 10:49:29 +08:00
|
|
|
|
NotifyOfPropertyChange(nameof(FileName));
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string _prefixPath;
|
|
|
|
|
public string PrefixPath
|
|
|
|
|
{
|
|
|
|
|
get { return _prefixPath; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
_prefixPath = value;
|
2022-09-26 10:49:29 +08:00
|
|
|
|
NotifyOfPropertyChange(nameof(PrefixPath));
|
2022-09-19 09:16:33 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|