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


C# Data.Get方法代码示例

本文整理汇总了C#中Data.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Data.Get方法的具体用法?C# Data.Get怎么用?C# Data.Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Data的用法示例。


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

示例1: Run

        public void Run()
        {
            // Create data container
            Data d = new Data();

            // Application based interface
            d.Put("altura", 10);
            int n1 = (int)d.Get("altura");

            // Contract based interface
            d.Put(new SpecificMetadata1(123));
            d.Put(new SpecificMetadata2(1, 2, 3));
            SpecificMetadata1 n2 = d.Get<SpecificMetadata1>();
            SpecificMetadata2 n3 = d.Get<SpecificMetadata2>();

            StorageService s = new StorageService();
            s.Put("0", "pepito", d);

            var result = from n in s.Dates orderby n.date select n;
            foreach (var e in result)
            {
                Console.WriteLine(e.date);
            }

            s.Dispose();
        }
开发者ID:jlopezr,项目名称:async-examples,代码行数:26,代码来源:Program.cs

示例2: GetEntities

        public override object[] GetEntities(Data.IFixtureContainer fixtureContainer)
        {
            var teamFixture = fixtureContainer.Get<TeamFixture>();

            MegaBowl.AddTeam(teamFixture.Jets);
            MuddyField.AddTeam(teamFixture.Falcons);
            MuddyField.AddTeam(teamFixture.Donkeys);

            return new []
            {
                MegaBowl,
                MuddyField
            };
        }
开发者ID:myles-mcdonnell,项目名称:Bootstrap4NHibernate,代码行数:14,代码来源:StadiumFixture.cs

示例3: FromData

        /// <summary>
        /// Convert from <see cref="SorentoLib.Data"/> string to <see cref="SorentoLib.User"/>.
        /// </summary>
        private static User FromData(Data Data, bool Internal)
        {
            User result = new User ();

            if (Data.ContainsKey ("id"))
                result._id = Data.Get<Guid>("id");
            else
                throw new Exception (string.Format (Strings.Exception.JSONFrom, typeof (User), "ID"));

            if (Data.ContainsKey ("createtimestamp"))
                result._createtimestamp = Data.Get<int> ("createtimestamp");

            if (Data.ContainsKey ("updatetimestamp"))
                result._updatetimestamp = Data.Get<int> ("updatetimestamp");

            if (Data.ContainsKey ("usergroupids"))
                foreach (Guid id in Data.Get<List<Guid>>("usergroupids"))
                    result._usergroupids.Add (id);

            if (Data.ContainsKey ("username"))
                result._username = Data.Get<string>("username");

            if (Data.ContainsKey ("email"))
                result._email = Data.Get<string>("email");

            if (Data.ContainsKey ("realname"))
                result._realname = Data.Get<string>("realname");

            if (Internal)
                if (Data.ContainsKey ("password"))
                    result._password = Data.Get<string>("password");
            else
                result._password = User.Load (result._id)._password;

            if (Data.ContainsKey ("status"))
                result._status = Data.Get<Enums.UserStatus> ("status");

            return result;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:42,代码来源:Config.cs

示例4: FromData

        public static Event FromData(Data data)
        {
            Event result = new Event ();

            if (data.ContainsKey ("id"))
                result._id = data.Get<Guid>("id");
            else
                throw new Exception (string.Format (SorentoLib.Strings.Exception.JSONFrom, typeof (Event), "ID"));

            if (data.ContainsKey ("createtimestamp"))
                result._createtimestamp = data.Get<int>("createtimestamp");

            if (data.ContainsKey ("updatetimestamp"))
                result._updatetimestamp = data.Get<int>("updatetimestamp");

            if (data.ContainsKey ("sort"))
                result._sort = data.Get<double>("sort");

            if (data.ContainsKey ("name"))
                result._name = data.Get<string>("name");

            if (data.ContainsKey ("ownerid"))
                result._ownerid = data.Get<Guid>("ownerid");

            if (data.ContainsKey ("data"))
                result._data = data.Get<Data>("data");

            return result;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:29,代码来源:Event.cs

示例5: FromData

        public static EventListener FromData(Data data)
        {
            EventListener result = new EventListener ();

            if (data.ContainsKey ("id"))
                result._id = data.Get<Guid>("id");
            else
                throw new Exception (string.Format (SorentoLib.Strings.Exception.JSONFrom, typeof (Event), "ID"));

            if (data.ContainsKey ("createtimestamp"))
                result._createtimestamp = data.Get<int>("createtimestamp");

            if (data.ContainsKey ("updatetimestamp"))
                result._updatetimestamp = data.Get<int>("updatetimestamp");

            return result;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:17,代码来源:EventListener.cs

示例6: PaintBars

		/// <summary>
		/// </summary>
		/// <param name="chartControl"></param>
		/// <param name="graphics"></param>
		/// <param name="bars"></param>
		/// <param name="panelIdx"></param>
		/// <param name="fromIdx"></param>
		/// <param name="toIdx"></param>
		/// <param name="bounds"></param>
		/// <param name="max"></param>
		/// <param name="min"></param>
		public override void PaintBars(ChartControl chartControl, Graphics graphics, Data.Bars bars, int panelIdx, int fromIdx, int toIdx, Rectangle bounds, double max, double min)
		{   
			if (downPen.Color != DownColor)
		        downPen.Color = DownColor;

		    if (upPen.Color != UpColor)
				upPen.Color = UpColor;

			if (pen == null)
				pen = upPen;

			//Data.IBar	bar;
			int			barWidth;
		    int			barWidthValue	= bars.BarsData.ChartStyle.BarWidthUI;
			int			boxDrawCount;
			double		boxHeightActual	= Math.Floor(10000000.0 * (double) bars.Period.Value * bars.Instrument.MasterInstrument.TickSize) / 10000000.0;
			int			boxSize			= (int) Math.Round((double) (bounds.Height) / Math.Round((double) (ChartControl.MaxMinusMin(max, min) / boxHeightActual), 0));
			int			diff;
			int			open;
			double		openVal;
			int			close;
			double		closeVal;
			int			nextBox;
			int			x;

			System.Drawing.Drawing2D.SmoothingMode	oldSmoothingMode	= graphics.SmoothingMode;
			graphics.SmoothingMode										= System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
			trendDetermined												= false;

			for (int idx = fromIdx; idx <= toIdx; idx++)
			{
				barWidth		= GetBarPaintWidth(barWidthValue);
				closeVal		= bars.GetClose(idx);
				openVal			= bars.GetOpen(idx);

				boxDrawCount	= (openVal == closeVal ? 1 : (int) Math.Round((Math.Abs(openVal - closeVal) / boxHeightActual), 0) + 1);
				close			= chartControl.GetYByValue(bars, closeVal);
				open			= chartControl.GetYByValue(bars, openVal);

				nextBox			= Math.Min(open, close);
				x				= chartControl.GetXByBarIdx(bars, idx);

				diff			= (Math.Abs(open - close) + boxSize) - (int) Math.Round((double)(boxSize * boxDrawCount));

				if (closeVal == openVal)
				{
					if (idx == 0)
					{
						graphics.DrawRectangle(downPen, new Rectangle(x - barWidth / 2 + 1, nextBox - (boxSize / 2) + 2, barWidth - 1, boxSize - 2));

						graphics.DrawLine(upPen,
						x - barWidth / 2,
						nextBox - (boxSize / 2) + 1,
						x + barWidth / 2,
						nextBox - (boxSize / 2) + boxSize - 1);

						graphics.DrawLine(upPen,
						x - barWidth / 2,
						nextBox - (boxSize / 2) + boxSize - 1,
						x + barWidth / 2,
						nextBox - (boxSize / 2) + 1);
						continue;
					}
					else if (!trendDetermined)
					{
						Data.Bar lastBar = (Data.Bar) bars.Get(idx - 1);
						if (lastBar.Open == lastBar.Close)
						{
							if(bars.GetHigh(idx) < lastBar.High)
								pen = downPen;
						}
						else 
							pen = (lastBar.Open < lastBar.Close ? downPen : upPen);

						trendDetermined = true;
					}
					else
						pen = (pen == upPen ? downPen : upPen);
				}
				else 
					pen = (closeVal > openVal ? upPen : downPen);

				float oldPenWidth		= Pen.Width;
				pen.Width				= LineWidth;
				
				for (int k = 0; k < boxDrawCount; k++)
				{
					if (diff != 0)
					{
//.........这里部分代码省略.........
开发者ID:kbh0001,项目名称:kennt-stuff,代码行数:101,代码来源:ChartStyles.cs


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