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


C# Infrastructure.UrlParser类代码示例

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


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

示例1: LoadModelParameters

		public override void LoadModelParameters(string parameters)
		{
			var urlParser = new UrlParser(parameters);
			if (urlParser.GetQueryParam("mode") == "new")
			{
				IsNewTransformer = true;
				Header = "New Transformer";

				UpdateFromTransformer(new TransformerDefinition());

				return;
			}

			var name = urlParser.Path;
			if (string.IsNullOrWhiteSpace(name))
				HandleTransformerNotFound(null);

			Header = name;
			OriginalName = name;
			IsNewTransformer = false;

			DatabaseCommands.GetTransformerAsync(name)
				.ContinueOnUIThread(task =>
				{
					if (task.IsFaulted || task.Result == null)
					{
						HandleTransformerNotFound(name);
						return;
					}

					UpdateFromTransformer(task.Result);
				}).Catch();
		}
开发者ID:925coder,项目名称:ravendb,代码行数:33,代码来源:TransformerDefinitionModel.cs

示例2: Execute

		public override void Execute(object parameter)
		{
			bool shouldRedirect = true;

			var urlParser = new UrlParser(UrlUtil.Url);
			if (urlParser.GetQueryParam("database") == databaseName)
				shouldRedirect = false;

			urlParser.SetQueryParam("database", databaseName);

			var server = ApplicationModel.Current.Server.Value;
			server.SetCurrentDatabase(urlParser);
			server.SelectedDatabase.Value.AsyncDatabaseCommands
				.EnsureSilverlightStartUpAsync()
				.Catch();

			var updateAllFromServer = View.UpdateAllFromServer();
			refreshStaticModels
				.Except(updateAllFromServer.Select(x=>x.GetType()))
				.Select(model => (Model) Activator.CreateInstance(model))
				.ForEach(model => model.ForceTimerTicked());
			
			
			if (shouldRedirect)
			{
				UrlUtil.Navigate(urlParser.BuildUrl());
			}
		}
开发者ID:jtmueller,项目名称:ravendb,代码行数:28,代码来源:ChangeDatabaseCommand.cs

示例3: Navigate

		public static void Navigate(string url)
		{
			if (url == null)
				return;

			url = new UrlParser(url).BuildUrl();
			Navigate((new Uri(url, UriKind.Relative)));
		}
开发者ID:richSourceShaper,项目名称:ravendb,代码行数:8,代码来源:UrlUtil.cs

示例4: LoadModelParameters

		public override void LoadModelParameters(string parameters)
		{
			IndexName = new UrlParser(parameters).Path.Trim('/');

			var allErrors = Database.Value.Statistics.Value.Errors;
			if (IsShowingErrorForASpecificIndex)
				allErrors = allErrors.Where(e => e.Index == IndexName).ToArray();
			Errors = allErrors;
		}
开发者ID:remcoros,项目名称:ravendb,代码行数:9,代码来源:IndexesErrorsModel.cs

示例5: LoadModelParameters

		public override void LoadModelParameters(string parameters)
		{
			var url = new UrlParser(UrlUtil.Url);

			if (url.GetQueryParam("mode") == "new")
			{
				Mode = DocumentMode.New;
				return;
			}

			var docId = url.GetQueryParam("id");
			var neighbors = url.GetQueryParam("neighbors");
			if (neighbors != null)
				NeighborIds = neighbors.Split(',').ToList();
			if (string.IsNullOrWhiteSpace(docId) == false)
			{
				Mode = DocumentMode.DocumentWithId;
				LocalId = docId;
				SetCurrentDocumentKey(docId);
				DatabaseCommands.GetAsync(docId)
					.ContinueOnSuccessInTheUIThread(newdoc =>
														{
															if (newdoc == null)
															{
																HandleDocumentNotFound();
																return;
															}
															document.Value = newdoc;
															isLoaded = true;
														})
					.Catch();
				return;
			}

			projectionId = url.GetQueryParam("projection");
			if (string.IsNullOrWhiteSpace(projectionId) == false)
			{
				Mode = DocumentMode.Projection;
				try
				{
					ViewableDocument viewableDocument;
					ProjectionData.Projections.TryGetValue(projectionId, out viewableDocument);

					var ravenJObject = RavenJObject.Parse(viewableDocument.InnerDocument.ToJson().ToString(Formatting.None));
					var newdoc = ravenJObject.ToJsonDocument();
					document.Value = newdoc;
					LocalId = projectionId;
				}
				catch
				{
					HandleDocumentNotFound();
					throw; // Display why we couldn't parse the projection from the URL correctly
				}
			}
		}
开发者ID:Bishbulb,项目名称:ravendb,代码行数:55,代码来源:EditableDocumentModel.cs

示例6: LoadModelParameters

		public override void LoadModelParameters(string parameters)
		{
			var urlParser = new UrlParser(parameters);
			var name = urlParser.GetQueryParam("name");
			if (SelectedCollection.Value != null && SelectedCollection.Value.Documents.Value != null)
			{
				SelectedCollection.Value.Documents.Value.Pager.SetSkip(urlParser);
				ForceTimerTicked();
			}
			initialSelectedDatabaseName = name;
		}
开发者ID:maurodx,项目名称:ravendb,代码行数:11,代码来源:CollectionsModel.cs

示例7: TimerTickedAsync

		protected override Task TimerTickedAsync()
		{
			return DatabaseCommands.GetTermsCount("Raven/DocumentsByEntityName", "Tag", "", 100)
				.ContinueOnSuccess(Update)
				.CatchIgnore<WebException>(() =>
				       	{
							var urlParser = new UrlParser(UrlUtil.Url);
				       		if (urlParser.RemoveQueryParam("name"))
				       			UrlUtil.Navigate(urlParser.BuildUrl());
				       		ApplicationModel.Current.AddNotification(new Notification("Unable to retrieve collections from server.", NotificationLevel.Error));
				       	});
		}
开发者ID:maurodx,项目名称:ravendb,代码行数:12,代码来源:CollectionsModel.cs

示例8: FromUrl

        public static DocumentNavigator FromUrl(UrlParser parser)
        {
            var mode = parser.GetQueryParam("navigationMode");

            if (mode == "allDocs")
                return AllDocumentsNavigator.AllDocumentsFromUrl(parser);
            
            if (mode == "index")
                return IndexDocumentsNavigator.IndexNavigatorFromUrl(parser);

            return new SingleDocumentNavigator(parser.GetQueryParam("id"));
        }
开发者ID:nberardi,项目名称:ravendb,代码行数:12,代码来源:DocumentNavigationStrategy.cs

示例9: OnViewLoaded

		protected override void OnViewLoaded()
		{
			var indexToShow = new UrlParser(UrlUtil.Url).GetQueryParam("index");
            if (indexToShow != null)
            {
                SelectedViewOption.Value = indexToShow;
                Breadcrumb = "Indexes";
                OnPropertyChanged(() => Breadcrumb);
            }

		    base.OnViewLoaded();
		}
开发者ID:samueldjack,项目名称:ravendb,代码行数:12,代码来源:StatisticsModel.cs

示例10: Execute

		public override void Execute(object parameter)
		{
			var urlParser = new UrlParser(UrlUtil.Url);
			if (urlParser.GetQueryParam("database") == databaseName)
			{
			    return;
			}
			if (navigateAfter) 
				urlParser = new UrlParser("/documents");

			urlParser.SetQueryParam("database", databaseName);
			// MainPage.ContentFrame_Navigated takes care of actually responding to the db name change
			UrlUtil.Navigate(urlParser.BuildUrl());
		}
开发者ID:925coder,项目名称:ravendb,代码行数:14,代码来源:ChangeDatabaseCommand.cs

示例11: ContentFrame_Navigating

        // EnsureDatabaseParameterIncluded
        private void ContentFrame_Navigating(object sender, NavigatingCancelEventArgs e)
        {
            if (navigationMode != NavigationMode.New) return;

            var urlParser = new UrlParser(e.Uri.ToString());
            if (urlParser.GetQueryParam("database") != null)
                return;

            e.Cancel = true;
            navigationMode = NavigationMode.Refresh;
            urlParser.SetQueryParam("database", ApplicationModel.Current.Server.Value.SelectedDatabase.Value.Name);
            urlParser.NavigateTo();
            navigationMode = NavigationMode.New;
        }
开发者ID:kyanha,项目名称:studio,代码行数:15,代码来源:MainPage.xaml.cs

示例12: Execute

		public override void Execute(object parameter)
		{
			var urlParser = new UrlParser("/edit");
			var friendly = (parameter as FriendlyDocument);
			if (friendly != null)
			{
				urlParser.SetQueryParam(friendly.IsProjection ? "projection" : "id", friendly.Id);
				
				if (friendly.NeighborsIds != null)
					urlParser.SetQueryParam("neighbors", string.Join(",", friendly.NeighborsIds));
			}

			UrlUtil.Navigate(urlParser.BuildUrl());
		}
开发者ID:925coder,项目名称:ravendb,代码行数:14,代码来源:EditNeighboringDocumentCommand.cs

示例13: PutCollectionNameInTheUrl

		private void PutCollectionNameInTheUrl()
		{
			var urlParser = new UrlParser(UrlUtil.Url);
			var collection = SelectedCollection.Value;
			if (collection == null)
				return;
			var name = collection.Name;
			initialSelectedDatabaseName = name;
			if (urlParser.GetQueryParam("name") != name)
			{
				urlParser.SetQueryParam("name", name);
				UrlUtil.Navigate(urlParser.BuildUrl());
			}
		}
开发者ID:nberardi,项目名称:ravendb,代码行数:14,代码来源:CollectionsModel.cs

示例14: Initialize

		private void Initialize()
		{
            if (DesignerProperties.IsInDesignTool)
            {
                return;
            }

			documentStore = new DocumentStore
			{
				Url = Url
			};

			var urlParser = new UrlParser(UrlUtil.Url);
			var apiKey = urlParser.GetQueryParam("api-key");
			if (string.IsNullOrEmpty(apiKey) == false)
				documentStore.ApiKey = apiKey;

			documentStore.Initialize();

			// We explicitly enable this for the Studio, we rely on SL to actually get us the credentials, and that 
			// already gives the user a clear warning about the dangers of sending passwords in the clear. I think that 
			// this is sufficient warning and we don't require an additional step, so we can disable this check safely.
			documentStore.JsonRequestFactory.
				EnableBasicAuthenticationOverUnsecureHttpEvenThoughPasswordsWouldBeSentOverTheWireInClearTextToBeStolenByHackers =
				true;
			
			documentStore.JsonRequestFactory.ConfigureRequest += (o, eventArgs) =>
			{
				if (onWebRequest != null)
					onWebRequest(eventArgs.Request);
			};

			defaultDatabase = new[] { new DatabaseModel(DatabaseModel.DefaultDatabaseName, documentStore) };
			Databases.Set(defaultDatabase);
			SetCurrentDatabase(new UrlParser(UrlUtil.Url));

			DisplayBuildNumber();
			DisplyaLicenseStatus();

			var changeDatabaseCommand = new ChangeDatabaseCommand();
			SelectedDatabase.PropertyChanged += (sender, args) =>
			{
				if (SelectedDatabase.Value == null)
					return;
				var databaseName = SelectedDatabase.Value.Name;
				Command.ExecuteCommand(changeDatabaseCommand, databaseName);
			};
		}
开发者ID:royra,项目名称:ravendb,代码行数:48,代码来源:ServerModel.cs

示例15: LoadModelParameters

		public override void LoadModelParameters(string parameters)
		{
			var urlParser = new UrlParser(parameters);

			IndexName = urlParser.Path.Trim('/');

			DatabaseCommands.GetIndexAsync(IndexName)
				.ContinueOnSuccessInTheUIThread(definition =>
				{
					if (definition == null)
					{
						IndexDefinitionModel.HandleIndexNotFound(IndexName);
						return;
					}
				}).Catch();
		}
开发者ID:925coder,项目名称:ravendb,代码行数:16,代码来源:IndexStatsModel.cs


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