本文整理汇总了C#中ICatalog类的典型用法代码示例。如果您正苦于以下问题:C# ICatalog类的具体用法?C# ICatalog怎么用?C# ICatalog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICatalog类属于命名空间,在下文中一共展示了ICatalog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FormatLink
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
{
string link;
if (type.Equals("vehicle"))
{
link = String.Format("Vehicle.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd);
}
else
{
t_row row = dataItem as t_row;
if (row == null)
{
throw new ArgumentException(String.Format("Expected type 't_row'. Actual type is '{0}'.",
dataItem.GetType()));
}
link = String.Format("QuickDetails.aspx?c={0}&gid={1}&vid={2}&ssd={3}", catalog.Code,
row.quickgroupid, catalog.VehicleId, catalog.Ssd);
}
if (ItemId > 0)
{
link += string.Format("&ItemId={0}", ItemId);
}
return link;
}
示例2: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder consoleOutput)
{
switch (command.Type)
{
case CommandType.AddBook:
this.AddBook(catalog, command, consoleOutput);
break;
case CommandType.AddMovie:
this.AddMovie(catalog, command, consoleOutput);
break;
case CommandType.AddSong:
this.AddSong(catalog, command, consoleOutput);
break;
case CommandType.AddApplication:
this.AddAplication(catalog, command, consoleOutput);
break;
case CommandType.Update:
this.Update(catalog, command, consoleOutput);
break;
case CommandType.Find:
this.Find(catalog, command, consoleOutput);
break;
default:
{
throw new InvalidCastException("Unknown command!");
}
}
}
示例3: FormatLink
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
{
ListUnitsRow unit = dataItem as ListUnitsRow;
if (unit == null)
{
throw new ArgumentException(String.Format("Expected type 'ListUnitsRow'. Actual type is '{0}'.", renderer.GetType()));
}
string link;
if (type.Equals("filter"))
{
link = String.Format("UnitFilter.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}&f={6}",
catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd,
catalog.PathId, HttpUtility.UrlEncode(unit.filter));
}
else
{
link = String.Format("Unit.aspx?c={0}&vid={1}&uid={2}&cid={3}&ssd={4}&path_id={5}",
catalog.Code, catalog.VehicleId, unit.unitid, catalog.CategoryId, unit.ssd,
catalog.PathId);
}
if (ItemId > 0)
{
link += string.Format("&ItemId={0}", ItemId);
}
return link;
}
示例4: FileWatchScanner
//========================================================================================
// Constructor
//========================================================================================
/// <summary>
/// Initialize a new instance of this scaner with the specified iTunes interface.
/// </summary>
/// <param name="itunes"></param>
/// <param name="catalog"></param>
public FileWatchScanner(Controller controller, ICatalog catalog, FileWatchAction action)
: base(Resx.I_ScanFileWatch, controller, catalog)
{
base.description = Resx.ScanFileWatch;
this.action = action;
}
示例5: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand cmd, StringBuilder sb)
{
switch (cmd.Type)
{
case CommandType.AddBook:
catalog.Add(new ContentItem(ContentItemType.Book, cmd.Parameters));
sb.AppendLine("Book added");
break;
case CommandType.AddMovie:
catalog.Add(new ContentItem(ContentItemType.Movie, cmd.Parameters));
sb.AppendLine("Movie added");
break;
case CommandType.AddSong:
catalog.Add(new ContentItem(ContentItemType.Song, cmd.Parameters));
sb.AppendLine("Song added");
break;
case CommandType.AddApplication:
catalog.Add(new ContentItem(ContentItemType.Application, cmd.Parameters));
sb.AppendLine("Application added");
break;
case CommandType.Update:
if (cmd.Parameters.Length != 2)
{
throw new FormatException("Format exception");
}
var updatedItems = catalog.UpdateContent(cmd.Parameters[0], cmd.Parameters[1]);
sb.AppendLine(String.Format("{0} items updated", updatedItems));
break;
case CommandType.Find:
{
if (cmd.Parameters.Length != 2)
{
Console.WriteLine("Invalid params!");
throw new Exception("Invalid number of parameters!");
}
int numberOfElementsToList = int.Parse(cmd.Parameters[1]);
IEnumerable<IContent> foundContent = catalog.GetListContent(cmd.Parameters[0], numberOfElementsToList);
if (foundContent.Count() == 0)
{
sb.AppendLine("No items found");
}
else
{
foreach (IContent content in foundContent)
{
sb.AppendLine(content.TextRepresentation);
}
}
}
break;
default:
{
throw new InvalidCastException("Unknown command!");
}
}
}
示例6: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output)
{
switch (command.Type)
{
case CommandTypes.AddBook:
AddBookCommand(catalog, command, output);
break;
case CommandTypes.AddMovie:
AddMovieCommand(catalog, command, output);
break;
case CommandTypes.AddSong:
AddSongCommand(catalog, command, output);
break;
case CommandTypes.AddApplication:
AddApplicationCommand(catalog, command, output);
break;
case CommandTypes.Update:
IsValidParameters(command);
UpdateCommand(catalog, command, output);
break;
case CommandTypes.Find:
IsValidParameters(command);
FindCommand(catalog, command, output);
break;
default:
throw new ArgumentException("Unknown command: " + command.Type.ToString());
}
}
示例7: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output)
{
switch (command.Type)
{
case CommandType.AddBook:
var book = new ContentItem(ContentItemType.Book, command.Parameters);
catalog.Add(book);
output.AppendLine("Book Added");
break;
case CommandType.AddMovie:
var movie = new ContentItem(ContentItemType.Movie, command.Parameters);
catalog.Add(movie);
output.AppendLine("Movie added");
break;
case CommandType.AddSong:
var song = new ContentItem(ContentItemType.Song, command.Parameters);
catalog.Add(song);
output.AppendLine("Song added");
break;
case CommandType.AddApplication:
var application = new ContentItem(ContentItemType.Application, command.Parameters);
catalog.Add(application);
output.AppendLine("Application added");
break;
case CommandType.Update:
ProcessUpdateCommand(catalog, command, output);
break;
case CommandType.Find:
ProcessFindCommand(catalog, command, output);
break;
default:
throw new InvalidOperationException("Unknown command!");
}
}
示例8: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder sb)
{
switch (command.Type)
{
case Commands.AddBook:
catalog.Add(new CatalogContent(ContentTypes.Book, command.Parameters));
sb.AppendLine("Book added");
break;
case Commands.AddMovie:
catalog.Add(new CatalogContent(ContentTypes.Movie, command.Parameters));
sb.AppendLine("Movie added");
break;
case Commands.AddSong:
catalog.Add(new CatalogContent(ContentTypes.Song, command.Parameters));
sb.AppendLine("Song added");
break;
case Commands.AddApplication:
catalog.Add(new CatalogContent(ContentTypes.Application, command.Parameters));
sb.AppendLine("Application added");
break;
case Commands.Update:
UpdateCommand(catalog, command, sb);
break;
case Commands.Find:
FindCommand(command, catalog, sb);
break;
default:
throw new InvalidOperationException("Unknown command!");
}
}
示例9: ProcessFindCommand
private static void ProcessFindCommand(ICatalog contentCatalog,
ICommand command, StringBuilder output)
{
if (command.Parameters.Length != 2)
{
throw new ArgumentException("Invalid number of parameters!");
}
int numberOfElementsToList = Int32.Parse(command.Parameters[1]);
IEnumerable<IContent> foundContent =
contentCatalog.GetListContent(command.Parameters[0], numberOfElementsToList);
if (foundContent.Count() == 0)
{
output.AppendLine("No items found");
}
else
{
foreach (IContent content in foundContent)
{
output.AppendLine(content.TextRepresentation);
}
}
}
示例10: EmptyScanner
/// <summary>
/// Initialize a new instance of this scanner.
/// </summary>
/// <param name="itunes"></param>
public EmptyScanner(Controller controller, ICatalog catalog)
: base(Resx.I_ScanEmptyDirectories, controller, catalog)
{
base.description = Resx.ScanEmpty;
this.count = 0;
}
示例11: ExecuteCommand
public void ExecuteCommand(ICatalog contentCatalog, ICommand command, StringBuilder output)
{
switch (command.Type)
{
case CommandType.AddBook:
this.Add(ContentType.Book, command, contentCatalog, output);
break;
case CommandType.AddMovie:
this.Add(ContentType.Movie, command, contentCatalog, output);
break;
case CommandType.AddSong:
this.Add(ContentType.Song, command, contentCatalog, output);
break;
case CommandType.AddApplication:
this.Add(ContentType.Application, command, contentCatalog, output);
break;
case CommandType.Update:
this.Update(command, contentCatalog, output);
break;
case CommandType.Find:
this.Find(command, contentCatalog, output);
break;
default:
throw new ArgumentException("Unknown command!");
}
}
示例12: ExecuteCommand
public void ExecuteCommand(ICatalog catalog, ICommand command, StringBuilder output)
{
switch (command.Type)
{
case CommandType.AddBook:
ProcessAddCommand(catalog, ContentType.Book, command.Parameters, output);
break;
case CommandType.AddMovie:
ProcessAddCommand(catalog, ContentType.Movie, command.Parameters, output);
break;
case CommandType.AddSong:
ProcessAddCommand(catalog, ContentType.Song, command.Parameters, output);
break;
case CommandType.AddApplication:
ProcessAddCommand(catalog, ContentType.Application, command.Parameters, output);
break;
case CommandType.Update:
ProcessUpdateCommand(catalog, command, output);
break;
case CommandType.Find:
ProcessFindCommand(catalog, command, output);
break;
default:
throw new InvalidOperationException("Unknown command!");
}
}
示例13: FormatLink
public override string FormatLink(string type, object dataItem, ICatalog catalog, GuayaquilTemplate renderer)
{
string link;
if (type.Equals("quickgroup"))
{
link = String.Format("QuickGroups.aspx?c={0}&vid={1}&ssd={2}", catalog.Code, catalog.VehicleId, catalog.Ssd);
}
else
{
ListCategoriesRow category = dataItem as ListCategoriesRow;
if (category == null)
{
throw new ArgumentException(String.Format("Expected type 'ListCategoriesRow'. Actual type is '{0}'.", renderer.GetType()));
}
link = String.Format("Vehicle.aspx?c={0}&vid={1}&cid={2}&ssd={3}", catalog.Code, catalog.VehicleId,
category.categoryid,
catalog.Ssd);
}
if (ItemId > 0)
{
link += string.Format("&ItemId={0}", ItemId);
}
return link;
}
示例14: MaintenanceScanner
//========================================================================================
// Constructor
//========================================================================================
/// <summary>
/// Initialize a new instance of this scaner with the specified iTunes interface.
/// </summary>
/// <param name="itunes"></param>
/// <param name="catalog"></param>
public MaintenanceScanner(
Controller controller, ICatalog catalog, MaintenanceAction action)
: base(Resx.I_ScanMaintenance, controller, catalog)
{
base.description = Resx.ScanMaintenance;
this.action = action;
}
示例15: ScannerBase
/// <summary>
///
/// </summary>
/// <param name="controller"></param>
/// <param name="catalog"></param>
public ScannerBase(string name, Controller controller, ICatalog catalog)
{
this.name = name;
this.controller = controller;
this.catalog = catalog;
this.progressPercentage = 0;
this.completedAction = null;
}