本文整理汇总了C#中Properties类的典型用法代码示例。如果您正苦于以下问题:C# Properties类的具体用法?C# Properties怎么用?C# Properties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Properties类属于命名空间,在下文中一共展示了Properties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddOptionPanels
void AddOptionPanels(IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{
Properties newProperties = new Properties();
newProperties.Set("Project", project);
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
descriptors.Add(descriptor);
if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) { // may be null, if it is only a "path"
descriptor.DialogPanel.CustomizationObject = newProperties;
descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Activated);
ICanBeDirty dirtyable = descriptor.DialogPanel as ICanBeDirty;
if (dirtyable != null) {
dirtyable.DirtyChanged += PanelDirtyChanged;
}
TabPage page = new TabPage(descriptor.Label);
page.UseVisualStyleBackColor = true;
page.Controls.Add(descriptor.DialogPanel.Control);
tabControl.TabPages.Add(page);
}
if (descriptor.ChildDialogPanelDescriptors != null) {
AddOptionPanels(descriptor.ChildDialogPanelDescriptors);
}
}
// re-evaluate dirty because option pages can be dirty when they are newly loaded
PanelDirtyChanged(null, null);
}
示例2: ErrorListPad
public ErrorListPad()
{
instance = this;
properties = PropertyService.NestedProperties("ErrorListPad");
TaskService.Cleared += TaskServiceCleared;
TaskService.Added += TaskServiceAdded;
TaskService.Removed += TaskServiceRemoved;
TaskService.InUpdateChanged += delegate {
if (!TaskService.InUpdate)
InternalShowResults();
};
SD.BuildService.BuildFinished += ProjectServiceEndBuild;
SD.ProjectService.SolutionOpened += OnSolutionOpen;
SD.ProjectService.SolutionClosed += OnSolutionClosed;
errors = new ObservableCollection<SDTask>(TaskService.Tasks.Where(t => t.TaskType != TaskType.Comment));
toolBar = ToolBarService.CreateToolBar(contentPanel, this, "/SharpDevelop/Pads/ErrorList/Toolbar");
contentPanel.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
contentPanel.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
contentPanel.Children.Add(toolBar);
contentPanel.Children.Add(errorView);
Grid.SetRow(errorView, 1);
errorView.ItemsSource = errors;
errorView.MouseDoubleClick += ErrorViewMouseDoubleClick;
errorView.Style = (Style)new TaskViewResources()["TaskListView"];
errorView.ContextMenu = MenuService.CreateContextMenu(errorView, DefaultContextMenuAddInTreeEntry);
errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, ExecuteCopy, CanExecuteCopy));
errorView.CommandBindings.Add(new CommandBinding(ApplicationCommands.SelectAll, ExecuteSelectAll, CanExecuteSelectAll));
InternalShowResults();
}
示例3: Init
public void Init()
{
string addinXml = "<AddIn name = 'Xml Editor'\r\n" +
"author = ''\r\n" +
"copyright = 'prj:///doc/copyright.txt'\r\n" +
"description = ''\r\n" +
"addInManagerHidden = 'preinstalled'>\r\n" +
"</AddIn>";
using (StringReader reader = new StringReader(addinXml)) {
var addInTree = MockRepository.GenerateStrictMock<IAddInTree>();
AddIn addin = AddIn.Load(addInTree, reader);
AddInTreeNode addinTreeNode = new AddInTreeNode();
Properties properties1 = new Properties();
properties1.Set<string>("id", ".xml");
properties1.Set<string>("namespaceUri", "http://example.com");
Properties properties2 = new Properties();
properties2.Set<string>("id", ".xsl");
properties2.Set<string>("namespaceUri", "http://example.com/xsl");
properties2.Set<string>("namespacePrefix", "xs");
addinTreeNode.AddCodons(
new Codon[] {
new Codon(addin, "SchemaAssociation", properties1, new ICondition[0]),
new Codon(addin, "SchemaAssociation", properties2, new ICondition[0])
});
schemaAssociations = new DefaultXmlSchemaFileAssociations(addinTreeNode);
}
}
示例4: WolfEntity
public WolfEntity(Rectangle rect, Properties properties, GameScene gs)
{
position.X = rect.X;
position.Y = rect.Y;
spriteChoice.texture = spritesheet;
animState.AnimationName = "alive";
hitbox = new Rectangle (0, 0, rect.Width, rect.Height);
spriteChoice.rect = anim.GetRectangle (animState);
Visible = true;
inverseMass = 5;
health = 10;
contactDamage = 2;
fireDefense = 0;
waterDefense = 0;
earthDefense = 1;
airDefense = 0;
this.properties = properties;
this.gs = gs;
baseline = hitbox.Bottom;
seePlayer = false;
positionPushTimer = new TimeSpan(0,0,0,0,1000);
backtracking = false;
}
示例5: LazyLoadDoozer
public LazyLoadDoozer(AddIn addIn, Properties properties)
{
this.addIn = addIn;
this.name = properties["name"];
this.className = properties["class"];
}
示例6: OperatorHasTest2
public void OperatorHasTest2()
{
var p1 = new Properties();
p1.SetProperty("name", "jack");
var p2 = new Properties();
p2.SetProperty("name", "jill");
p2.SetProperty("count", 3);
var node1 = Node.CreateNode();
var node2 = Node.CreateNode();
var node3 = Node.CreateNode();
var rel1 = node1.CreateRelationshipTo(node2, "like", p1);
var rel2 = node1.CreateRelationshipTo(node3, "like", p2);
var cypher = new Cypher();
cypher.Start(s => s.Relationship("rel", rel1.Id , rel2.Id));
cypher.Where(w => w.RelationshipHas("rel", "count"));
cypher.Return(r => r.Relationship("rel"));
var result = cypher.Execute();
Assert.IsTrue(result.Count() == 1);
Assert.IsTrue(result.First().Field<Relationship>("rel") == rel2);
}
示例7: Create
public static AddInReference Create(Properties properties, string hintPath)
{
AddInReference reference = new AddInReference(properties["addin"]);
string version = properties["version"];
if (version != null && version.Length > 0) {
int pos = version.IndexOf('-');
if (pos > 0) {
reference.minimumVersion = ParseVersion(version.Substring(0, pos), hintPath);
reference.maximumVersion = ParseVersion(version.Substring(pos + 1), hintPath);
} else {
reference.maximumVersion = reference.minimumVersion = ParseVersion(version, hintPath);
}
if (reference.Name == "SharpDevelop") {
// HACK: SD 4.1 AddIns work with SharpDevelop 4.2
// Because some 4.1 AddIns restrict themselves to SD 4.1, we extend the
// supported SD range.
if (reference.maximumVersion == new Version("4.1")) {
reference.maximumVersion = new Version("4.2");
}
}
}
reference.requirePreload = string.Equals(properties["requirePreload"], "true", StringComparison.OrdinalIgnoreCase);
return reference;
}
示例8: SetProperties
private static Properties SetProperties()
{
const string mzTabProperties = "conf/mztab/mztab.properties";
const string formatProperties = "conf/mztab/mztab_format_error.properties";
const string logicalProperties = "conf/mztab/mztab_logical_error.properties";
const string crosscheckProperties = "conf/mztab/mztab_crosscheck_error.properties";
try{
properties = new Properties();
StreamReader reader = new StreamReader(mzTabProperties);
properties.load(reader);
reader.Close();
reader = new StreamReader(formatProperties);
properties.load(reader);
reader.Close();
reader = new StreamReader(logicalProperties);
properties.load(reader);
reader.Close();
reader = new StreamReader(crosscheckProperties);
properties.load(reader);
reader.Close();
return properties;
}
catch (FileNotFoundException e){
Console.Error.WriteLine(e.Message);
}
catch (IOException e){
Console.Error.WriteLine(e.Message);
}
return null;
}
示例9: SetRowProperties
internal void SetRowProperties(DataRow dr, Properties.VideoQualityTypeProperties row)
{
row.ID = Convert.ToByte(dr["ID"]);
row.Description = Convert.ToString(dr["Description"]);
row.Exists = true;
row.HasChanged = false;
}
示例10: SetRowProperties
internal void SetRowProperties(DataRow dr, Properties.AudioLanguagesProperties row)
{
row.ID = Convert.ToInt16(dr["ID"]);
row.Description = Convert.ToString(dr["Description"]);
row.Exists = true;
row.HasChanged = false;
}
示例11: ErrorListPad
public ErrorListPad()
{
instance = this;
properties = PropertyService.Get("ErrorListPad", new Properties());
RedrawContent();
ResourceService.LanguageChanged += delegate { RedrawContent(); };
TaskService.Cleared += new EventHandler(TaskServiceCleared);
TaskService.Added += new TaskEventHandler(TaskServiceAdded);
TaskService.Removed += new TaskEventHandler(TaskServiceRemoved);
TaskService.InUpdateChanged += delegate {
if (!TaskService.InUpdate)
InternalShowResults();
};
ProjectService.BuildFinished += ProjectServiceEndBuild;
ProjectService.SolutionLoaded += OnSolutionOpen;
ProjectService.SolutionClosed += OnSolutionClosed;
taskView.CreateControl();
contentPanel.Controls.Add(taskView);
toolStrip = ToolbarService.CreateToolStrip(this, "/SharpDevelop/Pads/ErrorList/Toolbar");
toolStrip.Stretch = true;
toolStrip.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden;
contentPanel.Controls.Add(toolStrip);
InternalShowResults();
}
示例12: WorldmapSector
public WorldmapSector(string Filename)
{
List WorldMapL = Util.Load(Filename, "supertux-worldmap");
LispIterator iter = new LispIterator(WorldMapL);
while(iter.MoveNext()) {
switch(iter.Key) {
case "properties":
Properties Props = new Properties(iter.List);
Props.Get("name", ref Name);
Props.Get("music", ref Music);
Console.WriteLine("Name: " + Name);
Console.WriteLine("Music: " + Music);
Props.PrintUnusedWarnings();
break;
case "spawnpoint":
WorldmapSpawnPoint SpawnPoint = new WorldmapSpawnPoint();
SpawnPoint.Parse(iter.List);
SpawnPoints.Add(SpawnPoint.Name, SpawnPoint);
break;
default:
GameObject Object = ParseObject(iter.Key, iter.List);
if(Object != null)
AddObject(Object);
break;
}
}
Player = new WorldmapTux(this);
AddObject(Player);
Spawn("default");
}
示例13: Load
public override void Load()
{
Name = "TDSMPlugin Example";
Description = "Plugin Example for TDSM.";
Author = "DeathCradle";
Version = "1";
TDSMBuild = 32; //You put here the release this plugin was made/build for.
plugin = this;
string pluginFolder = Statics.PluginPath + Path.DirectorySeparatorChar + "TDSM";
//Create folder if it doesn't exist
CreateDirectory(pluginFolder);
//setup a new properties file
properties = new Properties(pluginFolder + Path.DirectorySeparatorChar + "tdsmplugin.properties");
properties.Load();
properties.pushData(); //Creates default values if needed. [Out-Dated]
properties.Save();
//read properties data
spawningAllowed = properties.SpawningCancelled;
tileBreakageAllowed = properties.TileBreakage;
explosivesAllowed = properties.ExplosivesAllowed;
}
示例14: ReadSampleBlock
public static List<Properties> ReadSampleBlock(Stream source)
{
BinaryReader sourceReader = new BinaryReader(source);
byte[] sourceData = sourceReader.ReadBytes(0x2000);
int count = 256;
List<Properties> result = new List<Properties>();
// load sample block
using (MemoryStream tempMem = new MemoryStream(sourceData))
{
BinaryReaderEx dataReader = new BinaryReaderEx(tempMem);
for (int i = 0; i < count; i++)
{
Properties props = new Properties();
props.Channel = dataReader.ReadByte();
props.Flag01 = dataReader.ReadByte();
props.Frequency = dataReader.ReadUInt16S();
props.Volume = dataReader.ReadByte();
props.Panning = dataReader.ReadByte();
props.SampleOffset = dataReader.ReadInt24S() * 2;
props.SampleLength = ((dataReader.ReadInt24S() * 2) - props.SampleOffset);
props.Value0C = dataReader.ReadInt16S();
props.Flag0E = dataReader.ReadByte();
props.Flag0F = dataReader.ReadByte();
props.SizeInBlocks = dataReader.ReadInt16S();
result.Add(props);
}
}
return result;
}
示例15: PropertyChangedEventArgs
public PropertyChangedEventArgs(Properties properties, string key, object oldValue, object newValue)
{
this.properties = properties;
this.key = key;
this.oldValue = oldValue;
this.newValue = newValue;
}