本文整理汇总了C#中DataItem类的典型用法代码示例。如果您正苦于以下问题:C# DataItem类的具体用法?C# DataItem怎么用?C# DataItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataItem类属于命名空间,在下文中一共展示了DataItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DownloadFile
public string DownloadFile(DataItem dataItem, Country country, Resolution resolution, DateTime dateTime)
{
var url = BuildFileName(dataItem, country, resolution, dateTime);
var file = DownloadFile(url);
File.WriteAllBytes(SavePath + url, file);
return url;
}
开发者ID:af3290,项目名称:ema,代码行数:7,代码来源:DataDownloader.cs
示例2: CollectionChangedReplaceDataItemsResultInCollectionChangedForAdapter
public void CollectionChangedReplaceDataItemsResultInCollectionChangedForAdapter()
{
//create a list of dataItem containing urls
IEventedList<IDataItem> dataItems = new EventedList<IDataItem>();
var oldUrl = new Url();
var newUrl = new Url();
var dataItem = new DataItem(oldUrl);
dataItems.Add(dataItem);
//adapter for the list
var adapter = new DataItemListAdapter<Url>(dataItems);
int callCount = 0;
adapter.CollectionChanged += (sender, e) =>
{
callCount++;
Assert.AreEqual(NotifyCollectionChangedAction.Replace,e.Action);
Assert.AreEqual(adapter, sender);
Assert.AreEqual(newUrl, e.Item);
//discutable but current eventedlist implementation does this
Assert.AreEqual(-1, e.OldIndex);
Assert.AreEqual(0, e.Index);
};
//action! replace one dataitem with another
dataItems[0] = new DataItem(newUrl);
Assert.AreEqual(1, callCount);
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:DataItemListAdapterTest.cs
示例3: HomePageViewModel
public HomePageViewModel()
{
var worldRepository = new WorldDataRepository();
Data = new ObservableCollection<DataItem>();
ItemsSource = new ObservableCollection<CountryItem>();
worldRepository.GetCountries().ContinueWith(list =>
{
Countries = list.Result;
var dataItems = new ObservableCollection<DataItem>();
foreach (var item in Countries)
{
var countryItem = new CountryItem
{
Name = item.Name,
Change = item.Chg1Y,
IsChangePositive = item.IsChangePositive
};
double val = 0.0;
double.TryParse(item.LifeExpectancy, out val);
countryItem.LifeExpectancy = val;
ItemsSource.Add(countryItem);
}
foreach (var region in worldRepository.CountriesByRegion)
{
var dataItem = new DataItem {Label = region.Key, Level = region.Value.Sum(x => x.Level.ToDouble())};
dataItems.Add(dataItem);
}
WorldPopulation = dataItems.Sum(l => l.Level * 1000).ToString("#,##0,,,.B", CultureInfo.InvariantCulture);
LifeExpectancy = ItemsSource.Average(x => x.LifeExpectancy).ToString("00.00", CultureInfo.InvariantCulture);
Data = dataItems;
});
}
开发者ID:nishanil,项目名称:WorldData-Dashboard,代码行数:35,代码来源:HomePageViewModel.cs
示例4: GetData
public void GetData(Action<DataItem, Exception> callback)
{
// Use this to connect to the actual data service
var item = new DataItem("Welcome to MVVM Light");
callback(item, null);
}
开发者ID:no10pc,项目名称:LazyListBoxBlogPost,代码行数:7,代码来源:DataService.cs
示例5: ProcessBytes
public void ProcessBytes(byte[] bytes, int byteSize)
{
Debug.Log("SYNC IN " + dataModel.client.prefab);
try {
MemoryStream memStream = new MemoryStream(bytes, false);
BinaryReader br = new BinaryReader(memStream);
Debug.Log ("PLN: 1" );
var item = new DataItem ();
item.uid = br.ReadInt32 ();
item.position.x = br.ReadSingle();
item.position.y = br.ReadSingle();
item.position.z = br.ReadSingle();
item.velocity.x = br.ReadSingle();
item.velocity.y = br.ReadSingle();
item.velocity.z = br.ReadSingle();
//Debug.Log ("@" + (client== null));
syncLocally(item);
}catch (Exception e){
Debug.Log(e);
}
}
开发者ID:siddht1,项目名称:GameJam2013-AtTheCore,代码行数:28,代码来源:SyncEngine.cs
示例6: createByForm
public IDataItem createByForm(IConnection aConnection, IWin32Window aOwner)
{
Connection lConnection = (Connection)aConnection;
DataItem lItem = new DataItem();
bool lCreated = false;
using (var lSetupForm = new ItemSetupForm(lConnection, lItem))
{
do
{
try
{
lSetupForm.ShowDialog(aOwner);
if (lSetupForm.DialogResult == DialogResult.OK)
{
lItem = lConnection.addItem(lSetupForm.Topic, lSetupForm.Subscribe, lSetupForm.Publish, "");
lCreated = true;
}
else
{
lItem = null;
}
}
catch (Exception lExc)
{
Log.Error("Error while user was creating new data item for MQQT broker '"
+ lConnection.mHost + ":" + lConnection.mPort + "'. " + lExc.Message, lExc.ToString());
MessageForm.showMessage(lExc.Message, aOwner);
}
}
while (lSetupForm.DialogResult == DialogResult.OK && lCreated == false);
}
return lItem;
}
开发者ID:yuriik83,项目名称:Process-Simulator-2-OpenSource,代码行数:35,代码来源:Factory.cs
示例7: HomePageViewModel
public HomePageViewModel()
{
var worldRepository = new WorldDataRepository();
Data = new ObservableCollection<DataItem>();
ItemsSource = new ObservableCollection<Item>();
worldRepository.GetCountries().ContinueWith((list) =>
{
Countries = list.Result;
var data = new ObservableCollection<DataItem>();
foreach (var item in Countries)
{
ItemsSource.Add(new Item { Name = item.Name, Change = item.Chg1Y, IsChangePositive = item.IsChangePositive});
}
foreach (var region in worldRepository.CountriesByRegion)
{
var dataItem = new DataItem();
dataItem.Label = region.Key;
dataItem.Level = region.Value.Sum(x => x.Level.ToDouble());
data.Add(dataItem);
}
Data = data;
});
}
开发者ID:HUSSAR-mtrela,项目名称:WorldData-Dashboard,代码行数:25,代码来源:HomePageViewModel.cs
示例8: GetData
public Task<DataItem> GetData()
{
// Use this to create design time data
var item = new DataItem("Welcome to MVVM Light [design]");
return Task.FromResult(item);
}
开发者ID:a9595,项目名称:PjNewsLib,代码行数:7,代码来源:DesignDataService.cs
示例9: TestSequenceLinkFirstTargetThenSource
public void TestSequenceLinkFirstTargetThenSource()
{
string result = "";
SimplerModel sourceModel = new SimplerModel { Name = "source" };
sourceModel.Executing += (s, e) => result += ((SimplerModel)s).Name;
SimplerModel targetModel = new SimplerModel { Name = "target" };
targetModel.Executing += (s, e) => result += ((SimplerModel)s).Name;
IDataItem sourceInput = new DataItem { Name = "SI", Value = new object(), Role = DataItemRole.Input };
IDataItem sourceOutput = new DataItem { Name = "SO", Value = new object(), Role = DataItemRole.Output };
IDataItem targetInput = new DataItem { Name = "TI", Value = new object(), Role = DataItemRole.Input };
IDataItem targetOutput = new DataItem { Name = "TO", Value = new object(), Role = DataItemRole.Output };
sourceModel.DataItems.Add(sourceInput);
sourceModel.DataItems.Add(sourceOutput);
targetModel.DataItems.Add(targetInput);
targetModel.DataItems.Add(targetOutput);
var compositeModel = new CompositeModel
{
Name = "composite model",
Models = { sourceModel, targetModel }
};
sourceInput.LinkTo(targetOutput);
compositeModel.Initialize();
compositeModel.Execute();
Assert.AreEqual("targetsource", result);
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:32,代码来源:CompositeModelTest.cs
示例10: ProcessInput
void ProcessInput()
{
//Debug.Log ("IN");
float dV= 0.25f;
DataItem d;
if(Input.anyKeyDown){
d = dataModel.GetItem(this);
Debug.Log ("PREL-- X:" + d.velocity.x +" Y:"+ d.velocity.y );
if (Input.GetKeyDown (KeyCode.W)){
d.velocity.y += dV;
}else if(Input.GetKeyDown (KeyCode.S)){
d.velocity.y += -dV;
}else if(Input.GetKeyDown (KeyCode.D)){
d.velocity.x += dV;
}else if(Input.GetKeyDown (KeyCode.A)){
d.velocity.x += -dV;
}
Debug.Log ("POST-- X:" + d.velocity.x +" Y:"+ d.velocity.y );
Debug.Log ("PINTPU");
DataItem di = new DataItem();
di.uid = d.uid;
di.position = d.position;
di.velocity = d.velocity;
dataModel.UpdateItem(di);
saveDataToDataModel();
}
}
开发者ID:siddht1,项目名称:GameJam2013-AtTheCore,代码行数:28,代码来源:MetaData.cs
示例11: InputAreaData
/// <summary>
/// Конструктор.
/// </summary>
/// <param name="aTopicName">Имя топика для OPC-тегов.</param>
/// <param name="aOpcConnection">Соединеие с OPC-сервером.</param>
public InputAreaData(string aTopicName, OpcConnectionHolder aOpcConnection)
{
IdCheckOutputItem = new DataItem(aTopicName + ITEMID_INPUTAREA_ID_CHECK_OUT, aOpcConnection);
IdNumberOutputItem = new DataItem(aTopicName + ITEMID_INPUTAREA_ID_NUMBER_OUT, aOpcConnection);
IdCheckInputItem = new DataItem(aTopicName + ITEMID_INPUTAREA_ID_CHECK_IN, aOpcConnection);
IdNumberInputItem = new DataItem(aTopicName + ITEMID_INPUTAREA_ID_NUMBER_IN, aOpcConnection);
}
开发者ID:desla,项目名称:AS,代码行数:12,代码来源:InputAreaData.cs
示例12: addItem
public void addItem(DataItem di)
{
Debug.Log ("ADDD " + di.uid + client.prefab);
allThings[di.uid] = di;
//uidObjectMap[di.uid] = go;
newItems.Enqueue(di.uid);
}
开发者ID:siddht1,项目名称:GameJam2013-AtTheCore,代码行数:7,代码来源:DataModel.cs
示例13: ItemsLoaded
private void ItemsLoaded()
{
DataItem root = new DataItem();
root.Text = "Personal Folders";
root.ImageUrl = "../../Images/ContextMenu/Outlook/1PersonalFolders.png";
root.IsExpanded = true;
DataItem deletedItems = new DataItem();
root.Items.Add(deletedItems);
deletedItems.Text = "Deleted Items(6)";
deletedItems.ImageUrl = "../../Images/ContextMenu/Outlook/2DeletedItems.png";
DataItem inbox = new DataItem();
root.Items.Add(inbox);
inbox.Text = "Inbox(14)";
inbox.ImageUrl = "../../Images/ContextMenu/Outlook/4Inbox.png";
DataItem folders = new DataItem();
inbox.Items.Add(folders);
folders.Text = "Folders";
folders.ImageUrl = "../../Images/ContextMenu/Outlook/folder.png";
DataItem junkEmails = new DataItem();
root.Items.Add(junkEmails);
junkEmails.Text = "Junk E-mails";
junkEmails.ImageUrl = "../../Images/ContextMenu/Outlook/junk.png";
DataItem outbox = new DataItem();
root.Items.Add(outbox);
outbox.Text = "Outbox";
outbox.ImageUrl = "../../Images/ContextMenu/Outlook/outbox.png";
DataItem sentItems = new DataItem();
root.Items.Add(sentItems);
sentItems.Text = "Sent Items";
sentItems.ImageUrl = "../../Images/ContextMenu/Outlook/sent.png";
DataItem search = new DataItem();
root.Items.Add(search);
search.Text = "Search Folder";
search.ImageUrl = "../../Images/ContextMenu/Outlook/searchFolder.png";
DataItem followup = new DataItem();
search.Items.Add(followup);
followup.Text = "From Follow up";
followup.ImageUrl = "../../Images/ContextMenu/Outlook/folder.png";
DataItem largeMail = new DataItem();
search.Items.Add(largeMail);
largeMail.Text = "Large Mail";
largeMail.ImageUrl = "../../Images/ContextMenu/Outlook/search.png";
DataItem unreadMail = new DataItem();
search.Items.Add(unreadMail);
unreadMail.Text = "Unread Mail";
unreadMail.ImageUrl = "../../Images/ContextMenu/Outlook/search.png";
this.Items.Add(root);
}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:59,代码来源:DataViewModel.cs
示例14: OutputAreaData
/// <summary>
/// Конструктор.
/// </summary>
/// <param name="aTopicName">Имя топика.</param>
/// <param name="aOpcConnection">Соединение с OPC-сервером.</param>
public OutputAreaData(string aTopicName, OpcConnectionHolder aOpcConnection)
{
IdCheckOutputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_ID_CHECK_OUT, aOpcConnection);
IdNumberOutputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_ID_NUMBER_OUT, aOpcConnection);
IdCheckInputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_ID_CHECK_IN, aOpcConnection);
IdNumberInputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_ID_NUMBER_IN, aOpcConnection);
WeightOutputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_WEIGHT_OUT, aOpcConnection);
LengthOutputItem = new DataItem(aTopicName + ITEMID_OUTPUTAREA_LENGTH_OUT, aOpcConnection);
}
开发者ID:desla,项目名称:AS,代码行数:14,代码来源:OutputAreaData.cs
示例15: GetFristCol
public Stock GetFristCol(string data)
{
List<Price> prices = new List<Price>();
List<DataItem> items = new List<DataItem>();
string firstCol = string.Empty;
List<string> lines = data.Split('\n').ToList<string>();
for (int i = 2; i < lines.Count; i++)
{
string line = lines[i];
List<string> numStrs = line.Split(' ').ToList<string>();
if (numStrs.Count < 5)
continue;
DataItem item = new DataItem();
Price price = new Price();
price.content = new string[4];
for (int numI = 0; numI < numStrs.Count; numI++)
{
if (numI == 0)
item.content = numStrs[numI];
if (numI > 0 && numI < 5)
{
price.content[numI-1] = numStrs[numI];
if (numI == 3)
{
price.content[numI-1] = numStrs[numI+1];
}
if (numI == 4)
{
price.content[numI - 1] = numStrs[numI-1];
}
}
// if (numI > 0 && numI < 4)
//price.content += ",";
}
items.Add(item);
prices.Add(price);
}
Stock stock = new Stock();
stock.price = new Price[prices.Count];
for (int itemI = 0; itemI < items.Count; itemI++)
{
stock.data += items[itemI].content;
if (itemI != items.Count - 1)
stock.data += ",";
}
for (int priceI = 0; priceI < prices.Count; priceI++)
{
stock.price[priceI] = prices[priceI]; // += "[" + prices[priceI].content + "]";
//if (priceI != prices.Count - 2)
// stock.price += ";";
}
// stock.data = "[" + stock.data + "]";
// stock.price = "[" + stock.price + "]";
return stock;
}
开发者ID:heavenlw,项目名称:Ebank,代码行数:57,代码来源:stockController.cs
示例16: saveDataToDataModel
void saveDataToDataModel()
{
DataItem dm = new DataItem();
dm.uid = uid;
dm.position = gameObj.transform.position;
dm.velocity = velocity;
dataModel.UpdateItem(dm);
}
开发者ID:siddht1,项目名称:GameJam2013-AtTheCore,代码行数:9,代码来源:MetaData.cs
示例17: Append
private void Append(String name, DataItem dataItem)
{
Append(FormatHeader(name, dataItem));
if (dataItem.Length > 0) {
Stream.Write(dataItem.GetBytes(), 0, dataItem.Length);
}
AppendNewline();
}
开发者ID:Ponoko,项目名称:ponoko-api-csharp,代码行数:10,代码来源:MultipartFormDataBodyBuilder.cs
示例18: DocumentDlg
public DocumentDlg(string name, string curDoc)
{
data = new DataItem(curDoc);
InitializeComponent();
txtDocumenting.Text = name;
txtContent.DataContext = data;
Buttons = new Button[] {
OkButton,
CancelButton
};
}
开发者ID:nonconforme,项目名称:UrhoAngelscriptIDE,代码行数:12,代码来源:DocumentDlg.xaml.cs
示例19: GetList
public static List<DataItem> GetList(int pCount)
{
var aList = new List<DataItem>(pCount);
for (int i = 1; i <= pCount; i++)
{
var aItem = new DataItem();
aItem.Text = string.Format("Text_{0}", i);
aItem.Value = string.Format("Value_{0}", i);
aList.Add(aItem);
}
return aList;
}
开发者ID:ningkyolei,项目名称:JavaScript,代码行数:12,代码来源:TestInterface.ashx.cs
示例20: CreateContainingSimpleValue
public void CreateContainingSimpleValue()
{
DataItem d1 = new DataItem("item", typeof(int));
int i = 0;
d1.Value = i;
d1.Name = "i";
d1.Description = "simple integer value";
Assert.AreEqual(d1.Name, "i");
}
开发者ID:lishxi,项目名称:_SharpMap,代码行数:12,代码来源:DataItemTest.cs
注:本文中的DataItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论