本文整理汇总了C#中WorkContext类的典型用法代码示例。如果您正苦于以下问题:C# WorkContext类的具体用法?C# WorkContext怎么用?C# WorkContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WorkContext类属于命名空间,在下文中一共展示了WorkContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetLogOnUrl
public string GetLogOnUrl(WorkContext context)
{
var urlHelper = new UrlHelper(context.HttpContext.Request.RequestContext);
var returnUrl = context.HttpContext.Request.Url;
var redirectUrl = urlHelper.Action("RequestToken", "TwitterOAuth", new { Area = "RM.QuickLogOn.OAuth", ReturnUrl = returnUrl });
return redirectUrl;
}
示例2: DoFilterWork
protected sealed override void DoFilterWork(WorkContext work, IList<WorkFilter> filters, int thisFilterIndex)
{
if (m_BeforeMatches.Count>0)
foreach(var match in m_BeforeMatches.OrderedValues)
{
var matched = match.Make(work);
if (matched!=null)
{
DoBeforeWork(work, matched);
break;
}
}
this.InvokeNextWorker(work, filters, thisFilterIndex);
if (m_AfterMatches.Count>0)
foreach(var match in m_AfterMatches.OrderedValues)
{
var matched = match.Make(work);
if (matched!=null)
{
DoAfterWork(work, matched);
break;
}
}
}
示例3: DataMigrationNotificationProvider
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager, WorkContext workContext)
{
_dataMigrationManager = dataMigrationManager;
_workContext = workContext;
T = NullLocalizer.Instance;
}
示例4: MissingSettingsBanner
public MissingSettingsBanner(IOrchardServices orchardServices, IWorkContextAccessor workContextAccessor)
{
_orchardServices = orchardServices;
_workContext = workContextAccessor.GetContext();
T = NullLocalizer.Instance;
}
示例5: ThemedViewResultFilter
public ThemedViewResultFilter(IThemeManager themeManager, WorkContext workContext, ILayoutAwareViewEngine layoutAwareViewEngine)
{
_themeManager = themeManager;
_workContext = workContext;
_layoutAwareViewEngine = layoutAwareViewEngine;
Logger = NullLogger.Instance;
}
示例6: GetAccessToken
public string GetAccessToken(WorkContext wc, string code, string returnUrl)
{
try
{
var part = wc.CurrentSite.As<FacebookSettingsPart>();
var clientId = part.ClientId;
var clientSecret = _oauthHelper.Decrypt(part.Record.EncryptedClientSecret);
var urlHelper = new UrlHelper(wc.HttpContext.Request.RequestContext);
var redirectUrl =
new Uri(wc.HttpContext.Request.Url,
urlHelper.Action("Auth", "FacebookOAuth", new { Area = "RM.QuickLogOn.OAuth" })).ToString();//, returnUrl = returnUrl
var url = string.Format(TokenRequestUrl, urlHelper.Encode(clientId), urlHelper.Encode(redirectUrl), urlHelper.Encode(clientSecret), urlHelper.Encode(code));
var wr = WebRequest.Create(url);
wr.Proxy = OAuthHelper.GetProxy();
wr.Method = "GET";
var wres = wr.GetResponse();
using (var stream = wres.GetResponseStream())
using (var sr = new StreamReader(stream))
{
var result = HttpUtility.ParseQueryString(sr.ReadToEnd());
return result["access_token"];
}
}
catch (Exception ex)
{
string error = OAuthHelper.ReadWebExceptionMessage(ex);
Logger.Error(ex, string.IsNullOrEmpty(error) ? ex.Message : error);
}
return null;
}
示例7: ProfilerFilter
public ProfilerFilter(WorkContext workContext, IAuthorizer authorizer, IShapeFactory shapeFactory, IProfilerService profiler)
{
this.workContext = workContext;
this.shapeFactory = shapeFactory;
this.authorizer = authorizer;
this.profiler = profiler;
}
示例8: LayoutAwareViewEngine
public LayoutAwareViewEngine(IThemeAwareViewEngine themeAwareViewEngine, WorkContext workContext, IDisplayHelperFactory displayHelperFactory)
{
_themeAwareViewEngine = themeAwareViewEngine;
_workContext = workContext.AsMvcWorkContext();
_displayHelperFactory = displayHelperFactory;
Logger = NullLogger.Instance;
}
示例9: TemplatesFilter
public TemplatesFilter(
WorkContext workContext,
IAuthorizer authorizer,
IShapeFactory shapeFactory) {
_workContext = workContext;
_authorizer = authorizer;
_shapeFactory = shapeFactory;
}
示例10: AdminCultureSelectorFactory
public AdminCultureSelectorFactory(
IWorkContextAccessor workContextAccessor,
IShapeFactory shapeFactory,
ICultureManager cultureManager) {
_cultureManager = cultureManager;
_workContext = workContextAccessor.GetContext();
Shape = shapeFactory;
}
示例11: DoAfterWork
protected override void DoAfterWork(WorkContext work, JSONDataMap matched)
{
var txt = matched[VAR_ERROR].AsString();
if (txt.IsNotNullOrWhiteSpace())
throw new WaveException(txt);
else
work.Aborted = true;
}
示例12: SetAuthenticatedUserForRequest
public bool SetAuthenticatedUserForRequest(HttpRequestMessage request, WorkContext workContext)
{
var membershipService = workContext.Resolve<IMembershipService>();
var authenticationService = workContext.Resolve<IAuthenticationService>();
var credentials = this.GetCredentials(request.Headers.Authorization);
var user = this.GetUserForCredentials(credentials, membershipService);
return this.SetAuthenticatedUserForRequest(user, authenticationService);
}
示例13: GetLogOnUrl
public string GetLogOnUrl(WorkContext context)
{
var urlHelper = new UrlHelper(context.HttpContext.Request.RequestContext);
var part = context.CurrentSite.As<FacebookSettingsPart>();
var clientId = part.ClientId;
var returnUrl = context.HttpContext.Request.Url;
var redirectUrl = new Uri(returnUrl, urlHelper.Action("Auth", "FacebookOAuth", new { Area = "RM.QuickLogOn.OAuth" })).ToString();//, returnUrl = returnUrl
return string.Format(Url, clientId, urlHelper.Encode(redirectUrl), urlHelper.Encode(returnUrl.ToString()));
}
示例14: DoBeforeWork
protected override void DoBeforeWork(WorkContext work, JSONDataMap matched)
{
work.Log(
matched[VAR_TYPE].AsEnum<MessageType>(MessageType.Info),
matched[VAR_TEXT].AsString(work.About),
matched[VAR_FROM].AsString("{0}.Before".Args(GetType().FullName)),
pars: matched.ToJSON(JSONWritingOptions.CompactASCII)
);
}
示例15: InlineShapeFactory
public InlineShapeFactory(IAuthorizer authorizer,
IWorkContextAccessor workContextAccessor,
IShapeTableManager shapeTableManager,
IThemeManager themeManager) {
_authorizer = authorizer;
_shapeTableManager = shapeTableManager;
_themeManager = themeManager;
_workContext = workContextAccessor.GetContext();
}