本文整理汇总了C#中ICondition类的典型用法代码示例。如果您正苦于以下问题:C# ICondition类的具体用法?C# ICondition怎么用?C# ICondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICondition类属于命名空间,在下文中一共展示了ICondition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFileTypes
public static List<FileType> GetFileTypes(ICondition condition)
{
List<FileType> returnVal = new List<FileType>();
IDataSource dataSource = condition.DataLeft.Data as IDataSource;
if (null == dataSource)
return returnVal;
if (2 > dataSource.Method.Parameters.Count)
return returnVal;
IParameter parameter = dataSource.Method.Parameters[1];
if (0 != string.Compare(parameter.Name.Value, m_FileTypeParameterName, true, CultureInfo.InvariantCulture))
return returnVal;
IPolicyObjectCollection<IDataItem> collection = parameter.Value.Data as IPolicyObjectCollection<IDataItem>;
if (null == collection)
return returnVal;
foreach (IDataItem item in collection)
{
string fileTypeString = item.Value as string;
FileType type = (FileType)Enum.Parse(typeof(FileType), fileTypeString);
returnVal.Add(type);
}
return returnVal;
}
示例2: IsConditionalExpirable
public static Polyface IsConditionalExpirable(this Polyface root, ICondition expiry)
{
Condition.Requires(root).IsNotNull();
var composited = new NaturalConditionalExpirable(expiry);
root.Is(composited);
return root;
}
示例3: LoadSettingsFromCondition
public void LoadSettingsFromCondition(ICondition condition)
{
var c = (ProductivityCondition)condition;
this.settingsPanel.ConditionEnabled = c.Enabled;
this.settingsPanel.Pomodoros = c.Pomodoros;
this.settingsPanel.Duration = c.Duration;
}
示例4: LockedDownFileStore
public LockedDownFileStore(string filePath, ICondition backingCondition = null)
: base(
NaturalInMemoryStore.New()
.DecorateWithBackingLockedFile(filePath, backingCondition)
)
{
}
示例5: LoadConditionFromXml
public override void LoadConditionFromXml(ICondition condition, XmlElement conditionElement)
{
var c = condition as TimeOfDayCondition;
c.StartTime = TimeSpan.Parse(conditionElement.GetAttribute("start"));
c.EndTime = TimeSpan.Parse(conditionElement.GetAttribute("end"));
c.ShouldBeWithin = bool.Parse(conditionElement.GetAttribute("shouldBeWithin"));
}
示例6: ChainCondition
public ChainCondition(int? transitionTarget, ICondition[] subconditions)
{
_currentIndex = 0;
_subconditions = subconditions;
_transitionTarget = transitionTarget;
_hasNotification = false;
}
示例7: DetachCondition
/// <summary>
/// This operation detaches a Condition from the WaitSet. If the Condition was not attached
/// to this WaitSet, the operation returns PreconditionNotMet
/// </summary>
/// <param name="condition">The attached condition in the WaitSet which is to be detached.</param>
/// <returns>Possible return codes are: Ok, Error, BadParameter, OutOfResources or PreconditionNotMet.</returns>
public ReturnCode DetachCondition(ICondition condition)
{
Condition conditionObj = (Condition)condition;
return OpenSplice.Gapi.WaitSet.detach_condition(
GapiPeer,
conditionObj.GapiPeer);
}
示例8: ExpiresWhen
public static IHasExpirable ExpiresWhen(this IHasExpirable thing, ICondition condition)
{
Condition.Requires(thing).IsNotNull();
thing.Expirable = thing.Expirable.DecorateWithConditionalExpirable(condition);
return thing;
}
示例9: compileFirstJoin
/// <summary> TODO - note the logic feels a bit messy. Need to rethink it and make it
/// simpler. When the first conditional element is Exist, it can only have
/// literal constraints, so we shouldn't need to check if the last node
/// is a join. That doesn't make any sense. Need to rethink this and clean
/// it up. Peter Lin 10/14/2007
/// </summary>
public override void compileFirstJoin(ICondition condition, Rule.IRule rule)
{
BaseJoin bjoin = new ExistJoinFrst(ruleCompiler.Engine.nextNodeId());
ExistCondition cond = (ExistCondition) condition;
BaseNode base_Renamed = cond.LastNode;
if (base_Renamed != null)
{
if (base_Renamed is BaseAlpha)
{
((BaseAlpha) base_Renamed).addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
}
else if (base_Renamed is BaseJoin)
{
((BaseJoin) base_Renamed).addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
}
}
else
{
// the rule doesn't have a literal constraint so we need to Add
// ExistJoinFrst as a child
ObjectTypeNode otn = ruleCompiler.findObjectTypeNode(cond.TemplateName);
otn.addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
}
// important, do not call this before ExistJoinFrst is added
// if it's called first, the List<Object> will return index
// out of bound, since there's nothing in the list
cond.addNode(bjoin);
}
示例10: Rule
public Rule(ICategory applyCategory, IAction action, ICondition condition, string name)
{
m_condition = condition;
m_action = action;
m_applyCategory = applyCategory;
m_name = name;
}
示例11: compileJoin
/// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node.
/// It uses the globally declared prevCE and prevJoinNode
/// </summary>
public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule)
{
TestCondition tc = (TestCondition) condition;
ShellFunction fn = (ShellFunction) tc.Function;
fn.lookUpFunction(ruleCompiler.Engine);
IParameter[] oldpm = fn.Parameters;
IParameter[] pms = new IParameter[oldpm.Length];
for (int ipm = 0; ipm < pms.Length; ipm++)
{
if (oldpm[ipm] is ValueParam)
{
pms[ipm] = ((ValueParam) oldpm[ipm]).cloneParameter();
}
else if (oldpm[ipm] is BoundParam)
{
BoundParam bpm = (BoundParam) oldpm[ipm];
// now we need to resolve and setup the BoundParam
Binding b = rule.getBinding(bpm.VariableName);
BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding);
newpm.VariableName = bpm.VariableName;
pms[ipm] = newpm;
}
}
BaseJoin joinNode = null;
if (tc.Negated)
{
joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
}
else
{
joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
}
((TestNode) joinNode).lookUpFunction(ruleCompiler.Engine);
return joinNode;
}
示例12: CreateConditionDisplay
/// <summary>
/// Creates a visual representation of a condition
/// </summary>
/// <returns>A ConditionMethodDisplay object</returns>
public static ConditionDisplayBase CreateConditionDisplay(ICondition condition, Workshare.Policy.PolicyType type)
{
ConditionUnitFactory.PreDefinedConditionType conditionType = ConditionUnitFactory.PreDefinedConditionType.Undefined;
try
{
conditionType = CustomAttributes.GetPreDefinedConditionType(condition);
}
catch (ArgumentException ex)
{
Logger.LogError("Condition is not one of our predefined types.");
Logger.LogError(ex);
return null;
}
switch (conditionType)
{
case ConditionUnitFactory.PreDefinedConditionType.ContentInFileContext:
return new ConditionDisplayContentInFileContext(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.RegexInFileContext:
return new ConditionDisplayRegexInFileContext(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.ContentInFileName:
return new ConditionDisplayContentInFileName(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.RegexInFileName:
return new ConditionDisplayRegexInFileName(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.FileSize:
return new ConditionDisplayFileSize(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.FileType:
return new ConditionDisplayFileType(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInFile:
return new ConditionDisplayHiddenDataInFile(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.CustomProperty:
return new ConditionDisplayCustomProperty(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.PasswordProtectedFile:
return new ConditionDisplayPasswordProtectedFile(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.DocumentRestrictions:
return new ConditionDisplayDocumentRestrictions(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.PiiInFile:
return new ConditionDisplayPiiInFile(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.FileProperty:
return new ConditionDisplayFileProperty(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.EmbeddedEmail:
return new ConditionDisplayEmbeddedEmail(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.EmailAdresses:
return new ConditionDisplayEmailAddresses(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInPDF:
return new ConditionDisplayHiddenDataInPDF(condition, type);
case ConditionUnitFactory.PreDefinedConditionType.TotalAttachmentSize:
return new ConditionDisplayTotalAttachmentSize(condition, type);
default:
{
Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
"CONDITION_INVALID_PREDEFINED",
"Workshare.PolicyDesigner.Properties.Resources",
System.Reflection.Assembly.GetExecutingAssembly());
Logger.LogError(errorMessage.LogString);
throw new ArgumentException(errorMessage.DisplayString);
}
}
}
示例13: AddCondition
public void AddCondition(ICondition c)
{
lock (_conditions)
{
_conditions.Add(c);
}
}
示例14: IsConditionLoss
private static bool IsConditionLoss(ICondition newCondition, ICondition oldCondition)
{
if (newCondition is AbstractAtomicCondition)
{
if (oldCondition is AbstractCompositeCondition)
{
var condition = (AbstractCompositeCondition) oldCondition;
if (condition.ConditionList.Count > 0)
{
return true;
}
}
}
else if (newCondition is AbstractSingleCondition)
{
if (oldCondition is AbstractMultipleCondition)
{
var condition = (AbstractMultipleCondition) oldCondition;
if (condition.ConditionList.Count > 1)
{
return true;
}
}
}
return false;
}
示例15: DataSelectParameter
public DataSelectParameter(string fullName, ICondition condition, string scope, Paging paging, Sorting[] sortings) : base(fullName)
{
_condition = condition;
_scope = scope;
_paging = paging;
_sortings = sortings;
}