本文整理汇总了C#中Catalog类的典型用法代码示例。如果您正苦于以下问题:C# Catalog类的具体用法?C# Catalog怎么用?C# Catalog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Catalog类属于命名空间,在下文中一共展示了Catalog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArtistsDataSource
public ArtistsDataSource (Catalog catalog)
{
Lookup = new List<Tuple<string, Artist[]>> ();
if (catalog != null)
foreach (var group in catalog.Artists.GroupBy (t => (t.SortKey.First ().ToString ().ToUpper ())))
Lookup.Add (Tuple.Create (group.Key, group.OrderBy (t => (t.SortKey)).ToArray ()));
}
示例2: Add_AddTwoIndenticalBooksAndThreeOtherItems
public void Add_AddTwoIndenticalBooksAndThreeOtherItems()
{
string[] testBookContentParams = new string[] { "Intro C#", "S.Nakov", "12763892", "http://www.introprogramming.info" };
IContent testBookContent = new Content(ContentType.Book, testBookContentParams);
ICatalog currentCatalog = new Catalog();
currentCatalog.Add(testBookContent);
currentCatalog.Add(testBookContent);
string[] testMovieContentParams = new string[] { "The Secret", "Drew Heriot, Sean Byrne & others (2006)", "832763834", "http://t.co/dNV4d" };
IContent testMovieContent = new Content(ContentType.Book, testMovieContentParams);
currentCatalog.Add(testMovieContent);
string[] testApplicationContentParams = new string[] { "Firefox v.11.0", "Mozilla", "16148072", "http://www.mozilla.org" };
IContent testApplicationContent = new Content(ContentType.Book, testApplicationContentParams);
currentCatalog.Add(testApplicationContent);
string[] testSongContentParams = new string[] { "One", "Metallica", "8771120", "http://goo.gl/dIkth7gs" };
IContent testSongContent = new Content(ContentType.Book, testSongContentParams);
currentCatalog.Add(testSongContent);
IEnumerable<IContent> currentContent = currentCatalog.GetListContent("One", 10);
int numberOfRenurnedResults = currentContent.Count();
Assert.AreEqual(1, numberOfRenurnedResults);
}
示例3: MainForm
public MainForm()
{
InitializeComponent();
catalog = (Catalog)(new XmlSerializer(typeof(Catalog)).Deserialize(new FileStream("Catalog.xml", FileMode.Open)));
searcher = new CatalogSearcher(catalog);
images = new ImageList();
}
示例4: ExportDialog
public ExportDialog(Catalog catalog, bool searchOn)
: base(Mono.Posix.Catalog.GetString ("Export"), null, DialogFlags.NoSeparator | DialogFlags.Modal)
{
this.catalog = catalog;
this.templates = new Hashtable ();
this.searchOn = searchOn;
Glade.XML gxml = new Glade.XML (null, "dialogexport.glade", "hbox1", null);
gxml.Autoconnect(this);
cancelButton = (Button)this.AddButton (Gtk.Stock.Cancel, 0);
okButton = (Button)this.AddButton (Gtk.Stock.Ok, 1);
cancelButton.Clicked += OnCancelButtonClicked;
okButton.Clicked += OnOkButtonClicked;
VBox vBox = this.VBox;
vBox.Add ((Box)gxml["hbox1"]);
PopulateComboBox ();
if (!searchOn) {
radioButtonSearch.Sensitive = false;
}
radioButtonActive.Label = String.Format (Mono.Posix.Catalog.GetString ("Export the whole {0} catalog"),catalog.ShortDescription);
this.ShowAll();
}
示例5: Can_search_with_filters
public void Can_search_with_filters()
{
Property property = new Property { Id = Guid.NewGuid(), Name = "Property Name", BedroomCount = 3 };
Catalog catalog = new Catalog() { Id = Guid.NewGuid(), Type = "Waterfront", PropertyId = property.Id };
using(var store = NewDocumentStore())
using(var _session = store.OpenSession())
{
_session.Store(property);
_session.Store(catalog);
_session.SaveChanges();
var catalogs = _session.Advanced.DocumentQuery<Catalog>().WhereEquals("Type", "Waterfront").Select(c => c.PropertyId);
var properties = _session.Advanced.DocumentQuery<Property>();
properties.OpenSubclause();
var first = true;
foreach (var guid in catalogs)
{
if (first == false)
properties.OrElse();
properties.WhereEquals("__document_id", guid);
first = false;
}
properties.CloseSubclause();
var refinedProperties = properties.AndAlso().WhereGreaterThanOrEqual("BedroomCount", "2").Select(p => p.Id);
Assert.NotEqual(0, refinedProperties.Count());
}
}
示例6: PriceForSelections
private void PriceForSelections(Catalog.Product p, OptionSelectionList selections)
{
this.IsValid = true;
this.VariantId = string.Empty;
this._ModifierAdjustments = 0;
if (selections == null) return;
if (p == null) return;
// Check for Option Price Modifiers
if (!p.HasOptions()) return;
this._ModifierAdjustments = selections.GetPriceAdjustmentForSelections(p.Options);
this.BasePrice += this._ModifierAdjustments;
// Check for Variant Changes
if (!p.HasVariants()) return;
Variant v = p.Variants.FindBySelectionData(selections, p.Options);
if (v == null)
{
this.IsValid = false;
return;
}
// Assign Variant Attributes to this price data
this.VariantId = v.Bvin;
if (v.Sku.Trim().Length > 0) this.Sku = v.Sku;
if (v.Price >= 0) this.BasePrice = v.Price + this._ModifierAdjustments;
}
示例7: Run
public void Run()
{
Catalog catalog = new Catalog();
foreach(string fileName in Options.InputFiles)
{
Catalog temp = new Catalog();
temp.Load(fileName);
catalog.Append(temp);
}
using (ResourceWriter writer = new ResourceWriter(Options.OutFile))
{
foreach (CatalogEntry entry in catalog)
{
try
{
writer.AddResource(entry.Key, entry.IsTranslated ? entry.GetTranslation(0) : entry.String);
}
catch (Exception e)
{
string message = String.Format("Error adding item {0}", entry.String);
if (!String.IsNullOrEmpty(entry.Context))
message = String.Format("Error adding item {0} in context '{1}'",
entry.String, entry.Context);
throw new Exception(message, e);
}
}
writer.Generate();
}
}
示例8: AddAlbumDialog
public AddAlbumDialog(Catalog catalog)
: base(catalog,
"dialogaddalbum.glade",
Mono.Posix.Catalog.GetString ("Add a new Album"),
"albums")
{
}
示例9: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
//创建数据库文件
ADOX.Catalog catalog = new Catalog();
catalog.Create("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\test.mdb;Jet OLEDB:Engine Type=5");
Debug.WriteLine("DataBase created");
//建表
ADODB.Connection cn = new ADODB.Connection();
cn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\test.mdb", null, null, -1);
catalog.ActiveConnection = cn;
ADOX.Table table = new ADOX.Table();
table.Name = "FirstTable";
ADOX.Column column = new ADOX.Column();
column.ParentCatalog = catalog;
column.Name = "RecordId";
column.Type = DataTypeEnum.adInteger;
column.DefinedSize = 9;
column.Properties["AutoIncrement"].Value = true;
table.Columns.Append(column, DataTypeEnum.adInteger, 9);
table.Keys.Append("FirstTablePrimaryKey", KeyTypeEnum.adKeyPrimary, column, null, null);
table.Columns.Append("CustomerName", DataTypeEnum.adVarWChar, 50);
table.Columns.Append("Age", DataTypeEnum.adInteger, 9);
table.Columns.Append("Birthday", DataTypeEnum.adDate, 0);
catalog.Tables.Append(table);
cn.Close();
}
示例10: Map
public IEnumerable<PFD> Map(List<CropZone> cropZones, List<PFD> isoFields, Dictionary<int, string> keyToIsoId, Catalog setupCatalog)
{
if(cropZones == null)
return null;
int cropZoneIndex = isoFields.Count;
return cropZones.Select(x => Map(x, keyToIsoId, cropZoneIndex++, setupCatalog));
}
示例11: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
// When extending the BrightcovePlayer, we must assign the BrightcoveVideoView before
// entering the superclass. This allows for some stock video player lifecycle
// management.
SetContentView(Resource.layout.ima_activity_main);
brightcoveVideoView = FindViewById<BrightcoveVideoView>(Resource.id.brightcove_video_view);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final com.brightcove.player.mediacontroller.BrightcoveMediaController mediaController = new com.brightcove.player.mediacontroller.BrightcoveMediaController(brightcoveVideoView);
BrightcoveMediaController mediaController = new BrightcoveMediaController(brightcoveVideoView);
// Add "Ad Markers" where the Ads Manager says ads will appear.
mediaController.AddListener(GoogleIMAEventType.ADS_MANAGER_LOADED, new EventListenerAnonymousInnerClassHelper(this, mediaController));
brightcoveVideoView.MediaController = mediaController;
base.onCreate(savedInstanceState);
eventEmitter = brightcoveVideoView.EventEmitter;
// Use a procedural abstraction to setup the Google IMA SDK via the plugin.
setupGoogleIMA();
IDictionary<string, string> options = new Dictionary<string, string>();
IList<string> values = new List<string>(Arrays.asList(VideoFields.DEFAULT_FIELDS));
values.Remove(VideoFields.HLS_URL);
options["video_fields"] = StringUtil.join(values, ",");
BrightcoveSDK.Player.Media.Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A..");
catalog.findVideoByReferenceID("shark", new VideoListenerAnonymousInnerClassHelper(this));
}
示例12: ParsingTest
public void ParsingTest()
{
Catalog cat = new Catalog();
cat.Load("./Data/Test01.po");
Assert.AreEqual(6, cat.Count, "Entries count");
Assert.AreEqual(3, cat.PluralFormsCount, "Plurals entries count");
int nonTranslatedCount = 0;
int ctx = 0;
foreach(CatalogEntry entry in cat)
{
if (!entry.IsTranslated)
nonTranslatedCount++;
if (entry.HasPlural)
{
Assert.AreEqual("{0} ошибка найдена", entry.GetTranslation(0));
Assert.AreEqual("{0} ошибки найдены", entry.GetTranslation(1));
Assert.AreEqual("{0} ошибок найдено", entry.GetTranslation(2));
}
if (entry.HasContext)
ctx++;
}
Assert.AreEqual(1, nonTranslatedCount, "Non translated strings count");
Assert.AreEqual(2, ctx, "Contextes count");
}
示例13: SendResponse
static async Task SendResponse (Catalog catalog, HttpListenerContext context, CancellationToken token)
{
try {
string request;
if (string.IsNullOrEmpty (context.Request.Url.Query))
request = await DeserializeRequest (context.Request).ConfigureAwait (false);
else {
request = System.Uri.UnescapeDataString (context.Request.Url.Query.Substring (1));
}
long? rangeStart =null;
long? rangeEnd = null;
if (!string.IsNullOrEmpty (context.Request.Headers ["Range"])) {
var part = context.Request.Headers ["Range"].Substring ("bytes=".Length);
rangeStart = long.Parse (part.Split ('-') [0]);
rangeEnd = long.Parse (part.Split ('-') [1]);
if (rangeEnd <= 0)
rangeEnd = null;
}
using (var responseStream = HandleRequest (request, catalog, rangeStart, rangeEnd)) {
context.Response.ContentLength64 = responseStream.Length - responseStream.Position;
context.Response.StatusCode = (int)HttpStatusCode.OK;
await responseStream.CopyToAsync (context.Response.OutputStream, 4096, token).ConfigureAwait (false);
}
} catch {
context.Response.Abort ();
throw;
}
}
示例14: LoadCatalog
public void LoadCatalog()
{
using (FileStream fs = new FileStream("Catalog.xml", FileMode.Open))
{
_catalog = (Catalog)(new XmlSerializer(typeof(Catalog)).Deserialize(fs));
}
}
示例15: Add_DuplicateAndNonDuplicateItems
public void Add_DuplicateAndNonDuplicateItems()
{
ICatalog catalog = new Catalog();
for (int i = 0; i < 10; ++i)
{
catalog.Add(new Content(ContentType.Book, new string[]
{
"TestTitle", "TestAuthor", "432943", @"http://www.testingcatalog.com/"
}));
}
catalog.Add(new Content(ContentType.Application, new string[]
{
"TestTitle", "TestAppAuthor", "111", @"http://www.testingappcatalog.com/"
}));
catalog.Add(new Content(ContentType.Movie, new string[]
{
"TestTitle", "TestMoveAuthor", "22", @"http://www.testingmoviecatalog.com/"
}));
catalog.Add(new Content(ContentType.Music, new string[]
{
"TestTitle", "TestMusicAuthor", "3333", @"http://www.testingmusiccatalog.com/"
}));
IEnumerable<IContent> foundContent = catalog.GetListContent("TestTitle", 100);
int numberOfItemsFound = this.CountContentFound(foundContent);
Assert.AreEqual(13, numberOfItemsFound);
}