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


C# NavigationData类代码示例

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


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

示例1: NavigatePersonMaximumRowsLinkTest

		public void NavigatePersonMaximumRowsLinkTest()
		{
			NavigationData data = new NavigationData();
			data["maximumRows"] = 20;
			string link = StateController.GetNavigationLink("Person", data);
			Assert.AreEqual("/List/0/20", link);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:7,代码来源:StateInfoTest.cs

示例2: NavigateHistory

		/// <summary>
		/// Responds to a <see cref="System.Web.UI.ScriptManager"/> history navigation handler and restores the
		/// <paramref name="data"/> saved by <see cref="AddHistoryPoint(System.Web.UI.Page, Navigation.NavigationData, string)"/> 
		/// method to the <see cref="Navigation.StateContext"/>
		/// </summary>
		/// <param name="data">Saved <see cref="Navigation.StateContext"/> to restore</param>
		/// <exception cref="System.ArgumentNullException"><paramref name="data"/> is null</exception>
		/// <exception cref="Navigation.UrlException">There is data that cannot be converted from a <see cref="System.String"/>;
		/// or the <see cref="Navigation.NavigationShield"/> detects tampering</exception>
		public static void NavigateHistory(NameValueCollection data)
		{
			if (data == null)
				throw new ArgumentNullException("data");
			if (data.Count == 0)
			{
				NavigationData derivedData = new NavigationData(StateContext.State.Derived);
#if NET40Plus
				SetStateContext(StateContext.State.Id, new HttpContextWrapper(HttpContext.Current));
#else
				SetStateContext(StateContext.State.Id, HttpContext.Current.Request.QueryString);
#endif
				StateContext.Data.Add(derivedData);
			}
			else
			{
				RemoveDefaultsAndDerived(data);
				data = StateContext.ShieldDecode(data, true, StateContext.State);
				data.Remove(NavigationSettings.Config.StateIdKey);
				NavigationData derivedData = new NavigationData(StateContext.State.Derived);
				StateContext.Data.Clear();
				StateContext.Data.Add(derivedData);
				foreach (string key in data)
				{
					StateContext.Data[key] = CrumbTrailManager.ParseURLString(key, data[key], StateContext.State);
				}
			}
		}
开发者ID:ericziko,项目名称:navigation,代码行数:37,代码来源:StateController.cs

示例3: NavigateMvcPersonStartRowIndexLinkTest

		public void NavigateMvcPersonStartRowIndexLinkTest()
		{
			NavigationData data = new NavigationData();
			data["startRowIndex"] = 10;
			string link = StateController.GetNavigationLink("MvcPerson", data);
			Assert.AreEqual("/MvcList/10", link);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:7,代码来源:StateInfoTest.cs

示例4: Start

	// Use this for initialization
	void Start () {
		Debug.Log("Start");
		// initialize data array
		data = new byte[width*height*3];

		// set textures
		MainRenderer.material.mainTexture = cameraTexture;
		SecondaryRenderer.material.mainTexture = blackTexture;
		cameraTexture = new Texture2D (width, height);
		blackTexture = new Texture2D (1, 1);
		blackTexture.SetPixel (0, 0, Color.black);
		blackTexture.Apply ();

		// Initialize drone
		videoPacketDecoderWorker = new VideoPacketDecoderWorker(PixelFormat.BGR24, true, OnVideoPacketDecoded);
		videoPacketDecoderWorker.Start();
		droneClient = new DroneClient("192.168.1.1");
		droneClient.UnhandledException += HandleUnhandledException;
		droneClient.VideoPacketAcquired += OnVideoPacketAcquired;
		droneClient.NavigationDataAcquired += navData => navigationData = navData;
		videoPacketDecoderWorker.UnhandledException += HandleUnhandledException;
		droneClient.Start ();

		// activate main drone camera
		switchDroneCamera (AR.Drone.Client.Configuration.VideoChannelType.Vertical);

		// determine connection
		client = new WlanClient();
	}
开发者ID:denlittlstar,项目名称:RiftDrone,代码行数:30,代码来源:DroneController.cs

示例5: CreateScreenData

 public override void CreateScreenData(NavigationData navigationData)
 {
   base.CreateScreenData(navigationData);
   if (!_presentsBaseView)
     return;
   ReloadMediaItems(navigationData.BaseViewSpecification.BuildView(), true);
 }
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:7,代码来源:AbstractItemsScreenData.cs

示例6: DroneClient

        public DroneClient(string hostname)
        {
            _networkConfiguration = new NetworkConfiguration(hostname);
            _commandQueue = new ConcurrentQueue<AtCommand>();
            _navigationData = new NavigationData();

            _commandSender = new CommandSender(NetworkConfiguration, _commandQueue);
            _navdataAcquisition = new NavdataAcquisition(NetworkConfiguration, OnNavdataPacketAcquired, OnNavdataAcquisitionStarted, OnNavdataAcquisitionStopped);
            _videoAcquisition = new VideoAcquisition(NetworkConfiguration, OnVideoPacketAcquired);
        }
开发者ID:edmundo096,项目名称:LeapRiftDrone,代码行数:10,代码来源:DroneClient.cs

示例7: UpdateData

		private static void UpdateData(NameValueCollection queryString, NavigationData toData)
		{
			if (queryString["navigation"] != "history")
			{
				var toDataKeys = GetDataKeyEnumerator(queryString["tokeys"]);
				foreach (var toDataKey in toDataKeys)
					StateContext.Data[toDataKey] = toData[toDataKey];
			}
			else
				StateContext.Data.Add(toData);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:11,代码来源:MvcStateRouteHandler.cs

示例8: NavigationDataValueProviderTest

		public void NavigationDataValueProviderTest()
		{
			NavigationData data = new NavigationData() { 
				{ "string", "Hello" }, {"int", 1 }
			};
			StateController.Navigate("d0", data);
			ModelBindingExecutionContext context = new ModelBindingExecutionContext(new MockHttpContext(), new ModelStateDictionary());
			NavigationDataValueProvider provider = new NavigationDataValueProvider(context, false, null);
			Assert.AreEqual("Hello", provider.GetValue("string").RawValue);
			Assert.AreEqual(1, provider.GetValue("int").RawValue);
			Assert.AreEqual("1", provider.GetValue("int").AttemptedValue);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:12,代码来源:NavigationDataBindingTest.cs

示例9: AddHistoryPoint

		/// <summary>
		/// Wraps the ASP.NET <see cref="System.Web.UI.ScriptManager"/> history point functionality.
		/// </summary>
		/// <param name="page">Current <see cref="System.Web.UI.Page"/></param>
		/// <param name="toData">The <see cref="Navigation.NavigationData"/> used to create the history point</param>
		/// <param name="title">Title for history point</param>
		/// <exception cref="System.ArgumentNullException"><paramref name="page"/> is null</exception>
		/// <exception cref="System.ArgumentException">There is <see cref="Navigation.NavigationData"/> that cannot be converted to a <see cref="System.String"/></exception>
		public static void AddHistoryPoint(Page page, NavigationData toData, string title)
		{
			if (page == null)
				throw new ArgumentNullException("page");
			NameValueCollection coll = new NameValueCollection();
			coll[NavigationSettings.Config.StateIdKey] = StateContext.StateId;
			foreach (NavigationDataItem item in toData)
			{
				if (!item.Value.Equals(string.Empty) && !StateContext.State.DefaultOrDerived(item.Key, item.Value))
					coll[item.Key] = CrumbTrailManager.FormatURLObject(item.Key, item.Value, StateContext.State);
			}
			coll = StateContext.ShieldEncode(coll, true, StateContext.State);
			ScriptManager.GetCurrent(page).AddHistoryPoint(coll, title);
			ScriptManager.RegisterClientScriptBlock(page, typeof(StateController), "historyUrl", string.Format(CultureInfo.InvariantCulture, HISTORY_URL_VAR, HISTORY_URL, new JavaScriptSerializer().Serialize(GetRefreshLink(toData))), true);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:23,代码来源:StateController.cs

示例10: GenerateSorter

		private static MvcHtmlString GenerateSorter(this HtmlHelper htmlHelper, string linkText, string sortBy, string sortExpressionKey, object htmlAttributes)
		{
			if (string.IsNullOrEmpty(linkText))
				throw new ArgumentException(Resources.NullOrEmpty, "linkText");
			if (string.IsNullOrEmpty(sortBy))
				throw new ArgumentException(Resources.NullOrEmpty, "sortBy");
			string sortExpression = (string)StateContext.Data[sortExpressionKey];
			if (sortExpression != sortBy + " DESC")
				sortExpression = sortBy + " DESC";
			else
				sortExpression = sortBy;
			NavigationData toData = new NavigationData();
			toData[sortExpressionKey] = sortExpression;
			return htmlHelper.RefreshLink(linkText, toData, true, htmlAttributes);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:15,代码来源:SorterExtensions.cs

示例11: InitMediaNavigation

    public void InitMediaNavigation(out string mediaNavigationMode, out NavigationData navigationData)
    {
      IEnumerable<Guid> skinDependentOptionalMIATypeIDs = MediaNavigationModel.GetMediaSkinOptionalMIATypes(MediaNavigationMode);
      AbstractItemsScreenData.PlayableItemCreatorDelegate picd = mi => new VideoItem(mi)
      {
        Command = new MethodDelegateCommand(() => PlayItemsModel.CheckQueryPlayAction(mi))
      };
      ViewSpecification rootViewSpecification = new MediaLibraryQueryViewSpecification(Consts.RES_VIDEOS_VIEW_NAME,
        null, Consts.NECESSARY_VIDEO_MIAS, skinDependentOptionalMIATypeIDs, true)
      {
        MaxNumItems = Consts.MAX_NUM_ITEMS_VISIBLE
      };
      AbstractScreenData filterByGenre = new VideosFilterByGenreScreenData();
      ICollection<AbstractScreenData> availableScreens = new List<AbstractScreenData>
        {
          new VideosShowItemsScreenData(picd),
          new VideosFilterByLanguageScreenData(),
          new VideosFilterByActorScreenData(),
          new VideosFilterByDirectorScreenData(),
          new VideosFilterByWriterScreenData(),
          filterByGenre,
          // C# doesn't like it to have an assignment inside a collection initializer
          new VideosFilterByYearScreenData(),
          new VideosFilterBySystemScreenData(),
          new VideosSimpleSearchScreenData(picd),
        };
      Sorting.Sorting sortByTitle = new SortByTitle();
      ICollection<Sorting.Sorting> availableSortings = new List<Sorting.Sorting>
        {
          sortByTitle,
          new SortByYear(),
          new VideoSortByFirstGenre(),
          new VideoSortByDuration(),
          new VideoSortByFirstActor(),
          new VideoSortByFirstDirector(),
          new VideoSortByFirstWriter(),
          new VideoSortBySize(),
          new VideoSortByAspectRatio(),
          new SortBySystem(),
        };
      navigationData = new NavigationData(null, Consts.RES_VIDEOS_VIEW_NAME, MediaNavigationRootState,
        MediaNavigationRootState, rootViewSpecification, filterByGenre, availableScreens, sortByTitle)
      {
        AvailableSortings = availableSortings
      };

      mediaNavigationMode = MediaNavigationMode;
    }
开发者ID:jgauffin,项目名称:MediaPortal-2,代码行数:48,代码来源:VideosNavigation.cs

示例12: RaisePostBackEvent

		/// <summary>
		/// Updates <see cref="Navigation.StateContext.Data">State Context</see> when the
		/// <see cref="System.Web.UI.WebControls.HyperLink"/> posts back to the server
		/// </summary>
		/// <param name="eventArgument">The argument for the event</param>
		public void RaisePostBackEvent(string eventArgument)
		{
			if (StringComparer.OrdinalIgnoreCase.Compare(eventArgument, REFRESH_POST_BACK) == 0)
			{
				Page.ClientScript.ValidateEvent(HyperLink.UniqueID, REFRESH_POST_BACK);
				NavigationData derivedData = new NavigationData(StateContext.State.Derived);
				NavigationData toData = StateInfoConfig.ParseNavigationDataExpression(HyperLink.Attributes["__ToData"], StateContext.State, true);
				StateContext.Data.Clear();
				StateContext.Data.Add(toData);
				StateContext.Data.Add(derivedData);
			}
			else
			{
				((IPostBackEventHandler)HyperLink).RaisePostBackEvent(eventArgument);
			}
		}
开发者ID:ericziko,项目名称:navigation,代码行数:21,代码来源:RefreshHyperLinkAdapter.cs

示例13: GetHref

		internal static string GetHref(string nextState, NavigationData navigationData, NavigationData returnData)
		{
			string previousState = StateContext.StateId;
			string crumbTrail = StateContext.CrumbTrailKey;
			State state = StateContext.GetState(nextState);
			NameValueCollection coll = new NameValueCollection();
			coll[NavigationSettings.Config.StateIdKey] = nextState;
			if (previousState != null && state.TrackCrumbTrail)
			{
				coll[NavigationSettings.Config.PreviousStateIdKey] = previousState;
			}
			if (navigationData != null)
			{
				foreach (NavigationDataItem item in navigationData)
				{
					if (!item.Value.Equals(string.Empty) && !state.DefaultOrDerived(item.Key, item.Value))
						coll[item.Key] = FormatURLObject(item.Key, item.Value, state);
				}
			}
			if (returnData != null && state.TrackCrumbTrail && StateContext.State != null)
			{
				var returnDataBuilder = FormatReturnData(null, StateContext.State, returnData);
				if (returnDataBuilder.Length > 0)
					coll[NavigationSettings.Config.ReturnDataKey] = returnDataBuilder.ToString();
			}
			if (crumbTrail != null && state.TrackCrumbTrail)
			{
				coll[NavigationSettings.Config.CrumbTrailKey] = crumbTrail;
			}
#if NET35Plus
			coll = StateContext.ShieldEncode(coll, false, state);
#else
			coll = StateContext.ShieldEncode(coll, state);
#endif
#if NET40Plus
			HttpContextBase context = null;
			if (HttpContext.Current != null)
				context = new HttpContextWrapper(HttpContext.Current);
			else
				context = new MockNavigationContext(null, state);
			return state.StateHandler.GetNavigationLink(state, coll, context);
#else
			return state.StateHandler.GetNavigationLink(state, coll);
#endif
		}
开发者ID:ericziko,项目名称:navigation,代码行数:45,代码来源:CrumbTrailManager.cs

示例14: DeterminePostBackMode

		/// <summary>
		/// Validates the incoming Url and if no <see cref="Navigation.NavigationSettings.StateIdKey"/> 
		/// found will navigate to the <see cref="Navigation.Dialog"/> whose path property matches the Url
		/// </summary>
		/// <returns>A <see cref="System.Collections.Specialized.NameValueCollection"/> of the 
		/// postback variables, if any; otherwise null</returns>
		/// <exception cref="Navigation.UrlException">The <see cref="Navigation.NavigationSettings.StateIdKey"/>
		/// is not found and the Url does not match the path of any <see cref="Navigation.Dialog"/>; the page of 
		/// the <see cref="Navigation.State"/> does not match the Url path</exception>
		public override NameValueCollection DeterminePostBackMode()
		{
			if (IsLogin() || !HttpContext.Current.Handler.GetType().IsSubclassOf(typeof(Page))
				|| StateInfoConfig.Dialogs == null || StateInfoConfig.Dialogs.Count == 0)
				return base.DeterminePostBackMode();
#if NET40Plus
			StateContext.StateId = Page.Request.QueryString[NavigationSettings.Config.StateIdKey] ?? (string)Page.RouteData.DataTokens[NavigationSettings.Config.StateIdKey];
#else
			StateContext.StateId = Page.Request.QueryString[NavigationSettings.Config.StateIdKey];
#endif
			if (StateContext.StateId == null)
			{
				if (_DialogPaths.ContainsKey(Page.AppRelativeVirtualPath.ToUpperInvariant()))
				{
					NavigationData data = new NavigationData();
					foreach (string key in Page.Request.QueryString)
						data.Add(key, Page.Request.QueryString[key]);
					StateController.Navigate(_DialogPaths[Page.AppRelativeVirtualPath.ToUpperInvariant()].Key, data);
				}
#if NET40Plus
				if (Page.RouteData.Route != null)
					return base.DeterminePostBackMode();
#endif
				throw new UrlException(Resources.InvalidUrl);
			}
			if (StateContext.State == null)
			{
				StateContext.StateId = null;
				throw new UrlException(Resources.InvalidUrl);
			}
#if NET40Plus
			Route route = Page.RouteData.Route as Route;
			if (StringComparer.OrdinalIgnoreCase.Compare(StateContext.State.Page, Page.AppRelativeVirtualPath) != 0
				&& StringComparer.OrdinalIgnoreCase.Compare(StateContext.State.MobilePage, Page.AppRelativeVirtualPath) != 0
				&& (route == null || StringComparer.OrdinalIgnoreCase.Compare(StateContext.State.Route, route.Url) != 0))
#else
			if (StringComparer.OrdinalIgnoreCase.Compare(StateContext.State.Page, Page.AppRelativeVirtualPath) != 0
				&& StringComparer.OrdinalIgnoreCase.Compare(StateContext.State.MobilePage, Page.AppRelativeVirtualPath) != 0)
#endif
			{
				throw new UrlException(Resources.InvalidUrl);
			}
			Page.PreInit += Page_PreInit;
			return base.DeterminePostBackMode();
		}
开发者ID:ericziko,项目名称:navigation,代码行数:54,代码来源:StateAdapter.cs

示例15: GetHttpHandler

		/// <summary>
		/// Returns the object that processes the request
		/// </summary>
		/// <param name="requestContext">An object that encapsulates information about the request</param>
		/// <returns>The object that processes the request</returns>
		protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
		{
			StateController.SetStateContext(State.Id, requestContext.HttpContext);
			var queryString = requestContext.HttpContext.Request.QueryString;
			var link = queryString["refreshajax"];
			if (link != null)
			{
				var toData = new NavigationData(true);
				StateController.NavigateLink(State, link, NavigationMode.Mock);
				RefreshAjaxInfo.GetInfo(requestContext.HttpContext).Data = new NavigationData(true);
				var includeCurrentData = false;
				bool.TryParse(queryString["includecurrent"], out includeCurrentData);
				if (!includeCurrentData)
				{
					var currentDataKeys = GetDataKeyEnumerator(queryString["currentkeys"]);
					var currentData = new NavigationData(currentDataKeys);
					StateContext.Data.Clear();
					StateContext.Data.Add(currentData);
				}
				UpdateData(queryString, toData);
			}
			return base.GetHttpHandler(requestContext);
		}
开发者ID:ericziko,项目名称:navigation,代码行数:28,代码来源:MvcStateRouteHandler.cs


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