Files
StockSharp/Studio/Core/Commands/BindCommand.cs
T

45 lines
1005 B
C#

namespace StockSharp.Studio.Core.Commands
{
using System;
using StockSharp.BusinessEntities;
public class BindCommand<T> : BaseStudioCommand
where T : class
{
public T Source { get; private set; }
public IStudioControl Control { get; private set; }
public BindCommand(T source, IStudioControl control = null)
{
if (source == null)
throw new ArgumentNullException("source");
Source = source;
Control = control;
}
public bool CheckControl(IStudioControl control)
{
//åñëè íå çàäàí êîíòðîë, òî ñ÷èòàåì, ÷òî ïðèâÿçàòü ñòðàåãèþ íàäî äëÿ âñåõ êîíòðîëîâ
return Control == control;
}
}
public class BindStrategyCommand : BindCommand<StrategyContainer>
{
public BindStrategyCommand(StrategyContainer source, IStudioControl control = null)
: base(source, control)
{
}
}
public class BindConnectorCommand : BindCommand<IConnector>
{
public BindConnectorCommand(IConnector source, IStudioControl control = null)
: base(source, control)
{
}
}
}