本文整理汇总了C#中Filter类的典型用法代码示例。如果您正苦于以下问题:C# Filter类的具体用法?C# Filter怎么用?C# Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Filter类属于命名空间,在下文中一共展示了Filter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImageFigure
public ImageFigure(Image Image, Rectangle Source, Rectangle Destination, Filter Filter)
{
this.Image = Image;
this.Source = Source;
this.Destination = Destination;
this.Filter = Filter;
}
示例2: ChannelParams
public ChannelParams(AnalogInChannelsEnum channelName, Filter channelFilter, ProgrammableGainAmplifier channelPGA, AnalogInLatch channelLatch)
{
_channelName = channelName;
ChannelFilter = channelFilter;
ChannelPGA = channelPGA;
CommonLatch = channelLatch;
}
示例3: GetFiltersSortsFiltersByOrderFirstThenScope
public void GetFiltersSortsFiltersByOrderFirstThenScope()
{
// Arrange
var context = new ControllerContext();
var descriptor = new Mock<ActionDescriptor>().Object;
var actionFilter = new Filter(new Object(), FilterScope.Action, null);
var controllerFilter = new Filter(new Object(), FilterScope.Controller, null);
var globalFilter = new Filter(new Object(), FilterScope.Global, null);
var earlyActionFilter = new Filter(new Object(), FilterScope.Action, -100);
var lateGlobalFilter = new Filter(new Object(), FilterScope.Global, 100);
var provider = new Mock<IFilterProvider>(MockBehavior.Strict);
var collection = new FilterProviderCollection(new[] { provider.Object });
provider.Setup(p => p.GetFilters(context, descriptor))
.Returns(new[] { actionFilter, controllerFilter, globalFilter, earlyActionFilter, lateGlobalFilter });
// Act
Filter[] result = collection.GetFilters(context, descriptor).ToArray();
// Assert
Assert.Equal(5, result.Length);
Assert.Same(earlyActionFilter, result[0]);
Assert.Same(globalFilter, result[1]);
Assert.Same(controllerFilter, result[2]);
Assert.Same(actionFilter, result[3]);
Assert.Same(lateGlobalFilter, result[4]);
}
示例4: FiltersModule
public FiltersModule()
{
Get["/Filters"] = parameters =>
{
FiltersModel model = new FiltersModel();
model.Filters.Add(new Filter(1, "test filter 1", true, 1, 1, 1, 0));
model.Filters.Add(new Filter(2, "filter 2", true, 1, 5, 1, 1));
model.Filters.Add(new Filter(2, "filter 3", false, 1, 5, 1, 1));
model.Filters.Add(new Filter(2, "filter 4", true, 1, 5, 1, 1));
model.Filters.Add(new Filter(2, "filter 5", false, 1, 5, 1, 1));
return View["Index", model];
};
Get["/Filters/Edit"] = parameters =>
{
EditFilterModel model = new EditFilterModel();
Filter filter = new Filter(1, "filter 1", true, 0, 0, 0, 0);
filter.Codecs.Add("XViD");
model.Filter = filter;
return View["EditFilter", model];
};
Post["/Filters/Delete"] = parameters =>
{
return true;
};
}
示例5: UpdateFilter
public Filter UpdateFilter(Filter filter, string dataSourceId)
{
var flt = Mapper.Map<Filter, DynamoDb.Filter>(filter);
flt.DataSourceId = dataSourceId;
this.Context.Save(flt);
return filter;
}
示例6: ShouldDeserializeComplexWorkflowConfiguration3
public void ShouldDeserializeComplexWorkflowConfiguration3()
{
var workFlow = new Workflow();
workFlow.Configuration = "{\"default_filter\":{\"queue\":\"WQccc\"},\"filters\":[{\"expression\":\"1==1\",\"friendly_name\":\"Prioritizing Filter\",\"targets\":[{\"priority\":\"1\",\"queue\":\"WQccc\",\"timeout\":\"300\"}]}]}";
var workFlowConfiguration = new WorkflowConfiguration();
var filter = new Filter
{
FriendlyName = "Prioritizing Filter",
Expression = "1==1",
Targets = new List<Target>() {
new Target {
Queue="WQccc",
Priority="1",
Timeout="300"
}
}
};
workFlowConfiguration.Filters.Add(filter);
workFlowConfiguration.DefaultFilter = new Target() { Queue = "WQccc" };
var config = workFlow.WorkflowConfiguration;
Assert.AreEqual(workFlowConfiguration.ToString(), config.ToString());
}
示例7: getAdvanceFilterResult
internal static void getAdvanceFilterResult(string SelectedValue, Filter filter, ref List<Listing> output)
{
switch (filter)
{
case Filter.Type:
getbyFilterType(SelectedValue, ref output);
break;
case Filter.Status:
getbyFilterStatus(SelectedValue, ref output);
break;
case Filter.SAP:
getbyFilterSAPStatus(SelectedValue, ref output);
break;
case Filter.Title:
int SelectedID = Convert.ToInt32(SelectedValue);
getbyFilterTitle(SelectedID, ref output);
break;
case Filter.NotDefined:
getbyFilterWorkflow(SelectedValue, ref output);
break;
case Filter.Supervisors:
getByFilterSupervisor(SelectedValue, ref output);
break;
}
}
示例8: GetCompanies
private JObject GetCompanies(int rows, int page, string sidx, string sord, Filter filters)
{
IQueryable<Company> items = Companies.SortBy(filters, sidx, sord);
int totalItems = items.Count();
//in a real app Count should probably be retrieved asynchronously
//int totalItems = await items.CountAsync();
int totalPages = totalItems / rows;
if (totalItems % rows > 0)
{
totalPages++;
}
items = items.Skip((page - 1) * rows).Take(rows);
List<Company> listOfItems = items.ToList();
//List<Company> listOfItems = await items.ToListAsync();
dynamic result = new JObject();
result.total = totalPages;
result.records = totalItems;
result.page = page;
result.rows = new JArray(listOfItems.Select(c =>
{
dynamic o = new JObject();
o.id = c.CompanyID;
o.cell = new JArray(c.CompanyID, c.Name, c.Address);
return o;
}).ToArray());
return result;
}
示例9: ManyToManyRelationship
public ManyToManyRelationship(string name, bool isUserDefined, OneToManyRelationship primaryRelationship, ManyToOneRelationship foreignRelationship, Filter filter)
: base(name, isUserDefined, primaryRelationship.Parent, primaryRelationship.Parent, primaryRelationship.PrimaryColumns, foreignRelationship.ForeignRelationship.Parent, foreignRelationship.ForeignRelationship.PrimaryColumns, filter)
{
_intermediatePrimaryRelationship = primaryRelationship;
_intermediateForeignRelationship = foreignRelationship;
ResetDefaults();
}
示例10: GetWordByNameCategoryAndWordPackID
public Word GetWordByNameCategoryAndWordPackID(string Name, int CategoryID, int WordPackID)
{
Filter[] Filters = new Filter[]
{
new Filter(FilterType.And, new Field[]
{
NameField,
CategoryIDField,
WordPackIDField
},
new string[]
{
"Name",
"CategoryID",
"WordPackID"
},
new object[]
{
Name,
CategoryID,
WordPackID
})
};
var Words = GetObjectsByFilters(Filters);
Word word = Words.Cast<Word>().ToList().FirstOrDefault();
if (word == null)
{
word = new Word(0, Name, CategoryID, WordPackID);
}
return word;
}
示例11: LastModified
public static Continuation LastModified(this ICacheSteps _,
Filter<DateTime> lastModifiedFilter)
{
return step => ctx =>
{
DateTime lastModified, d;
var ifModifiedHeader = ctx.Request.Headers["If-Modified-Since"];
// if a valid date has been given as a validator
if (!string.IsNullOrEmpty(ifModifiedHeader) &&
DateTime.TryParseExact(ifModifiedHeader, "R", CultureInfo.CurrentCulture,
DateTimeStyles.RoundtripKind, out d)) {
// run the filter and check the modified date,
lastModified = lastModifiedFilter(ctx, d);
// automatically returning 304 Not Modified if date indicates not modified
if (roughCompare(lastModified.ToUniversalTime(), d.ToUniversalTime()) <= 0)
step = fu.Compose(
fu.Http.Header("Last-Modified", lastModified.ToString("R")),
fu.Http.NotModified())
(fu.EndAct);
}
else {
lastModified = lastModifiedFilter(ctx, DateTime.MinValue);
}
fu.Http.Header("Last-Modified", lastModified.ToString("R"))
(step)(ctx);
};
}
示例12: get
public static Task<Get> get(int owner_id, long offset = 0, byte count = 100, Filter filter = Filter.owner)
{
return Task.Run<Get>(() =>
{
try
{
//Собираем параметры
StringBuilder data = new StringBuilder();
data.Append("&owner_id=" + owner_id);
data.Append("&offset=" + offset);
data.Append("&filter=" + filter.ToString());
data.Append("&extended=1");
if (count > 0 && count <= 100)
data.Append("&count=" + count);
//Получаем и возвращаем результаты
string json = Regex.Replace(result.get("wall.get", data.ToString(), true), "^{\"response\":{\"wall\":\\[([0-9]+),{\"(.*)}$", "{\"count\":$1,\"wall\":[{\"$2");
return JsonConvert.DeserializeObject<Get>(json);
}
catch (Newtonsoft.Json.JsonReaderException) { }
catch { }
//Ошибка
return new Get();
});
}
示例13: fill
/// <summary>
/// Fills the list provided with the element matching the filter provided
/// </summary>
/// <param name="retVal">The list to be filled with the element matching the condition expressed in the filter</param>
/// <param name="filter">The filter to apply</param>
public override void fill(List<Utils.INamable> retVal, Filter.AcceptableChoice filter)
{
if (filter(Value))
{
retVal.Add(Value);
}
}
示例14: cmbCardFilter_SelectedIndexChanged
private void cmbCardFilter_SelectedIndexChanged(object sender, EventArgs e)
{
switch (cmbCardFilter.SelectedIndex)
{
case 0:
//"全部"
CardFilter = (x) => { return true; };
break;
case 1:
//"随从"
CardFilter = (x) => { return x.卡牌种类 == CardBasicInfo.资源类型枚举.随从; };
break;
case 2:
//"法术"
CardFilter = (x) => { return x.卡牌种类 == CardBasicInfo.资源类型枚举.法术; };
break;
case 3:
// "武器"
CardFilter = (x) => { return x.卡牌种类 == CardBasicInfo.资源类型枚举.武器; };
break;
default:
break;
}
SetCardListView();
}
示例15: Filtered
static List<int> Filtered(int[] array1, Filter filter1, Filter filter2)
{
List<int> filtered1 = new List<int>();
foreach (var item in array1)
{
if (filter1(item))
{
filtered1.Add(item);
}
}
List<int> filtered2 = new List<int>();
foreach (var item in array1)
{
if (filter2(item))
{
filtered2.Add(item);
}
}
List<int> filtered = new List<int>();
var array3 = filtered1.ToArray();
var array2 = filtered2.ToArray();
for (int i = 0; i < array3.Length; i++)
{
filtered.Add(array3[i] * array2[i]);
}
return filtered;
}