当前位置: 首页>>代码示例>>C#>>正文


C# PropertyBag类代码示例

本文整理汇总了C#中PropertyBag的典型用法代码示例。如果您正苦于以下问题:C# PropertyBag类的具体用法?C# PropertyBag怎么用?C# PropertyBag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PropertyBag类属于命名空间,在下文中一共展示了PropertyBag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResetElement

        protected void ResetElement(PropertyBag bag, XmlElement parent)
        {
            foreach (XmlElement element in parent.ChildNodes)
            {
                XmlAttribute attri = element.Attributes["ID"];
                if (attri == null) continue;

                PropertySpec item = FindElement(bag, attri.Value);
                if (item == null) continue;

                int value = 0;

                attri = element.Attributes["Subscribe"];
                if (attri != null) value += Int32.Parse(attri.Value);

                attri = element.Attributes["UnSubscribe"];
                if (attri != null) value += Int32.Parse(attri.Value);

                attri = element.Attributes["Other"];
                if (attri != null) value += Int32.Parse(attri.Value);

                item.Value = value;
            }

            PropertyGrid.SelectedObject = bag;
        }
开发者ID:shilinxu,项目名称:honglt-myproject,代码行数:26,代码来源:frmProvision.cs

示例2: WritePropertyValueToXml

        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="propertyBag">The property bag.</param>
        /// <param name="isUpdateOperation">Indicates whether the context is an update operation.</param>
        internal override void WritePropertyValueToXml(
            EwsServiceXmlWriter writer,
            PropertyBag propertyBag,
            bool isUpdateOperation)
        {
            object value = propertyBag[this];

            if (value != null)
            {
                if (writer.Service.RequestedServerVersion == ExchangeVersion.Exchange2007_SP1)
                {
                    ExchangeService service = writer.Service as ExchangeService;
                    if (service != null && service.Exchange2007CompatibilityMode == false)
                    {
                        MeetingTimeZone meetingTimeZone = new MeetingTimeZone((TimeZoneInfo)value);
                        meetingTimeZone.WriteToXml(writer, XmlElementNames.MeetingTimeZone);
                    }
                }
                else
                {
                    base.WritePropertyValueToXml(
                        writer,
                        propertyBag,
                        isUpdateOperation);
                }
            }
        }
开发者ID:Pravinmprajapati,项目名称:ews-managed-api,代码行数:33,代码来源:StartTimeZonePropertyDefinition.cs

示例3: Process

		public void Process(Crawler crawler, PropertyBag propertyBag)
		{
			if (propertyBag.StatusCode != HttpStatusCode.OK)
			{
				return;
			}

			string extension = MapContentTypeToExtension(propertyBag.ContentType);
			if (extension.IsNullOrEmpty())
			{
				return;
			}

			propertyBag.Title = propertyBag.Step.Uri.PathAndQuery;
			using (TempFile temp = new TempFile())
			{
				temp.FileName += "." + extension;
				using (FileStream fs = new FileStream(temp.FileName, FileMode.Create, FileAccess.Write, FileShare.Read, 0x1000))
				using (Stream input = propertyBag.GetResponse())
				{
					input.CopyToStream(fs);
				}

				using (FilterReader filterReader = new FilterReader(temp.FileName))
				{
					string content = filterReader.ReadToEnd();
					propertyBag.Text = content.Trim();
				}
			}
		}
开发者ID:senzacionale,项目名称:ncrawler,代码行数:30,代码来源:IFilterProcessor.cs

示例4: Process

		public void Process(Crawler crawler, PropertyBag propertyBag)
		{
			string textContent = propertyBag.Text; // Filtered text content

			// Here you can send downloaded filtered content to an index, database, filesystem or whatever
			Console.Out.WriteLine(textContent);
		}
开发者ID:senzacionale,项目名称:ncrawler,代码行数:7,代码来源:IndexerDemo.cs

示例5: NodeHttpResponse

        public NodeHttpResponse(NodeHttpRequest nodeHttpRequest, Task<HttpResponseMessage> resp)
            : base(null)
        {
            // TODO: Complete member initialization
            _nodeHttpRequest = nodeHttpRequest;
            _resp = resp;

            if (!resp.IsFaulted)
            {
                statusCode = (int)resp.Result.StatusCode;

                headers = new PropertyBag();

                foreach (var kvp in resp.Result.Headers)
                {
                    headers[kvp.Key] = kvp.Value.FirstOrDefault();
                }

                if (resp.Result.Content != null)
                {
                    foreach (var kvp in resp.Result.Content.Headers)
                    {
                        headers[kvp.Key] = kvp.Value.FirstOrDefault();
                    }
                }
            }
        }
开发者ID:modulexcite,项目名称:ClearScript.Manager,代码行数:27,代码来源:NodeHttpResponse.cs

示例6: ReturnsTrueForRegisteredPropertyName

            public void ReturnsTrueForRegisteredPropertyName()
            {
                var propertyBag = new PropertyBag();
                propertyBag.SetPropertyValue("MyProperty", 1);

                Assert.IsTrue(propertyBag.IsPropertyAvailable("MyProperty"));
            }
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:PropertyBagFacts.cs

示例7: ReturnsDefaultValueForNonRegisteredProperty

            public void ReturnsDefaultValueForNonRegisteredProperty()
            {
                var propertyBag = new PropertyBag();

                Assert.AreEqual(null, propertyBag.GetPropertyValue<string>("StringProperty"));
                Assert.AreEqual(0, propertyBag.GetPropertyValue<int>("IntProperty"));
            }
开发者ID:justdude,项目名称:DbExport,代码行数:7,代码来源:PropertyBagFacts.cs

示例8: Prepare

		/// <summary>
		/// Prepares an insert query.
		/// </summary>
		/// <param name="context"></param>
		/// <param name="connection">The connection.</param>
		/// <param name="transaction">The transaction.</param>
		/// <param name="sourceNode"></param>
		/// <param name="targetParentNode"></param>
		/// <returns></returns>
		public void Prepare(IMansionContext context, SqlConnection connection, SqlTransaction transaction, Node sourceNode, Node targetParentNode)
		{
			// validate arguments
			if (connection == null)
				throw new ArgumentNullException("connection");
			if (transaction == null)
				throw new ArgumentNullException("transaction");
			if (sourceNode == null)
				throw new ArgumentNullException("sourceNode");
			if (targetParentNode == null)
				throw new ArgumentNullException("targetParentNode");

			// get the properties of the new node
			var newProperties = new PropertyBag(sourceNode);

			// if the target pointer is the same as the parent of the source node, generate a new name to distinguish between the two.
			if (sourceNode.Pointer.Parent == targetParentNode.Pointer)
			{
				// get the name of the node
				var name = sourceNode.Get<string>(context, "name");

				// change the name to indicate the copied node
				newProperties.Set("name", name + CopyPostfix);
			}

			// create an insert query
			command = context.Nucleus.CreateInstance<InsertNodeCommand>();
			command.Prepare(context, connection, transaction, targetParentNode.Pointer, newProperties);
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:38,代码来源:CopyNodeCommand.cs

示例9: NamespaceNode

 public NamespaceNode(string @namespace, string text)
     : base(@namespace, text)
 {
     CheckState = System.Windows.Forms.CheckState.Checked;
     CodeElement = Reflector.WrapNamespace(@namespace);
     Metadata = new PropertyBag();
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:NamespaceNode.cs

示例10: UIItem

 public UIItem(String Name, Shape Shape, PropertyBag settings)
 {
     this.Name = Name;
     if (settings != null) Properties.Add(new UIItemProperties(null, settings));
     this.Shape = Shape;
     Hover = false;
 }
开发者ID:Blecki,项目名称:coerceo,代码行数:7,代码来源:UIItem.cs

示例11: DoExecute

		/// <summary>
		/// Executes the tag.
		/// </summary>
		/// <param name="context">The application context.</param>
		protected override void DoExecute(IMansionContext context)
		{
			try
			{
				ExecuteChildTags(context);
			}
			catch (ThreadAbortException)
			{
				// thread is aborted, so don't throw any new exceptions
			}
			catch (Exception ex)
			{
				// get the catch tag
				CatchTag catchTag;
				if (!TryGetAlternativeChildTag(out catchTag))
					throw new ScriptTagException(this, ex);

				// get the exception details
				var exceptionDetails = new PropertyBag
				                       {
				                       	{"type", ex.GetType().FullName},
				                       	{"message", ex.Message},
				                       	{"stacktrace", ex.StackTrace}
				                       };

				// push error to the stack
				using (context.Stack.Push("Exception", exceptionDetails, false))
					catchTag.Execute(context);
			}
		}
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:34,代码来源:TryTag.cs

示例12: Template

 public Template()
 {
     Properties = new PropertyBag();
     Stats = new StatBag();
     Scripts = new List<uint>();
     GameObjectType = GOT.None;
 }
开发者ID:kamilion,项目名称:WISP,代码行数:7,代码来源:Template.cs

示例13: Test

        private void Test()
        {
            Game g = new Game();
            PropertyBag p = new PropertyBag();
            g.Properties = p;
            g.Owner = -1;

            TurnedGameServerGame tg = new TurnedGameServerGame(g);
            string msg ="";
            CharacterInfo ci1 = new CharacterInfo();
            ci1.ID = 1;
            ci1.CharacterName = "Alpha";
            ServerCharacterInfo t1 = new ServerCharacterInfo(ci1);
            tg.AddPlayer(t1, ref msg);

            CharacterInfo ci2 = new CharacterInfo();
            ci2.ID = 2;
            ci2.CharacterName = "Bravo";
            ServerCharacterInfo t2 = new ServerCharacterInfo(ci2);
            tg.AddPlayer(t2, ref msg);

            CharacterInfo ci3 = new CharacterInfo();
            ci3.ID = 3;
            ci3.CharacterName = "Charly";
            ServerCharacterInfo t3 = new ServerCharacterInfo(ci3);
            tg.AddPlayer(t3, ref msg);

            string msg2 ="";
            tg.StartGame(ref msg2, true);
        }
开发者ID:kamilion,项目名称:WISP,代码行数:30,代码来源:GameLobbyServerTB.cs

示例14: Process

		public async Task<bool> Process(ICrawler crawler, PropertyBag propertyBag)
		{
			FlurlClient client = propertyBag.Step.Uri.ToString()
				.ConfigureHttpClient(httpClient => { });
			client.Settings.AfterCall += httpCall =>
			{
				propertyBag[FlurlHttpCallPropertyName].Value = httpCall;
				propertyBag.DownloadTime = httpCall.Duration.GetValueOrDefault();
			};

			HttpResponseMessage getResult = await client.GetAsync();
			propertyBag.CharacterSet = getResult.Content.Headers.ContentType.CharSet;
			propertyBag.ContentEncoding = string.Join(";", getResult.Content.Headers.ContentEncoding);
			propertyBag.ContentType = getResult.Content.Headers.ContentType.MediaType;
			propertyBag.Headers = getResult.Content.Headers.ToDictionary(x => x.Key, x => x.Value);
			propertyBag.LastModified = getResult.Headers.Date.GetValueOrDefault(DateTimeOffset.UtcNow).DateTime;
			propertyBag.Method = "GET";
			//propertyBag.ProtocolVersion = getResult.;
			//propertyBag.ResponseUri = getResult.Headers.Server;
			propertyBag.Server = string.Join(";", getResult.Headers.Server.Select(x => x.Product.ToString()));
			propertyBag.StatusCode = getResult.StatusCode;
			propertyBag.StatusDescription = getResult.StatusCode.ToString();
			propertyBag.Response = await getResult.Content.ReadAsByteArrayAsync();
			return true;
		}
开发者ID:esbencarlsen,项目名称:NCrawler,代码行数:25,代码来源:FlurlDownloadPipelineStep.cs

示例15: SerializationDoubleRoundtrip

		public void SerializationDoubleRoundtrip ()
		{
			var bag = new PropertyBag ();
			var t = new SerializableObject {
				SomeValue = "test1"
			};
			bag.SetValue ("foo", t);

			var w = new StringWriter ();
			var ser = new XmlDataSerializer (new DataContext ());
			ser.Serialize (w, bag);
			var data = w.ToString ();

			SerializableObject.CreationCount = 0;

			bag = ser.Deserialize<PropertyBag> (new StringReader (data));

			// SerializableObject is not instantiated if not queried
			Assert.AreEqual (0, SerializableObject.CreationCount);

			w = new StringWriter ();
			ser.Serialize (w, bag);
			data = w.ToString ();

			bag = ser.Deserialize<PropertyBag> (new StringReader (data));

			// SerializableObject is not instantiated if not queried
			Assert.AreEqual (0, SerializableObject.CreationCount);

			t = bag.GetValue<SerializableObject> ("foo");
			Assert.NotNull (t);
			Assert.AreEqual ("test1", t.SomeValue);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:33,代码来源:PropertyBagTests.cs


注:本文中的PropertyBag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。