本文整理汇总了C#中Category类的典型用法代码示例。如果您正苦于以下问题:C# Category类的具体用法?C# Category怎么用?C# Category使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Category类属于命名空间,在下文中一共展示了Category类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LocalPlayer
public LocalPlayer(World world, Vector2 position, Category collisionCat, float scale, float limbStrength, float limbDefense, bool evilSkin, Color color, PlayerIndex player)
: base(world, position, collisionCat, scale, limbStrength, limbDefense, evilSkin, color)
{
this.player = player;
punchBtnPressed = punchKeyPressed = false;
kickBtnPressed = kickKeyPressed = false;
shootBtnPressed = shootKeyPressed = false;
trapBtnPressed = trapKeyPressed = false;
usesKeyboard = !GamePad.GetState(player).IsConnected;
lastShootAngle = 0f;
jumpBtn = Buttons.A;
rightBtn = Buttons.LeftThumbstickRight;
leftBtn = Buttons.LeftThumbstickLeft;
crouchBtn = Buttons.LeftTrigger;
punchBtn = Buttons.X;
kickBtn = Buttons.B;
shootBtn = Buttons.RightTrigger;
trapBtn = Buttons.Y;
upKey = Keys.W;
rightKey = Keys.D;
leftKey = Keys.A;
downKey = Keys.S;
trapKey = Keys.T;
}
示例2: GetAllCategories
public Category[] GetAllCategories()
{
List<Category> myCategories = new List<Category>();
SqlConnection myConn = new SqlConnection(connstring);
myConn.Open();
SqlCommand mySqlCommand = new SqlCommand("select * from Category", myConn);
SqlDataReader reader = mySqlCommand.ExecuteReader();
while (reader.Read())
{
Category myCategory = new Category();
object id = reader["Id"];
if (id != null)
{
int categoryId = -1;
if (!int.TryParse(id.ToString(), out categoryId))
{
throw new Exception("Failed to parse Id of video.");
}
myCategory.Id = categoryId;
}
myCategory.Name = reader["Name"].ToString();
myCategories.Add(myCategory);
}
myConn.Close();
return myCategories.ToArray();
}
示例3: DiscoverSubCategories
public override int DiscoverSubCategories(Category parentCategory)
{
string url = ((RssLink)parentCategory).Url;
bool isAZ = !url.Contains("/tv");
if (isAZ)
return SubcatFromAZ((RssLink)parentCategory);
parentCategory.SubCategories = new List<Category>();
string catUrl = ((RssLink)parentCategory).Url + "/kaikki.json?from=0&to=24";
string webData = GetWebData(catUrl, forceUTF8: true);
JToken j = JToken.Parse(webData);
JArray orders = j["filters"]["jarjestys"] as JArray;
parentCategory.SubCategories = new List<Category>();
foreach (JToken order in orders)
{
string orderBy = order.Value<string>("key");
RssLink subcat = new RssLink()
{
Name = orderBy,
Url = ((RssLink)parentCategory).Url + "/kaikki.json?jarjestys=" + orderBy + '&',
ParentCategory = parentCategory,
};
parentCategory.SubCategories.Add(subcat);
}
parentCategory.SubCategoriesDiscovered = true;
return parentCategory.SubCategories.Count;
}
示例4: Should_Apply_DeletedOn_Field_After_Save
public void Should_Apply_DeletedOn_Field_After_Save()
{
// Can be any another entity type.
var entity = new Category();
entity.Name = "test name";
DeleteCreatedEntityAndRunAssertionsInTransaction(
entity,
resultEntity =>
{
Assert.IsTrue(resultEntity.IsDeleted);
Assert.IsNotNullOrEmpty(resultEntity.DeletedByUser);
Assert.AreNotEqual(default(DateTime), resultEntity.DeletedOn);
},
entityBeforeSave =>
{
Assert.IsFalse(entity.IsDeleted);
Assert.IsNullOrEmpty(entityBeforeSave.DeletedByUser);
Assert.AreEqual(default(DateTime?), entityBeforeSave.DeletedOn);
},
entityAfterSave =>
{
Assert.IsTrue(entityAfterSave.IsDeleted);
Assert.IsNotNullOrEmpty(entityAfterSave.DeletedByUser);
Assert.AreNotEqual(default(DateTime), entityAfterSave.DeletedOn);
});
}
示例5: GetCategory
public static List<Category> GetCategory()
{
List<Category> categoryList = new List<Category>();
SqlConnection con = new SqlConnection(GetConnectionString());
string sel = "SELECT Customer_id, first_name, last_name, street, city, state, zip "
+ "FROM Customers ORDER BY Customer_id desc";
SqlCommand cmd = new SqlCommand(sel, con);
con.Open();
SqlDataReader dr =
cmd.ExecuteReader(CommandBehavior.CloseConnection);
Category category;
while (dr.Read())
{
category = new Category();
category.Customer_ID = dr["Customer_ID"].ToString();
category.First_Name = dr["First_Name"].ToString();
category.Last_Name = dr["Last_Name"].ToString();
category.Street = dr["Street"].ToString();
category.City = dr["City"].ToString();
category.State = dr["State"].ToString();
category.Zip = dr["Zip"].ToString();
categoryList.Add(category);
}
dr.Close();
return categoryList;
}
示例6: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
List<VideoInfo> tVideos = new List<VideoInfo>();
string sUrl = (category as RssLink).Url;
string sContent = GetWebData((category as RssLink).Url);
JArray tArray = JArray.Parse(sContent );
foreach (JObject obj in tArray)
{
try
{
VideoInfo vid = new VideoInfo()
{
Thumb = (string)obj["MEDIA"]["IMAGES"]["PETIT"],
Title = (string)obj["INFOS"]["TITRAGE"]["TITRE"],
Description = (string)obj["INFOS"]["DESCRIPTION"],
Length = (string)obj["DURATION"],
VideoUrl = (string)obj["ID"],
StartTime = (string)obj["INFOS"]["DIFFUSION"]["DATE"]
};
tVideos.Add(vid);
}
catch { }
}
return tVideos;
}
示例7: LoadGeneralVideos
/// <summary>
/// Load the videos for the selected category - will only handle general category types
/// </summary>
/// <param name="parentCategory"></param>
/// <returns></returns>
public static List<VideoInfo> LoadGeneralVideos(Category parentCategory)
{
var doc = new XmlDocument();
var result = new List<VideoInfo>();
var path = "/brandLongFormInfo/allEpisodes/longFormEpisodeInfo"; // default the path for items without series
doc.Load(parentCategory.CategoryInformationPage());
if (!string.IsNullOrEmpty(parentCategory.SeriesId()))
{
path = "/brandLongFormInfo/allSeries/longFormSeriesInfo[seriesNumber='" + parentCategory.SeriesId() + "'] /episodes/longFormEpisodeInfo";
}
foreach (XmlNode node in doc.SelectNodes(path))
{
var item = new VideoInfo();
item.Title = node.SelectSingleNodeText("title1") + (string.IsNullOrEmpty(node.SelectSingleNodeText("title2")) ? string.Empty : " - ") + node.SelectSingleNodeText("title2");
item.Description = node.SelectSingleNodeText("synopsis");
//item.ImageUrl = Properties.Resources._4OD_RootUrl + node.SelectSingleNodeText("pictureUrl");
item.Thumb = node.SelectSingleNodeText("pictureUrl");
DateTime airDate;
if (DateTime.TryParse(node.SelectSingleNodeText("txTime"), out airDate))
item.Airdate = airDate.ToString("dd MMM yyyy");
item.Other = doc.SelectSingleNodeText("/brandLongFormInfo/brandWst") + "~" + node.SelectSingleNodeText("requestId");
result.Add(item);
}
return result;
}
示例8: Log
/// <summary>
/// Write a new log entry with the specified category and priority.
/// </summary>
/// <param name="message">Message body to log.</param>
/// <param name="category">Category of the entry.</param>
/// <param name="priority">The priority of the entry.</param>
public void Log(string message, Category category, Priority priority)
{
string messageToLog = String.Format(CultureInfo.InvariantCulture, Resources.DefaultTextLoggerPattern, DateTime.Now,
category.ToString().ToUpper(CultureInfo.InvariantCulture), message, priority.ToString());
writer.WriteLine(messageToLog);
}
示例9: DiscoverDynamicCategories
public override int DiscoverDynamicCategories()
{
Settings.Categories.Clear();
// load homepage
var doc = GetWebData<HtmlDocument>(baseUrl);
var json = JsonFromScriptBlock(doc.DocumentNode, "require('js/page/home')");
// build categories for the themes
Category categoriesCategory = new Category() { HasSubCategories = true, SubCategoriesDiscovered = true, Name = "Themen", SubCategories = new List<Category>() };
foreach (var jCategory in json["categoriesVideos"] as JArray)
{
var categorySubNode = jCategory["category"];
categoriesCategory.SubCategories.Add(new RssLink()
{
ParentCategory = categoriesCategory,
EstimatedVideoCount = jCategory.Value<uint>("total_count"),
Name = categorySubNode.Value<string>("name"),
Description = categorySubNode.Value<string>("description"),
Url = string.Format("{0}/videos?category={1}&page=1&limit=24&sort=newest", baseUrl, categorySubNode.Value<string>("code"))
});
}
if (categoriesCategory.SubCategories.Count > 0) Settings.Categories.Add(categoriesCategory);
// build categories for the shows
Category showsCategory = new Category() { HasSubCategories = true, SubCategoriesDiscovered = true, Name = "Sendungen", SubCategories = new List<Category>() };
foreach (var jCategory in json["clusters"] as JArray)
{
showsCategory.SubCategories.Add(new RssLink()
{
ParentCategory = showsCategory,
Name = jCategory.Value<string>("title"),
Description = jCategory.Value<string>("subtitle"),
Url = string.Format("{0}/videos?cluster={1}&page=1&limit=24&sort=newest", baseUrl, jCategory.Value<string>("id"))
});
}
if (showsCategory.SubCategories.Count > 0) Settings.Categories.Add(showsCategory);
// build categories for the last 7 days
Category dailyCategory = new Category() { HasSubCategories = true, SubCategoriesDiscovered = true, Name = "Letzte 7 Tage", SubCategories = new List<Category>() };
for (int i = 0; i > -7; i--)
{
dailyCategory.SubCategories.Add(new RssLink()
{
ParentCategory = dailyCategory,
Name = DateTime.Today.AddDays(i - 1).ToShortDateString(),
Url = string.Format("{0}/videos?day={1}&page=1&limit=24&sort=newest", baseUrl, i)
});
}
Settings.Categories.Add(dailyCategory);
// build additional categories also found on homepage
Settings.Categories.Add(new RssLink() { Name = "Neueste Videos", Url = string.Format("{0}/videos?page=1&limit=24&sort=newest", baseUrl) });
Settings.Categories.Add(new RssLink() { Name = "Meistgesehen", Url = string.Format("{0}/videos?page=1&limit=24&sort=most_viewed", baseUrl) });
Settings.Categories.Add(new RssLink() { Name = "Letzte Chance", Url = string.Format("{0}/videos?page=1&limit=24&sort=next_expiring", baseUrl) });
Settings.DynamicCategoriesDiscovered = true;
return Settings.Categories.Count;
}
示例10: PhysicsGameEntity
/// <summary>
/// Constructs a FPE Body from the given list of vertices and density
/// </summary>
/// <param name="game"></param>
/// <param name="world"></param>
/// <param name="vertices">The collection of vertices in display units (pixels)</param>
/// <param name="bodyType"></param>
/// <param name="density"></param>
public PhysicsGameEntity(Game game, World world, Category collisionCategory, Vertices vertices, BodyType bodyType, float density)
: this(game,world,collisionCategory)
{
ConstructFromVertices(world,vertices,density);
Body.BodyType = bodyType;
Body.CollisionCategories = collisionCategory;
}
示例11: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
PostAroundServiceClient client = new PostAroundServiceClient();
Category[] arrCategroies = client.GetListCategories();
client.Close();
List<Category> lstCategories = arrCategroies.ToList();
Category firstCategory = new Category();
firstCategory.ID = 0;
firstCategory.Name = "Everything";
firstCategory.Color = "#e3e3e3";
lstCategories.Insert(0, firstCategory);
rptCategoriesColumn1.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated);
rptCategoriesColumn1.DataSource = L10NCategories(lstCategories); //.Take(8);
rptCategoriesColumn1.DataBind();
//rptCategoriesColumn2.ItemCreated += new RepeaterItemEventHandler(rptCategories_ItemCreated);
//rptCategoriesColumn2.DataSource = lstCategories.Skip(8).Take(8);
//rptCategoriesColumn2.DataBind();
}
示例12: CategoryContentDialog
public CategoryContentDialog(Category category)
{
this.InitializeComponent();
_category = category;
txtCategoryName.Text = _category.c_caption;
}
示例13: GetVideos
public override List<VideoInfo> GetVideos(Category category)
{
if (true.Equals(category.Other)) //videos in serwisy informacyjne
{
string sav = videoListRegExFormatString;
videoListRegExFormatString = "{0}";
var res = base.GetVideos(category);
videoListRegExFormatString = sav;
return res;
}
string webData = GetWebData(((RssLink)category).Url);
JObject contentData = JObject.Parse(webData);
if (contentData != null)
{
JArray items = contentData["items"] as JArray;
if (items != null)
{
List<VideoInfo> result = new List<VideoInfo>();
foreach (JToken item in items)
if (!item.Value<bool>("payable") && item.Value<int>("play_mode") == 1)
{
VideoInfo video = new VideoInfo();
video.Title = item.Value<string>("title");
video.VideoUrl = String.Format(videoListRegExFormatString, item.Value<string>("_id"));
video.Description = item.Value<string>("description_root");
video.Thumb = getImageUrl(item);
video.Airdate = item.Value<string>("publication_start_dt") + ' ' + item.Value<string>("publication_start_hour");
result.Add(video);
}
return result;
}
}
return null;
}
示例14: LoadCategories
/// <summary>
/// Request that the categories get loaded - we do this and then populate the LoadedCategories property
/// </summary>
/// <returns></returns>
public List<Category> LoadCategories(Category parentCategory = null)
{
var result = new List<Category>();
if (parentCategory == null)
{
result.Add(new Category { Name = "Catch up", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "C~a27eef2528673410VgnVCM100000255212ac____" });
//result.Add(new Category { Name = "Live TV", SubCategoriesDiscovered = false, HasSubCategories = false, Other = "L~Live_TV" });
result.Add(new Category { Name = "Sky Movies", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "R~7fc1acce88d77410VgnVCM1000000b43150a____" });
result.Add(new Category { Name = "TV Box Sets", SubCategoriesDiscovered = false, HasSubCategories = true, Other = "B~9bb07a0acc5a7410VgnVCM1000000b43150a____" });
}
else
{
switch (parentCategory.Type())
{
case SkyGoCategoryData.CategoryType.CatchUp:
LoadCatchupInformation(parentCategory);
break;
default:
LoadSubCategories(parentCategory, parentCategory.Type() != SkyGoCategoryData.CategoryType.CatchUpSubCategory);
break;
}
}
return result;
}
示例15: All
public JsonResult All(Category? category)
{
if (_highscoreService.IsValidCategory(category))
return Json(_highscoreService.GetHighscores((Category)category),JsonRequestBehavior.AllowGet);
else
return Json(new { success = false },JsonRequestBehavior.AllowGet);
}