我有以下代码行:我在不知道值(多少度)的情况下对矩形应用了少量旋转.现在我想在2D中获得旋转或元素角度.
Rectangle element = (Rectangle)sender;
MatrixTransform xform = element.RenderTransform as MatrixTransform;
Matrix matrix = xform.Matrix;
third.Content = (Math.Atan(matrix.M21 / matrix.M22)*(180/Math.PI)).ToString();
and the matrix is like following
|M11 M12 0|
|M21 M22 0|
|dx dy 1| which is Transformation Matrix I guess !!
Run Code Online (Sandbox Code Playgroud)
这似乎不是正确的价值.我希望得到0到360度的角度
我有一个应用程序让我们将其命名为'Apple',它在Azure AD中注册,具有Azure Management API应用程序的委派权限.当请求此应用程序时,它会创建azure资源.存储帐户自动,这很好.
我有另一个应用程序是MVC应用程序,它也在同一个AD租户注册.第二个应用程序使用以下代码来检索访问令牌:
var clientCredentials = new ClientCredential(ConfigurationManager.AppSettings["AD_ClientID"], ConfigurationManager.AppSettings["AD_Client_AccessKey"]);
var authContext = new AuthenticationContext(string.Format(ConfigurationManager.AppSettings["AD_Tenant_Login_Url"], ConfigurationManager.AppSettings["AD_Tenant_Id"]));
var result = authContext.AcquireTokenAsync(ConfigurationManager.AppSettings["AD_Resource"], clientCredentials);
if (result == null)
{
throw new InvalidOperationException("Could not get the token");
}
return result.Result;
Run Code Online (Sandbox Code Playgroud)
结果是具有不同属性的访问令牌.现在第二个应用程序,通过访问资源apple来检索访问令牌,然后将其传递给授权标头中的Apple应用程序.
Authorization:bearer TokenString
Run Code Online (Sandbox Code Playgroud)
Apple应用程序将"授权"属性添加到控制器.该应用程序使用带有oauth应用程序的Owin进行配置,并带有以下代码
public void ConfigureAuth(IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
},
});
}
Run Code Online (Sandbox Code Playgroud)
请注意,使用自己的AppId和Secret密钥从第二个应用程序检索访问令牌; 而另一个(Apple)应用程序使用自己的AppId和密钥来验证令牌.
所以我的问题是,APPLE应用程序总是返回401而不是授权代码
asp.net asp.net-mvc active-directory azure azure-active-directory
我用 C# 编写了向多个用户发送邮件的代码。该电子邮件采用 HTML 格式,并包含取消订阅链接。
为了添加更多信息,我使用 SendGrid 向最终用户发送电子邮件。
我在 Gmail 中查看了原始邮件格式,并且可以在格式中看到标头
List-unsubscribe: <https..../usersettings?SubscriberId=VioR5IcgvSIosfB1w%2FCPfhpyGBdko%2BxsmFTAsQAemuWgSJkpTP1UeDg%2BW4frl59A0KVVpiK0lI7IrS3N1BCm0Sspd0dqEaJGlKHAY3g7IR3INwkyJEAmfU55TBJ8uEo%3D>
Run Code Online (Sandbox Code Playgroud)
但链接并未显示。我缺少什么?
我正在为我的应用程序实施 SSO(单点登录和单点注销)。假设我有
https://app1.test.comWtrealm相同https://app1.test.comhttps://app2.test.comWtrealm相同https://app2.test.com我已使用此博客作为在两个应用程序中实现单点登录的参考。 https://blogs.msdn.microsoft.com/sakamati/2015/07/06/creating-owin-based-ws-federation-application/
我面临的问题是单点注销。当我在一个应用程序中注销时,另一个应用程序中的会话仍然处于活动状态。
我缺少什么才能使单点注销适用于两个应用程序?
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<pkg:part pkg:name="/_rels/.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="512">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml" />
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/word/_rels/document.xml.rels" pkg:contentType="application/vnd.openxmlformats-package.relationships+xml" pkg:padding="256">
<pkg:xmlData>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image1.png" />
</Relationships>
</pkg:xmlData>
</pkg:part>
<pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<w:document mc:Ignorable="w14 w15 wp14" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<w:body>
<w:p w:rsidR="00AE3E50" w:rsidRDefault="00DE2072">
<w:r>
<w:drawing>
<wp:inline distT="0" distB="0" distL="0" distR="0">
<wp:extent cx="2194560" cy="1463040" />
<wp:docPr id="1" …Run Code Online (Sandbox Code Playgroud) 我被要求用Postgres 10.0开发我的新应用程序.在此之前,我一直在使用MsSql开发应用程序,甚至很容易.我搜索了10.0版,但没有找到任何可下载的链接.我遇到的最新版本是Postgres 9.2和9.3 beta
任何人都可以帮我找到合适的版本.我在Stackoverflow上读了几篇帖子,比如这一篇Postgres 10.0 -Arcgis,但不知道Arcgis是postgres数据库,还是与Postgres和SQL Server相同的其他数据库引擎.
我想要知道Postgres 10.0版(免费或付费)是否可用?
从2个以下的场景中,哪一个是在c#中进行异步编程的正确方法?
情景1
public async Task<T1> AddSomethingAsync(param)
{
return await SomeOtherFunctionFromThirdPartyLibraryForIOAsync(param);
}
Run Code Online (Sandbox Code Playgroud)
然后
List<Task> Tasks=new List<Task>();
foreach(var task in FromAllTasks())
{
Tasks.Add(AddSomethingAsync(task));
}
await Task.WhenAll(Tasks.AsParallel());
Run Code Online (Sandbox Code Playgroud)
方案2
public async Task<T1> AddSomethingAsync(param)
{
return SomeOtherFunctionFromThirdPartyLibraryForIOAsync(param);
}
Run Code Online (Sandbox Code Playgroud)
然后
List<Task> Tasks=new List<Task>();
foreach(var task in FromAllTasks())
{
Tasks.Add(SomeOtherFunctionFromThirdPartyLibraryForIOAsync(task));
}
await Task.WhenAll(Tasks.AsParallel());
Run Code Online (Sandbox Code Playgroud)
2之间唯一的区别是,后来没有await关键字里面的AddSomethingAsync功能.
所以这里是更新 - 我想要知道的是,所有任务应该并行和异步执行.(我的想法是在方案-1中,将在AddSomethingAsync中等待调用,并且在上层阻止下一个循环执行时会受到影响.确认