本文整理汇总了C#中RequestContext类的典型用法代码示例。如果您正苦于以下问题:C# RequestContext类的具体用法?C# RequestContext怎么用?C# RequestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestContext类属于命名空间,在下文中一共展示了RequestContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MainAsync
private static async void MainAsync(string cachePath, double zoomLevel)
{
var browserSettings = new BrowserSettings();
var requestContextSettings = new RequestContextSettings { CachePath = cachePath };
// RequestContext can be shared between browser instances and allows for custom settings
// e.g. CachePath
using(var requestContext = new RequestContext(requestContextSettings))
using (var browser = new ChromiumWebBrowser(TestUrl, browserSettings, requestContext))
{
if (zoomLevel > 1)
{
browser.FrameLoadStart += (s, argsi) =>
{
var b = (ChromiumWebBrowser)s;
if (argsi.Frame.IsMain)
{
b.SetZoomLevel(zoomLevel);
}
};
}
await LoadPageAsync(browser);
// Wait for the screenshot to be taken.
await browser.ScreenshotAsync().ContinueWith(DisplayBitmap);
await LoadPageAsync(browser, "http://github.com");
// Wait for the screenshot to be taken.
await browser.ScreenshotAsync().ContinueWith(DisplayBitmap);
}
}
开发者ID:NumbersInternational,项目名称:CefSharp,代码行数:32,代码来源:Program.cs
示例2: execute
public override V3Message execute(Request message, RequestContext context)
{
Object returnValue = null;
#if(FULL_BUILD)
if (body.body == null)
body.body = new object[0];
else if (!body.body.GetType().IsArray)
body.body = new object[] { body.body };
try
{
if (Registry.ServiceRegistry.GetMapping(destination).Equals("*"))
destination = source;
ThreadContext.getProperties()[ORBConstants.REQUEST_HEADERS] = headers;
ThreadContext.getProperties()[ORBConstants.CLIENT_ID] = clientId;
returnValue = Invoker.handleInvoke( message, destination, operation, (Object[])( (Object[])body.body )[0], context );
}
catch (Exception exception)
{
return new ErrMessage(messageId, exception);
}
#endif
return new AckMessage(messageId, clientId, returnValue);
}
开发者ID:Georotzen,项目名称:.NET-SDK-1,代码行数:26,代码来源:ReqMessage.cs
示例3: getForecast
/// <summary>
/// </summary>
/// <param name="context"></param>
/// <param name="model"></param>
/// <returns></returns>
public StatusCode getForecast(
RequestContext context,
WeatherStationModel model
)
{
return StatusCodes.BadNotImplemented;
}
开发者ID:KTraczyk,项目名称:OPCServer,代码行数:12,代码来源:WeatherStationTypeMethods.cs
示例4: GetAllRequests
public ActionResult GetAllRequests(int?page)
{
int pageSize = 5;
int pageNumber = (page ?? 1);
var colection = new RequestContext().Requests.OrderByDescending(x => x.InitialDate);
return View(colection.ToPagedList(pageNumber, pageSize));
}
开发者ID:gitsbeginner,项目名称:ElectronicGoods,代码行数:7,代码来源:RequestController.cs
示例5: GetControllerInstance
protected override IController GetControllerInstance(
RequestContext requestContext, Type controllerType)
{
try
{
if (controllerType == null)
return base.GetControllerInstance(requestContext, null);
var controller = funqBuilder.CreateInstance(controllerType) as IController;
return controller ?? base.GetControllerInstance(requestContext, controllerType);
}
catch (HttpException ex)
{
if (ex.GetHttpCode() == 404)
{
try
{
if (ServiceStackController.CatchAllController != null)
{
return ServiceStackController.CatchAllController(requestContext);
}
}
catch { } //ignore not found CatchAllController
}
throw;
}
}
开发者ID:vosen,项目名称:Madarame,代码行数:28,代码来源:GlobalFunqControllerFactory.cs
示例6: Authenticate
public override void Authenticate(RequestContext<AuthenticateRequest, AuthenticateResponse> requestContext)
{
SslConnection connection = _context.Connection as SslConnection;
X509Certificate cert = connection.ClientCertificate;
string certHashString = cert.GetCertHashString();
foreach(User user in ServerContext.AccessControlList.Users)
{
SslAuthenticationParameters auth = (SslAuthenticationParameters)user.GetAuthentication("ssl_auth");
if(auth != null && auth.CertificateHash.Equals(certHashString))
{
ServerContext.ServerAuthenticationContext.AuthenticatedPermissionMember = user;
AuthenticateResponse response = requestContext.CreateResponse();
response.Succeeded = true;
response.Execute();
return;
}
}
_log.WarnFormat("Could not find user associated with certificate '{0}'", certHashString);
AuthenticateResponse errorResponse = requestContext.CreateResponse();
errorResponse.Succeeded = false;
errorResponse.CustomErrorMessage = "No client associated with specified certificate!";
errorResponse.Execute();
}
开发者ID:deveck,项目名称:doTSS,代码行数:29,代码来源:SslAuthentication.cs
示例7: MetricsServices
public MetricsServices(RequestContext c,
SearchQueryRepository queries
)
{
context = c;
this.SearchQueries = queries;
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:7,代码来源:MetricsServices.cs
示例8: FindView
public async Task<ViewEngineResult> FindView(RequestContext requestContext, string viewName)
{
var actionDescriptor = _actionDescriptorProvider.CreateDescriptor(requestContext) as ControllerBasedActionDescriptor;
if (actionDescriptor == null)
{
return null;
}
if (String.IsNullOrEmpty(viewName))
{
viewName = actionDescriptor.ActionName;
}
string controllerName = actionDescriptor.ControllerName;
var searchedLocations = new List<string>(_viewLocationFormats.Length);
for (int i = 0; i < _viewLocationFormats.Length; i++)
{
string path = String.Format(CultureInfo.InvariantCulture, _viewLocationFormats[i], viewName, controllerName);
IView view = await _virtualPathFactory.CreateInstance(path);
if (view != null)
{
return ViewEngineResult.Found(view);
}
searchedLocations.Add(path);
}
return ViewEngineResult.NotFound(searchedLocations);
}
开发者ID:464884492,项目名称:Mvc,代码行数:28,代码来源:RazorViewEngine.cs
示例9: InstantiateForMemory
public static MetricsServices InstantiateForMemory(RequestContext c)
{
return new MetricsServices(c,
SearchQueryRepository.InstantiateForMemory(c)
);
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:7,代码来源:MetricsServices.cs
示例10: CanAddItemToOrderAndCalculate
public void CanAddItemToOrderAndCalculate()
{
RequestContext c = new RequestContext();
MerchantTribeApplication app = MerchantTribeApplication.InstantiateForMemory(c);
c.CurrentStore = new Accounts.Store();
c.CurrentStore.Id = 1;
Order target = new Order();
LineItem li = new LineItem() { BasePricePerItem = 19.99m,
ProductName = "Sample Product",
ProductSku = "ABC123",
Quantity = 2 };
target.Items.Add(li);
app.CalculateOrder(target);
Assert.AreEqual(39.98m, target.TotalOrderBeforeDiscounts, "SubTotal was Incorrect");
Assert.AreEqual(39.98m, target.TotalGrand, "Grand Total was incorrect");
bool upsertResult = app.OrderServices.Orders.Upsert(target);
Assert.IsTrue(upsertResult, "Order Upsert Failed");
Assert.AreEqual(c.CurrentStore.Id, target.StoreId, "Order store ID was not set correctly");
Assert.AreNotEqual(string.Empty, target.bvin, "Order failed to get a bvin");
Assert.AreEqual(1, target.Items.Count, "Item count should be one");
Assert.AreEqual(target.bvin, target.Items[0].OrderBvin, "Line item didn't receive order bvin");
Assert.AreEqual(target.StoreId, target.Items[0].StoreId, "Line item didn't recieve storeid");
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:27,代码来源:OrderTest.cs
示例11: InstantiateForMemory
public static ScheduleService InstantiateForMemory(RequestContext c)
{
return new ScheduleService(c,
QueuedTaskRepository.InstantiateForMemory(c)
);
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:7,代码来源:ScheduleService.cs
示例12: SetsMetaHeaders
public void SetsMetaHeaders()
{
var request = new RequestContext(HttpMethods.Get, Enumerable.Empty<KeyValuePair<string, object>>());
request.Prepare();
Assert.AreEqual("dotnet", request.Request.Headers["X-Mashape-Language"]);
Assert.AreEqual("0.1", request.Request.Headers["X-Mashape-Version"]);
}
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:7,代码来源:Prepare.cs
示例13: OnExecute
/// <summary>
/// Called when [execute].
/// </summary>
/// <param name="context">The context.</param>
/// <returns>Base return container</returns>
public override BaseReturnContainer OnExecute(RequestContext context)
{
GetUserTagsRequestContainer requestContainer = context.InParam as GetUserTagsRequestContainer;
GetUserTagsReturnContainer returnContainer = new GetUserTagsReturnContainer();
ISqlProvider sqlProvider = (ISqlProvider)ProviderFactory.Instance.CreateProvider<ISqlProvider>(requestContainer.ProviderName);
Dictionary<string, object> parameters = new Dictionary<string, object>() { { "@userId", requestContainer.UserId }, { "@deleted", false } };
DataSet returnedData = sqlProvider.ExecuteQuery(SqlQueries.GetUserProfileQuery, parameters);
if (returnedData.Tables.Count > 0 && returnedData.Tables[0].Rows.Count == 1)
{
DataRow row = returnedData.Tables[0].Rows[0];
returnContainer.Tags = row["Tags"].ToString().Split(new string[] { Constants.QuerySeparator }, StringSplitOptions.RemoveEmptyEntries).ToList<string>();
double tempDouble;
double.TryParse(row["AreaOfService"].ToString(), out tempDouble);
returnContainer.AreaOfService = tempDouble;
returnContainer.ReturnCode = ReturnCodes.C101;
}
else
{
// User does not exist
returnContainer.ReturnCode = ReturnCodes.C001;
}
return returnContainer;
}
开发者ID:karlbuhariwala,项目名称:ServiceMeRestService,代码行数:30,代码来源:GetUserTagsCommand.cs
示例14: HandleInitializeRequest
protected async Task HandleInitializeRequest(
InitializeRequest initializeParams,
RequestContext<InitializeResult> requestContext)
{
// Grab the workspace path from the parameters
editorSession.Workspace.WorkspacePath = initializeParams.RootPath;
await requestContext.SendResult(
new InitializeResult
{
Capabilities = new ServerCapabilities
{
TextDocumentSync = TextDocumentSyncKind.Incremental,
DefinitionProvider = true,
ReferencesProvider = true,
DocumentHighlightProvider = true,
DocumentSymbolProvider = true,
WorkspaceSymbolProvider = true,
HoverProvider = true,
CompletionProvider = new CompletionOptions
{
ResolveProvider = true,
TriggerCharacters = new string[] { ".", "-", ":", "\\" }
},
SignatureHelpProvider = new SignatureHelpOptions
{
TriggerCharacters = new string[] { " " } // TODO: Other characters here?
}
}
});
}
开发者ID:Bjakes1950,项目名称:PowerShellEditorServices,代码行数:31,代码来源:LanguageServer.cs
示例15: ChromiumWebBrowser
/// <summary>
/// Create a new OffScreen Chromium Browser
/// </summary>
/// <param name="address">Initial address (url) to load</param>
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
/// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
/// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
/// <param name="blendPopup">Should the popup be blended in the background in the rendering</param>
/// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
BitmapFactory = new BitmapFactory(BitmapLock);
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
BrowserSettings = browserSettings ?? new BrowserSettings();
RequestContext = requestContext;
Cef.AddDisposable(this);
Address = address;
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
if (automaticallyCreateBrowser)
{
CreateBrowser(IntPtr.Zero);
}
popupPosition = new Point();
popupSize = new Size();
}
开发者ID:yuang1516,项目名称:CefSharp,代码行数:36,代码来源:ChromiumWebBrowser.cs
示例16: BusinessObjectsPropertiesRenderForeignKeyConstructorForDbContext
public BusinessObjectsPropertiesRenderForeignKeyConstructorForDbContext(MyMeta.ITable table, RequestContext context)
{
this._context = context;
this._table = table;
this._script = context.ScriptSettings;
this._output = context.Zeus.Output;
}
开发者ID:kahanu,项目名称:CondorXE,代码行数:7,代码来源:BusinessObjectsPropertiesRenderForeignKeyConstructorForDbContext.cs
示例17: InstantiateForDatabase
public static MembershipServices InstantiateForDatabase(RequestContext c)
{
return new MembershipServices(c,
UserQuestionRepository.InstantiateForDatabase(c),
CustomerAccountRepository.InstantiateForDatabase(c)
);
}
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:7,代码来源:MembershipServices.cs
示例18: Render
public override Task Render(RequestContext ctx, StringWriter stream, IDummy authObj)
{
#if MONO
AddResource(new JsResource(Constants.kWebRoot, "/js/faqPageCompiled.js", true));
#endif
// render head
base.Render(ctx, stream, authObj);
using (new DivContainer(stream, [email protected], "jumbotron clearfix"))
{
using (new DivContainer(stream, [email protected], "container"))
{
using (new DivContainer(stream, [email protected], "row"))
{
using (new DivContainer(stream, [email protected], "col-xs-12"))
{
BaseComponent.SPAN(stream, "Maintenance", [email protected], "noTopMargin h1");
P("Metaexchange is currently in maintenance mode, please check back soon.");
}
}
}
}
return null;
}
开发者ID:sfinder,项目名称:metaexchange,代码行数:26,代码来源:Maintenance.cs
示例19: HandleLaunchRequest
protected async Task HandleLaunchRequest(
LaunchRequestArguments launchParams,
RequestContext<object> requestContext)
{
// Execute the given PowerShell script and send the response.
// Note that we aren't waiting for execution to complete here
// because the debugger could stop while the script executes.
Task executeTask =
editorSession.PowerShellContext
.ExecuteScriptAtPath(launchParams.Program)
.ContinueWith(
async (t) =>
{
Logger.Write(LogLevel.Verbose, "Execution completed, terminating...");
await requestContext.SendEvent(
TerminatedEvent.Type,
null);
// Stop the server
this.Stop();
});
await requestContext.SendResult(null);
}
开发者ID:Bjakes1950,项目名称:PowerShellEditorServices,代码行数:25,代码来源:DebugAdapter.cs
示例20: ProcessRedirect
/// <summary>
/// Redirects to another page.
/// </summary>
/// <param name="context"></param>
/// <param name="action"></param>
/// <returns></returns>
private ProcessingResult ProcessRedirect(RequestContext context, IActionResult action)
{
var redirect = (Redirect) action;
context.Response.Status = HttpStatusCode.Redirect;
context.Response.Add(new StringHeader("Location", redirect.Location));
return ProcessingResult.SendResponse;
}
开发者ID:davidsiaw,项目名称:bunnyblogger,代码行数:13,代码来源:BuiltinActions.cs
注:本文中的RequestContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论