本文整理汇总了C#中Feed类的典型用法代码示例。如果您正苦于以下问题:C# Feed类的具体用法?C# Feed怎么用?C# Feed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Feed类属于命名空间,在下文中一共展示了Feed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateFeedTile
public static void UpdateFeedTile(Feed feed)
{
// タイルが存在しない場合は何もしない
if (!SecondaryTile.Exists(feed.Id))
{
return;
}
// フィード内に記事が無い場合は何もしない
if (!feed.FeedItems.Any())
{
return;
}
// 大きなテキスト1つと折り返し3行表示されるテキストを持つテンプレートを取得
var template = TileUpdateManager.GetTemplateContent(
TileTemplateType.TileSquareText02);
// textタグに表示内容を設定
var texts = template.GetElementsByTagName("text");
texts[0].InnerText = feed.Title;
texts[1].InnerText = feed.FeedItems.First().Title;
// タイルを更新するオブジェクトを取得
var updater = TileUpdateManager.CreateTileUpdaterForSecondaryTile(feed.Id);
// 有効期間5分の通知を設定
updater.Update(new TileNotification(template)
{
ExpirationTime = DateTimeOffset.Now.AddMinutes(5)
});
}
示例2: GDataResultAggregator
public GDataResultAggregator(string playlistURL)
{
YouTubeRequestSettings settings = new YouTubeRequestSettings(APPNAME, CLIENTID, DEVELKEY);
YouTubeRequest request = new YouTubeRequest(settings);
_videoFeed = request.Get<Video>(new Uri(playlistURL));
}
示例3: btnUpdate_Click
protected void btnUpdate_Click(object sender, EventArgs e)
{
FeedRepository rfeed = new FeedRepository();
Utility Util = new Utility();
Feed feed = new Feed();
feed.Author = Author.Value;
feed.Title = title.Value;
feed.Summary = Summary.Value;
feed.Description = Description.Value;
feed.Link = Link.Value;
feed.CategoryID = Int16.Parse(CategoryName.SelectedValue);
feed.FeedID = Int32.Parse(FeedID.Value);
feed.isValid = Int16.Parse(FeedState.SelectedValue);
feed.DisplayIn = "";
for (int i = 0; i < CheckBoxDisplayIn.Items.Count; i++)
{
if (CheckBoxDisplayIn.Items[i].Selected)
{
if (feed.DisplayIn.Length > 0)
feed.DisplayIn += ",";
feed.DisplayIn += CheckBoxDisplayIn.Items[i].Value;
}
}
if (feed.DisplayIn.Length == 0)
feed.DisplayIn = "-1";
rfeed.Update(feed);
feed = null;
Util = null;
rfeed = null;
}
示例4: Obter_Quando_UrlValidaLocal_Deve_RetornarFeed
public void Obter_Quando_UrlValidaLocal_Deve_RetornarFeed()
{
var feed = new Feed();
var result = feed.Obter(@"C:\Users\LaurenceM\Trabalho\teste\MinutoSeguros\MinutoSeguros.UI\" + Parametro.UrlFeedLocal);
Assert.IsNotNull(result);
}
示例5: Get
public IEnumerable<Activity> Get(Feed feed, Paging paging)
{
SortedSet<Activity> activities = new SortedSet<Activity>(Activity.Comparer);
foreach (var streamId in feed.Streams)
{
var streamIdQuery = Convert.ToBase64String(streamId);
var prepared = session
.Prepare(LoadActivityStreamQueryTemplate)
.Bind(streamIdQuery, paging.Timestamp)
.SetAutoPage(false)
.SetPageSize(paging.Take);
var rowSet = session.Execute(prepared);
foreach (var row in rowSet.GetRows())
{
using (var stream = new MemoryStream(row.GetValue<byte[]>("data")))
{
var storedActivity = (Activity)serializer.Deserialize(stream);
activities.Add(storedActivity);
}
}
}
return activities.Take(paging.Take);
}
示例6: saveBtn_Click
private void saveBtn_Click(object sender, EventArgs e)
{
feed = new Feed(this.feedTitle.Text, this.feedDesc.Text, this.feedUrl.Text);
//feed = new Feed();
feed.mTitle = this.feedTitle.Text;
// Save feed to xml
//feed.Save();
// Add the feed to the correct channel
foreach (Channel c in channels)
{
if (c.mTitle == selected.Text)
{
c._Add(feed);
}
}
// Add feed to current channel
selected.Nodes.Add(feed.mTitle);
// !!!!! use user-defined number of articles to display/refresh at a time. 10 is arbitrary number !!!!!
feed.refresh(10);
this.Close();
}
示例7: ReadArticles
public void ReadArticles()
{
var feedXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<feed xmlns=\"http://www.w3.org/2005/Atom\">" +
" <title>Example Feed</title>" +
" <link href=\"http://example.org/\"/>" +
" <updated>2003-12-13T18:30:02Z</updated>" +
" <author>" +
" <name>John Doe</name>" +
" </author>" +
" <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>" +
" <entry>" +
" <title>Atom-Powered Robots Run Amok</title>" +
" <link href=\"http://example.org/2003/12/13/atom03\"/>" +
" <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>" +
" <published>2003-12-13T18:30:02Z</published>" +
" <updated>2004-01-13T18:30:02Z</updated>" +
" <summary>Some text.</summary>" +
" </entry>" +
"</feed>";
var feed = new Feed();
_target.Read(feed, XDocument.Parse(feedXml));
Assert.That(feed.GetHeadChunk(null).Articles.Count, Is.EqualTo(1));
var art = feed.GetHeadChunk(null).Articles.First();
Assert.That(art.Title, Is.EqualTo("Atom-Powered Robots Run Amok"));
Assert.That(art.Link, Is.EqualTo(new Uri("http://example.org/2003/12/13/atom03")));
Assert.That(art.PublishDate, Is.EqualTo(new DateTime(2003, 12, 13, 18, 30, 2)));
Assert.That(art.Summary, Is.EqualTo("Some text."));
Assert.That(art.UniqueId, Is.EqualTo("urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"));
}
示例8: DoWork
public void DoWork(IRequest request)
{
NorthwindConfig config = new NorthwindConfig();
config.CurrencyCode = "EUR";
config.CrmUser = "Sdata";
config.Path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Northwind");
string fileName = Path.Combine(config.Path, "Northwind.mdb");
FileInfo fileInfo = new FileInfo(fileName);
string link = _requestContext.ContractLink + "-";
DatasetFeedEntry entry = new DatasetFeedEntry();
entry.Id = link;
entry.Title = fileInfo.Name;
entry.Published = fileInfo.CreationTime;
entry.Updated = fileInfo.LastAccessTime;
entry.Link = link;
Feed<DatasetFeedEntry> feed = new Feed<DatasetFeedEntry>();
feed.Id = "Available Datasets";
feed.Title = "Available Datasets";
feed.Entries.Add(entry);
request.Response.Feed = feed;
}
示例9: Load
/// <summary>
/// FanIn
/// </summary>
public IEnumerable<Activity> Load(Feed feed)
{
var snapshot = new Dictionary<byte[], Queue<Activity>>(activityStreamStore.Count);
foreach (var item in activityStreamStore)
{
snapshot.Add(item.Key, new Queue<Activity>(item.Value));
}
SortedSet<Activity> buffer = new SortedSet<Activity>(Activity.Comparer);
var streams = feed.FeedStreams.ToList();
var streamsCount = streams.Count;
// Init
for (int streamIndexInsideSubsciption = 0; streamIndexInsideSubsciption < streamsCount; streamIndexInsideSubsciption++)
{
var streamId = streams[streamIndexInsideSubsciption];
var activity = snapshot[streamId].Dequeue();
buffer.Add(activity);
}
while (buffer.Count > 0)
{
Activity nextActivity = buffer.FirstOrDefault();
buffer.Remove(nextActivity);
var streamQueue = snapshot[nextActivity.StreamId];
if (streamQueue.Count > 0)
{
var candidate = snapshot[nextActivity.StreamId].Dequeue();
buffer.Add(candidate);
}
yield return nextActivity;
}
}
示例10: UserFeed
public UserFeed(Feed feed)
{
Name = feed.Name;
Href = feed.Href;
BaseUrl = feed.BaseUrl;
Category = feed.Category;
}
示例11: CreateTileIfNotExist
public static async Task<bool> CreateTileIfNotExist(Feed feed)
{
// 既にタイルが存在する場合は何もしない
if (SecondaryTile.Exists(feed.Id))
{
return false;
}
// セカンダリタイルを作成
var tile = new SecondaryTile(
// タイルのId
feed.Id,
// タイルの短い名前
feed.Title,
// タイルの表示名
feed.Title,
// タイルからアプリケーションを起動したときに渡される引数
feed.Id,
// タイルの名前の表示方法を指定
TileOptions.ShowNameOnLogo,
// タイルのロゴを指定
new Uri("ms-appx:///Assets/Logo.png"));
// ユーザーにタイルの作成をリクエスト
return await tile.RequestCreateAsync();
}
示例12: TestAddAccessPoints
public void TestAddAccessPoints()
{
var capabilityList = CapabilityListTest.CreateTestCapabilityList();
var feed1 = new Feed {Name = "Test", CapabilityLists = {capabilityList}};
var feed2 = new Feed {Name = "Test", CapabilityLists = {capabilityList}};
using (var applyFlag1 = new TemporaryFlagFile("0install-unit-tests"))
using (var applyFlag2 = new TemporaryFlagFile("0install-unit-tests"))
{
var accessPoints1 = new AccessPoint[] {new MockAccessPoint {ID = "id1", Capability = "my_ext1", ApplyFlagPath = applyFlag1}};
var accessPoints2 = new AccessPoint[] {new MockAccessPoint {ID = "id2", Capability = "my_ext2", ApplyFlagPath = applyFlag2}};
Assert.AreEqual(0, _integrationManager.AppList.Entries.Count);
var appEntry1 = _integrationManager.AddApp(new FeedTarget(FeedTest.Test1Uri, feed1));
_integrationManager.AddAccessPoints(appEntry1, feed1, accessPoints1);
Assert.AreEqual(1, _integrationManager.AppList.Entries.Count, "Should implicitly create missing AppEntries");
Assert.IsTrue(applyFlag1.Set, "Should apply AccessPoint");
applyFlag1.Set = false;
Assert.DoesNotThrow(() => _integrationManager.AddAccessPoints(appEntry1, feed1, accessPoints1), "Duplicate access points should be silently reapplied");
Assert.IsTrue(applyFlag1.Set, "Duplicate access points should be silently reapplied");
_integrationManager.AddAccessPoints(appEntry1, feed1, accessPoints2);
applyFlag2.Set = false;
var appEntry2 = _integrationManager.AddApp(new FeedTarget(FeedTest.Test2Uri, feed2));
Assert.Throws<ConflictException>(() => _integrationManager.AddAccessPoints(appEntry2, feed2, accessPoints2), "Should prevent access point conflicts");
Assert.IsFalse(applyFlag2.Set, "Should prevent access point conflicts");
}
}
示例13: ClearFeeds
// 每日清除过期feed
public virtual void ClearFeeds()
{
DateTime lastClearTime = config.Instance.Site.LastFeedClearTime;
if (cvt.IsDayEqual( lastClearTime, DateTime.Now )) return;
Feed feed = new Feed();
EntityInfo ei = Entity.GetInfo( feed );
String table = ei.TableName;
// TODO 支持其他数据库类型,
// 清除所有30天前的feed
int dayCount = config.Instance.Site.FeedKeepDay;
String sql = "";
DatabaseType dbtype = ei.DbType;
if (dbtype == DatabaseType.SqlServer)
sql = "delete from " + table + " where datediff(day, created, getdate())>" + dayCount;
else if (dbtype == DatabaseType.Access)
sql = "delete from " + table + " where datediff('d', created, now())>" + dayCount;
else if( dbtype == DatabaseType.MySql)
sql = "delete from " + table + " where datediff(created, now())>" + dayCount;
else
throw new NotImplementedException( "not implemented database function : datediff" );
db.RunSql<Feed>( sql );
config.Instance.Site.Update( "LastFeedClearTime", DateTime.Now );
}
示例14: AddFeed
public static void AddFeed(Feed post)
{
string action = string.Empty;
if (post is FeedNews)
{
action = NewsResource.UserActivity_AddNewsFeed;
}
else if (post is FeedPoll)
{
action = NewsResource.UserActivity_AddPollFeed;
}
if (!string.IsNullOrEmpty(action))
{
UserActivity ua = ApplyCustomeActivityParams(
post,
ComposeActivityByFeed(post),
action,
new Guid(post.Creator),
UserActivityConstants.ContentActionType,
UserActivityConstants.NormalContent
);
ua.HtmlPreview = post.Text;
PublishInternal(ua);
}
}
示例15: VisibleFor
public override bool VisibleFor(Feed feed, object data, Guid userId)
{
if (!WebItemSecurity.IsAvailableForUser(ProductID.ToString(), userId)) return false;
var file = (FileEntry)data;
bool targetCond;
if (feed.Target != null)
{
if (!string.IsNullOrEmpty(file.SharedToMeBy) && file.SharedToMeBy == userId.ToString()) return false;
var owner = new Guid((string)feed.Target);
var groupUsers = CoreContext.UserManager.GetUsersByGroup(owner).Select(x => x.ID).ToList();
if (!groupUsers.Any())
{
groupUsers.Add(owner);
}
targetCond = groupUsers.Contains(userId);
}
else
{
targetCond = true;
}
return targetCond &&
new FileSecurity(new DaoFactory()).CanRead(file, userId);
}