本文整理汇总了C#中IDataItem类的典型用法代码示例。如果您正苦于以下问题:C# IDataItem类的具体用法?C# IDataItem怎么用?C# IDataItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IDataItem类属于命名空间,在下文中一共展示了IDataItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillInternal
void FillInternal (DataRow row,IDataItem item)
{
if (item != null)
{
BaseImageItem bi = item as BaseImageItem;
if (bi != null) {
using (System.IO.MemoryStream memStream = new System.IO.MemoryStream()){
Byte[] val = row[bi.ColumnName] as Byte[];
if (val != null) {
if ((val[78] == 66) && (val[79] == 77)){
memStream.Write(val, 78, val.Length - 78);
} else {
memStream.Write(val, 0, val.Length);
}
System.Drawing.Image image = System.Drawing.Image.FromStream(memStream);
bi.Image = image;
}
}
}
else
{
var dataItem = item as BaseDataItem;
if (dataItem != null) {
dataItem.DBValue = ExtractDBValue(row,dataItem).ToString();
}
return;
}
}
}
示例2: GetValue
/// <inheritdoc />
public object GetValue(IDataItem item)
{
if (item == null)
throw new ArgumentNullException("item");
return GetValueImpl(item);
}
示例3: Transform
public IDataItem Transform(IDataItem dataItem)
{
foreach (var transformation in transformations)
dataItem = transformation.Transform(dataItem);
return dataItem;
}
示例4: Join
/// <inheritdoc />
public IEnumerable<IList<IDataItem>> Join(IList<IDataProvider> providers, IList<ICollection<DataBinding>> bindingsPerProvider,
bool includeDynamicItems)
{
var enumerators = new IEnumerator<IDataItem>[providers.Count];
for (int i = 0; i < providers.Count; i++)
enumerators[i] = providers[i].GetItems(bindingsPerProvider[i], includeDynamicItems).GetEnumerator();
int providerCount = providers.Count;
for (;;)
{
var itemList = new IDataItem[providerCount];
bool gotOne = false;
for (int i = 0; i < providerCount; i++)
{
if (enumerators[i].MoveNext())
{
itemList[i] = enumerators[i].Current;
gotOne = true;
}
else
{
itemList[i] = NullDataItem.Instance;
}
}
if (! gotOne)
break;
yield return itemList;
}
}
示例5: HandlesDegenerateCaseWithOneProvider
public void HandlesDegenerateCaseWithOneProvider()
{
DataBinding[][] bindingsPerProvider = new DataBinding[][] {
new DataBinding[] { new DataBinding(0, null) },
};
IDataProvider[] providers = new IDataProvider[] {
Mocks.StrictMock<IDataProvider>()
};
IDataItem[][] itemsPerProvider = new IDataItem[][] {
new IDataItem[] {
new ScalarDataItem<int>(1, null, true),
new ScalarDataItem<int>(2, null, false)
},
};
using (Mocks.Record())
{
SetupResult.For(providers[0].GetItems(bindingsPerProvider[0], true)).Return(itemsPerProvider[0]);
}
using (Mocks.Playback())
{
List<IList<IDataItem>> items = new List<IList<IDataItem>>(PairwiseJoinStrategy.Instance.Join(providers, bindingsPerProvider, true));
Assert.Count(2, items);
Assert.AreSame(itemsPerProvider[0][0], items[0][0]);
Assert.AreSame(itemsPerProvider[0][1], items[1][0]);
}
}
示例6: RemappedFieldsDataItem
public RemappedFieldsDataItem(IDataItem dataItem, IReadOnlyMap<string, string> fieldsMapping)
: base(dataItem)
{
Guard.NotNull("fieldsMapping", fieldsMapping);
this.fieldsMapping = fieldsMapping;
inactiveMappings = GetNonExistingMappingFields(fieldsMapping);
}
示例7: CancelNotificationForDataItem
/// <summary>
/// Deletes the check-in notification when the DataITem is deleted
/// </summary>
/// <param name="dataItem">Used only for logging in this sample, but could be used to identify which notifications to cancel
/// (in this case there is at most 1 notification)</param>
void CancelNotificationForDataItem(IDataItem dataItem)
{
if (Log.IsLoggable (Constants.TAG, LogPriority.Verbose)) {
Log.Verbose(Constants.TAG, "OnDataItemDeleted: DataItem = " + dataItem.Uri);
}
GetSystemService(NotificationService).JavaCast<NotificationManager>().Cancel(Constants.NOTIFICATION_ID);
}
示例8: JoinsItemsCombinatorially
public void JoinsItemsCombinatorially()
{
DataBinding[][] bindingsPerProvider = new DataBinding[][] {
new DataBinding[] { new DataBinding(0, null) },
new DataBinding[] { },
new DataBinding[] { new DataBinding(0, null) },
};
IDataProvider[] providers = new IDataProvider[] {
Mocks.StrictMock<IDataProvider>(),
Mocks.StrictMock<IDataProvider>(),
Mocks.StrictMock<IDataProvider>()
};
IDataItem[][] itemsPerProvider = new IDataItem[][] {
new IDataItem[] {
new ScalarDataItem<int>(1, null, false),
new ScalarDataItem<int>(2, null, true)
},
new IDataItem[] {
new ScalarDataItem<int>(1, null, false),
new ScalarDataItem<int>(2, null, false),
new ScalarDataItem<int>(3, null, false)
},
new IDataItem[] {
new ScalarDataItem<int>(1, null, false),
new ScalarDataItem<int>(2, null, true)
}
};
using (Mocks.Record())
{
Expect.Call(providers[0].GetItems(bindingsPerProvider[0], true)).Return(itemsPerProvider[0]);
Expect.Call(providers[1].GetItems(bindingsPerProvider[1], true)).Return(itemsPerProvider[1]);
Expect.Call(providers[2].GetItems(bindingsPerProvider[2], true)).Return(itemsPerProvider[2]);
}
using (Mocks.Playback())
{
List<IList<IDataItem>> items = new List<IList<IDataItem>>(CombinatorialJoinStrategy.Instance.Join(providers, bindingsPerProvider, true));
Assert.Count(12, items);
int index = 0;
for (int i = 0; i < itemsPerProvider[0].Length; i++)
{
for (int j = 0; j < itemsPerProvider[1].Length; j++)
{
for (int k = 0; k < itemsPerProvider[2].Length; k++)
{
Assert.AreSame(itemsPerProvider[0][i], items[index][0]);
Assert.AreSame(itemsPerProvider[1][j], items[index][1]);
Assert.AreSame(itemsPerProvider[2][k], items[index][2]);
index += 1;
}
}
}
}
}
示例9: CreateDetailsViewModel
/// <inheritdoc />
public override ContentDetailsViewModel CreateDetailsViewModel(IDataItem item)
{
var viewModel = base.CreateDetailsViewModel(item);
viewModel.ProviderName = this.GetManagerInstance().Provider.Name;
return viewModel;
}
示例10: Fill
public override void Fill(IDataItem item)
{
DataRow row = this.Current as DataRow;
if (row != null)
{
this.FillInternal (row,item);
}
}
示例11: WriteAsync
public Task WriteAsync(IDataItem dataItem, CancellationToken cancellation)
{
if (writeCallback != null)
writeCallback(dataItem);
receivedData.Add(dataItem);
return TaskHelper.NoOp;
}
示例12: Open
public static double Open(IDataItem data)
{
System.Diagnostics.Debug.Assert(data != null);
if (data == null)
throw new ArgumentNullException();
return data.Open;
}
示例13: ComparableDataItem
public ComparableDataItem(IDataItem dataItem)
{
if (dataItem == null)
throw new ArgumentNullException("dataItem");
this.dataItem = dataItem;
hash = GetDataItemHash(dataItem);
}
示例14: MedianPrice
public static double MedianPrice(IDataItem data)
{
System.Diagnostics.Debug.Assert(data != null);
if (data == null)
throw new ArgumentNullException();
System.Diagnostics.Debug.Assert(((data.High + data.Low) / 2) == (((double)data.High + data.Low) / 2.0));
return (data.High + data.Low) / 2;
}
示例15: WeightedPrice
public static double WeightedPrice(IDataItem data)
{
System.Diagnostics.Debug.Assert(data != null);
if (data == null)
throw new ArgumentNullException();
System.Diagnostics.Debug.Assert(((data.High + data.Low + data.Close + data.Close) / 4) == (((double)data.High + data.Low + data.Close + data.Close) / 4.0));
return (data.High + data.Low + data.Close + data.Close) / 4;
}