Sic04/FrameworkLocal/UIClient/CenterViews/Editors/Recipe/RecipeSelectDialogViewModel.cs

76 lines
1.9 KiB
C#

using System.Collections.Generic;
using System.Collections.ObjectModel;
using MECF.Framework.UI.Client.CenterViews.Editors.Sequence;
using OpenSEMI.ClientBase;
namespace MECF.Framework.UI.Client.CenterViews.Editors.Recipe
{
public class RecipeSelectDialogViewModel : DialogViewModel<string>
{
private readonly bool _isFolderOnly;
public RecipeSelectDialogViewModel()
{
}
public RecipeSelectDialogViewModel(bool isFolderOnly)
{
_isFolderOnly = isFolderOnly;
}
public List<ProcessTypeFileItem> ProcessTypeFileList { get; set; }
public FileNode CurrentFileNode { get; set; }
public int ProcessTypeIndexSelection { get; set; }
public ObservableCollection<FileNode> Files { get; set; }
private FileNode _currentFileNode;
public void TreeSelectChanged(FileNode file)
{
this._currentFileNode = file;
}
public void TreeMouseDoubleClick(FileNode file)
{
this._currentFileNode = file;
OK();
}
public void OK()
{
if (this._currentFileNode == null)
return;
if (_isFolderOnly)
{
if (this._currentFileNode.IsFile)
return;
this.DialogResult = _currentFileNode.PrefixPath + "\\" + _currentFileNode.FullPath;
IsCancel = false;
TryClose(true);
}
else
{
if (!this._currentFileNode.IsFile)
return;
this.DialogResult = _currentFileNode.PrefixPath + "\\" + _currentFileNode.FullPath;
IsCancel = false;
TryClose(true);
}
}
public void Cancel()
{
IsCancel = true;
TryClose(false);
}
}
}