本文整理汇总了C#中System.Collections.ObjectModel.ObservableCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ObjectModel.ObservableCollection.Add方法的具体用法?C# System.Collections.ObjectModel.ObservableCollection.Add怎么用?C# System.Collections.ObjectModel.ObservableCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ObjectModel.ObservableCollection
的用法示例。
在下文中一共展示了System.Collections.ObjectModel.ObservableCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page1
// Constructor
public Page1()
{
InitializeComponent();
/*Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem item = new Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem();
item.MediaSource = "";
SMFPlayer.Playlist = item; */
this.SongName.Text = Playlist.selectedItem.Name;
Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem it = new Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem();
it.DeliveryMethod = Microsoft.SilverlightMediaFramework.Plugins.Primitives.DeliveryMethods.Streaming;
if (Playlist.selectedItem.link != null)
{
it.MediaSource = new Uri(Playlist.selectedItem.link);
}
else
{
MessageBox.Show("Sorry Bro!!");
}
var itList = new System.Collections.ObjectModel.ObservableCollection<Microsoft.SilverlightMediaFramework.Core.Media.PlaylistItem>();
itList.Add(it);
this.SMFPlay.Playlist = itList;
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
示例2: LoadData
private void LoadData()
{
int pageCount = 0;
string filter = "";
System.Collections.ObjectModel.ObservableCollection<object> paras = new System.Collections.ObjectModel.ObservableCollection<object>();
//filter += "[email protected]" + paras.Count().ToString();
//paras.Add(Convert.ToInt32(CheckStates.Approved).ToString());
TextBox txtEmpName = Utility.FindChildControl<TextBox>(expander, "txtEmpName");
if (!string.IsNullOrEmpty(txtEmpName.Text))
{
if (!string.IsNullOrEmpty(filter))
{
filter += " and ";
}
filter += "[email protected]" + paras.Count().ToString();
paras.Add(txtEmpName.Text.Trim());
}
//LoginUserInfo info = new LoginUserInfo();
//info.companyID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
//info.userID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
//client.GetWelfarePaymentDetailsInfosAsync(dataPager.PageIndex, dataPager.PageSize, "welfareDetailsViews.CREATEDATE", filter, new object[]{},
// pageCount, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
}
示例3: MainWindow
public MainWindow()
{
InitializeComponent();
this.Closed += MainWindow_Closed;
DataContext = this;
Clients = new System.Collections.ObjectModel.ObservableCollection<ClientWindow>();
var a = new Client("A");
var b = new Client("B");
Clients.Add(new ClientWindow(a));
Clients.Add(new ClientWindow(b));
cts.Add(a);
cts.Add(b);
mytc.SelectedIndex = 0;
}
示例4: GetSelfRelatedParameterFromDecision
private System.Collections.ObjectModel.ObservableCollection<RelatedParameterViewModel> GetSelfRelatedParameterFromDecision()
{
var parameters = ApplicationContext.Instance.GetFlightParameters(
ApplicationContext.Instance.CurrentAircraftModel);
RelatedParameterViewModel model = new RelatedParameterViewModel(this, true,
this.FindParameter(this.extremumReportItemWrap.ParameterID, parameters));
var collection = new System.Collections.ObjectModel.ObservableCollection<RelatedParameterViewModel>();
collection.Add(model);
return collection;
}
示例5: ExtractPlaylists
public System.Collections.ObjectModel.ObservableCollection<Model.Playlist> ExtractPlaylists()
{
IEnumerable<System.Xml.Linq.XElement> playlists = XElement.Elements();
System.Collections.ObjectModel.ObservableCollection<Model.Playlist> playlistsList = new System.Collections.ObjectModel.ObservableCollection<Model.Playlist>();
if (XElement == null)
return null;
try
{
/* CREATING AN OBSERVABLECOLLECTION FROM ALL PLAYLIST */
foreach (var playlist in playlists)
{
IEnumerable<System.Xml.Linq.XElement> medias = XElement.Elements("Media");
System.Collections.ObjectModel.ObservableCollection<Model.Media> mediasList = new System.Collections.ObjectModel.ObservableCollection<Model.Media>();
/* CREATING AN MEDIA COLLECTION CORRESPONDING TO ALL MEDIAS OF PLAYLIST */
foreach (var media in medias)
{
/* TEST IF XML ELEMENT IS VALID FOR MEDIA */
if (media != null && media.Element("Path") != null && media.Element("Type") != null)
{
Model.Media newMedia = null;
switch ((Model.Media.MediaType)Enum.Parse(typeof(Model.Media.MediaType), media.Element("Type").Value))
{
case Model.Media.MediaType.IMAGE:
newMedia = new Model.Image(media.Element("Path").Value);
break;
case Model.Media.MediaType.VIDEO:
newMedia = new Model.Video(media.Element("Path").Value);
break;
case Model.Media.MediaType.MUSIC:
newMedia = new Model.Music(media.Element("Path").Value);
break;
}
if (newMedia != null)
mediasList.Add(newMedia);
}
}
/* ADDING NEW PLAYLIST ELEMENT TO SELECTION */
playlistsList.Add(new Model.Playlist() { Name = playlist.Element("Name").Value, MediasList = mediasList });
}
}
catch
{ }
return playlistsList;
}
示例6: PopulateData
private void PopulateData()
{
var authScopes = new System.Collections.ObjectModel.ObservableCollection<object>();
authScopes.Add(new ComboBoxItem() { Content = "wl.signin" });
authScopes.Add(new ComboBoxItem() { Content = "wl.basic" });
authScopes.Add(new ComboBoxItem() { Content = "wl.birthday" });
authScopes.Add(new ComboBoxItem() { Content = "wl.calendars" });
authScopes.Add(new ComboBoxItem() { Content = "wl.calendars_update" });
authScopes.Add(new ComboBoxItem() { Content = "wl.contacts_birthday" });
authScopes.Add(new ComboBoxItem() { Content = "wl.contacts_create" });
authScopes.Add(new ComboBoxItem() { Content = "wl.contacts_calendars" });
authScopes.Add(new ComboBoxItem() { Content = "wl.contacts_photos" });
authScopes.Add(new ComboBoxItem() { Content = "wl.contacts_skydrive" });
authScopes.Add(new ComboBoxItem() { Content = "wl.emails" });
authScopes.Add(new ComboBoxItem() { Content = "wl.events_create" });
authScopes.Add(new ComboBoxItem() { Content = "wl.phone_numbers" });
authScopes.Add(new ComboBoxItem() { Content = "wl.photos" });
authScopes.Add(new ComboBoxItem() { Content = "wl.postal_addresses" });
authScopes.Add(new ComboBoxItem() { Content = "wl.phone_numbersbasic" });
authScopes.Add(new ComboBoxItem() { Content = "wl.skydrive" });
authScopes.Add(new ComboBoxItem() { Content = "wl.phone_numbersbasic" });
authScopes.Add(new ComboBoxItem() { Content = "wl.skydrive_update" });
authScopes.Add(new ComboBoxItem() { Content = "wl.work_profile" });
authScopesComboBox.ItemsSource = authScopes;
authScopesComboBox.SelectedIndex = 0;
var methods = new System.Collections.ObjectModel.ObservableCollection<object>();
methods.Add(new ComboBoxItem() { Content = "GET" });
methods.Add(new ComboBoxItem() { Content = "POST" });
methods.Add(new ComboBoxItem() { Content = "PUT" });
methods.Add(new ComboBoxItem() { Content = "DELETE" });
methods.Add(new ComboBoxItem() { Content = "COPY" });
methods.Add(new ComboBoxItem() { Content = "MOVE" });
methodsComboBox.ItemsSource = methods;
methodsComboBox.SelectedIndex = 0;
pathTextBox.Text = "me";
}
示例7: GetPlaylists
public System.Collections.ObjectModel.ObservableCollection<Model.Playlist> GetPlaylists()
{
System.Collections.ObjectModel.ObservableCollection<Model.Playlist> playlistsCollection = new System.Collections.ObjectModel.ObservableCollection<Model.Playlist>();
try
{
IEnumerable<System.Xml.Linq.XElement> playlists = xelement.Elements("Playlist");
foreach (var playlist in playlists)
{
System.Collections.ObjectModel.ObservableCollection<Model.Media> medias = new System.Collections.ObjectModel.ObservableCollection<Model.Media>();
IEnumerable<System.Xml.Linq.XElement> elements = playlist.Elements("Element");
foreach (var elem in elements)
{
if ( elem != null &&
elem.Element("Path") != null &&
elem.Element("Stream") != null &&
elem.Element("Type") != null)
{
Model.Media media = null;
switch ((Model.Media.MediaType)Enum.Parse(typeof(Model.Media.MediaType), elem.Element("Type").Value))
{
case Model.Media.MediaType.MUSIC:
media = new Model.Music(elem.Element("Path").Value, Boolean.Parse(elem.Element("Stream").Value));
break;
case Model.Media.MediaType.PICTURE:
media = new Model.Picture(elem.Element("Path").Value, Boolean.Parse(elem.Element("Stream").Value));
break;
case Model.Media.MediaType.VIDEO:
media = new Model.Video(elem.Element("Path").Value, Boolean.Parse(elem.Element("Stream").Value));
break;
}
if (media != null)
medias.Add(media);
}
}
playlistsCollection.Add(new Model.Playlist()
{
Name = playlist.Attribute("name").Value,
Medias = medias
});
}
}
catch { Console.WriteLine("FAILED GetPlaylists catch"); }
return playlistsCollection;
}
示例8: OnNavigatedTo
/// <summary>
/// 在此页将要在 Frame 中显示时进行调用。
/// </summary>
/// <param name="e">描述如何访问此页的事件数据。Parameter
/// 属性通常用于配置页。</param>
async protected override void OnNavigatedTo(NavigationEventArgs e)
{
System.Collections.ObjectModel.ObservableCollection<object> ItemList = new System.Collections.ObjectModel.ObservableCollection<object>();
foreach (View s in Constants.ViewList)
{
ListBoxItem item = new ListBoxItem();
item.Content = s;
item.Name = s.ClassType.FullName;
ItemList.Add(item);
}
lstViews.ItemsSource = ItemList;
//get my user info
var info = await UserInfoService.Instance.RequestMyUserInfo();
imgHead.Source = new BitmapImage(new Uri(info.Result.Head_url));
txtName.Text = info.Result.User_name;
}
示例9: GetMedias
public System.Collections.ObjectModel.ObservableCollection<Media> GetMedias()
{
IEnumerable<System.Xml.Linq.XElement> medias = xelement.Elements();
System.Collections.ObjectModel.ObservableCollection<Media> mediasList = new System.Collections.ObjectModel.ObservableCollection<Media>();
//List<Media> mediasList = new List<Media>();
try
{
foreach (var media in medias)
{
mediasList.Add(new Media(media.Element("Path").Value, media.Element("Path").Value));
Console.WriteLine(media.Element("Path"));
}
}
catch { }
return mediasList;
}
示例10: LoadData
void LoadData()
{
System.Collections.ObjectModel.ObservableCollection<string> posts = new System.Collections.ObjectModel.ObservableCollection<string>();
System.Collections.ObjectModel.ObservableCollection<string> companys = new System.Collections.ObjectModel.ObservableCollection<string>();
System.Collections.ObjectModel.ObservableCollection<string> departs = new System.Collections.ObjectModel.ObservableCollection<string>();
for (int i = 0; i < Common.CurrentLoginUserInfo.UserPosts.Count(); i++)
{
posts.Add(Common.CurrentLoginUserInfo.UserPosts[i].PostID);
companys.Add(Common.CurrentLoginUserInfo.UserPosts[i].CompanyID);
departs.Add(Common.CurrentLoginUserInfo.UserPosts[i].DepartmentID);
}
client.GetHouseIssueAndNoticeInfosAsync(Common.CurrentLoginUserInfo.EmployeeID,posts, companys, departs);
//////client.GetHouseIssueAndNoticeInfosToMobileAsync(1,20,6,100,"ddddddddddddddd",SAAS1,SAAS2,SAAS3);
//V_SystemNotice aa = new V_SystemNotice();
//V_SystemNotice bb = new V_SystemNotice();
//client.GetSysNoticeByFormidToMobileAsync("a7b7582c-5cb9-468e-b396-23fd85f1f0f3", SAAS1, SAAS2, SAAS3, "3303d827-e2df-48d6-8c21-8224a589c551", aa, bb);
}
示例11: btnGetUICC_Click
private async void btnGetUICC_Click(object sender, RoutedEventArgs e)
{
try
{
var modem = MobileBroadbandModem.GetDefault();
MobileBroadbandModemConfiguration modemCfg = await modem.GetCurrentConfigurationAsync();
MobileBroadbandUicc uicc = modemCfg.Uicc;
if (uicc != null)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("SIM Card ICCID:" + uicc.SimIccId);
MobileBroadbandUiccAppsResult appsResult = await uicc.GetUiccAppsAsync();
System.Collections.ObjectModel.ObservableCollection<object> AppList = new System.Collections.ObjectModel.ObservableCollection<object>();
foreach (var uiccApp in appsResult.UiccApps)
{
ListBoxItem item = new ListBoxItem();
item.Name = uiccApp.Kind.ToString();
item.Content = uiccApp;
AppList.Add(item);
}
listUiccApps.ItemsSource = AppList;
if (AppList.Count > 0)
{
listUiccApps.SelectedIndex = 0;
}
else
{
sb.AppendLine("No UICC app found.");
}
txtUICCInformation.Text = sb.ToString();
}
}
catch (Exception ex)
{
rootPage.NotifyUser("Error:" + ex.Message, NotifyType.ErrorMessage);
}
}
示例12: CreateGeoForZoom
public static ESRI.ArcGIS.Client.Geometry.Polyline CreateGeoForZoom(ESRI.ArcGIS.Client.Geometry.Geometry mp)
{
ESRI.ArcGIS.Client.Geometry.MapPoint mp1 = new ESRI.ArcGIS.Client.Geometry.MapPoint()
{
X = (mp as ESRI.ArcGIS.Client.Geometry.MapPoint).X + 10000,
Y = (mp as ESRI.ArcGIS.Client.Geometry.MapPoint).Y + 10000
};
ESRI.ArcGIS.Client.Geometry.MapPoint mp2 = new ESRI.ArcGIS.Client.Geometry.MapPoint()
{
X = (mp as ESRI.ArcGIS.Client.Geometry.MapPoint).X - 10000,
Y = (mp as ESRI.ArcGIS.Client.Geometry.MapPoint).Y - 10000
};
System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection> path = new System.Collections.ObjectModel.ObservableCollection<ESRI.ArcGIS.Client.Geometry.PointCollection>();
ESRI.ArcGIS.Client.Geometry.PointCollection plist = new ESRI.ArcGIS.Client.Geometry.PointCollection();
plist.Add(mp2 as ESRI.ArcGIS.Client.Geometry.MapPoint);
plist.Add(mp1);
path.Add(plist);
ESRI.ArcGIS.Client.Geometry.Polyline pl = new ESRI.ArcGIS.Client.Geometry.Polyline
{
Paths = path
};
return pl;
}
示例13: btnExport_Click
private void btnExport_Click(object sender, RoutedEventArgs e)
{
// ispaging = false;
dialog.Filter = "MS csv Files|*.csv";
dialog.FilterIndex = 1;
result = dialog.ShowDialog();
if (result.Value == true)
{
loadbar.Start();
int pageCount = 0;
string filter = "";
System.Collections.ObjectModel.ObservableCollection<object> paras = new System.Collections.ObjectModel.ObservableCollection<object>();
if (sType == "Company")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
if (sType == "Department")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
if (sType == "Post")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
personClient.ExportEmployeesIntimeAsync(dataPager.PageIndex, dataPager.PageSize, "DepartmentName",
filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
}
}
示例14: Save
public void Save()
{
string Result = "";
ComfirmWindow com = new ComfirmWindow();
com.OnSelectionBoxClosed += (objects, result) =>
{
RefreshUI(RefreshedTypes.ShowProgressBar);
System.Collections.ObjectModel.ObservableCollection<T_HR_SALARYITEM> lists = new System.Collections.ObjectModel.ObservableCollection<T_HR_SALARYITEM>();
foreach (var ent in SalaryItemList)
{
lists.Add(ent);
}
client.FormulaTemplateAddAsync(lists);
};
com.SelectionBox(Utility.GetResourceStr("SALARYITEM"), Utility.GetResourceStr("SALARYITEMDESC"), ComfirmWindow.confirmation, Result);
}
示例15: LoadData
void LoadData()
{
loadbar.Start();
int pageCount = 0;
string filter = "";
System.Collections.ObjectModel.ObservableCollection<object> paras = new System.Collections.ObjectModel.ObservableCollection<object>();
if (sType == "Company")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
if (sType == "Department")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
if (sType == "Post")
{
filter += " [email protected]" + paras.Count().ToString();
paras.Add(sValue);
}
//personClient.GetEmployeesIntimeAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME",
// filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
personClient.GetEmployeesIntimeAsync(dataPager.PageIndex, dataPager.PageSize, "DepartmentName",
filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
}