小编gar*_*daz的帖子

C#/ XAML编译错误 - 各种错误(名称"LayoutAwarePage"不存在")

编辑:

以下是代码的pastebins:

BasicPage1.xaml.cs

BasicPage1.xaml

LayoutAwarePage.cs

编辑2

我在这里添加了一个MS Connect票证:

https://connect.microsoft.com/VisualStudio/feedback/details/771648/c-xaml-compile-error-various-errors-the-name-layoutawarepage-does-not-exist#tabs

我正希望其他人经历并且知道如何解决,因为我对整个事件感到有些沮丧.

问题

我一直在使用C#/ XAML开发Windows应用商店来学习绳索.花了几个小时学习后,我决定开始自己的应用程序,这很好.问题是,在添加一些视图等之后,我开始在我的XAML文件中收到以下错误(所有这些):

错误5名称"LayoutAwarePage"在命名空间"using:Accountable.Common"中不存在.G:\ Coding Projects\Visual Studio 2012\SAVED\Accountable\Accountable\BasicPage1.xaml 1 1 Accountable

这很奇怪,因为Accountable.Common是在XAML文件中声明的:

<common:LayoutAwarePage
x:Name="pageRoot"
x:Class="Accountable.BasicPage1"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Accountable"
xmlns:common="using:Accountable.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Run Code Online (Sandbox Code Playgroud)

所以我在这里读到关闭XAML文件并关闭Visual Studio 2012并重新打开,再加上Building,解决了这个问题.它没有.现在,它会在您首次创建新模板时创建的公共文件中导致以下错误:

错误1'Fortable.Common.BooleanNegationConverter'未实现接口成员'Windows.UI.Xaml.Data.IValueConverter.ConvertBack(object,System.Type,object,string)'G:\ Coding Projects\Visual Studio 2012\SAVED\Accountable\Accountable\Common\BooleanNegationConverter.cs 9 25负责任

错误2'Fortable.Common.BooleanNegationConverter'未实现接口成员'Windows.UI.Xaml.Data.IValueConverter.Convert(object,System.Type,object,string)'G:\ Coding Projects\Visual Studio 2012\SAVED\Accountable\Accountable\Common\BooleanNegationConverter.cs 9 25负责任

错误3'Qerffable.Common.BooleanToVisibilityConverter'未实现接口成员'Windows.UI.Xaml.Data.IValueConverter.ConvertBack(object,System.Type,object,string)'G:\ Coding Projects\Visual Studio 2012\SAVED\Accountable\Accountable\Common\BooleanToVisibilityConverter.cs 20 25负责任

错误4'Qerffable.Common.BooleanToVisibilityConverter'未实现接口成员'Windows.UI.Xaml.Data.IValueConverter.Convert(object,System.Type,object,string)'G:\ Coding Projects\Visual Studio 2012\SAVED\Accountable\Accountable\Common\BooleanToVisibilityConverter.cs 20 25负责任

我没有更改BooleanNegationConverter.csBooleanToVisibility.cs.我做了什么来尝试解决这个问题:

  1. 调查其他SO帖子 …

c# compiler-errors winrt-xaml visual-studio-2012

8
推荐指数
1
解决办法
3340
查看次数

随机将类添加到两个div

我有一个两列红色/黑色网格50/50%和高度100%,并有一个脚本,以便在加载页面时随机化两者的外观,所以左或右.我改变了两列网格后面的代码,从相对位置开始,向右浮动到固定绝对位置.这必须做,因为在移动时这种滚动行为这种方式更好.

下面的代码在使用浮动时工作正常,它向左或向右添加一个类,使得红色侧选择随机侧,黑色自动跟随,因为它是相对于彼此的.使用绝对和固定位置更改,它必须向左侧或右侧添加一个类才能工作.有人知道如何添加这个,所以当剩下红色时,黑色是正确的,反之亦然.

// Random red & black //

window.addEventListener('load', function() {
  // This is a ternary operator, which is just a shorthand way to 
  // do an if/else statement. This basically says, if the random number
  // is less than .5, assign "left" to the scenario variable.
  // if it is greater (or equal to), assign "right" to the variable. 
  var scenario = Math.random() < .5 ? "left" : "right";

  document.querySelector(".red", ).classList.add("" + scenario);
});
Run Code Online (Sandbox Code Playgroud)
.left {
  left: 0;
} …
Run Code Online (Sandbox Code Playgroud)

html javascript css

7
推荐指数
1
解决办法
163
查看次数

使用旧解决方案将nuget包添加到.net核心项目时如何修复$(NETStandardImplicitPackageVersion)错误?

我们有一个包含很多项目的现有.NET解决方案.我最近在解决方案中添加了一个新的ASP.NET核心项目.当我尝试将Nuget包添加到解决方案时,添加失败,我在包管理器输出窗口中收到以下错误.如果我创建一个新的解决方案并将相同的项目添加到解决方案中,那么我就可以添加Nuget包,因此将新的.NET核心项目添加到现有解决方案似乎是一个问题.任何人都可以帮助我解决这个问题,而无需重新创建解决方案吗?

System.ArgumentException:'$(NETStandardImplicitPackageVersion)'不是有效的版本字符串.位于NuGet.PackageManagement的
System.Linq.Enumerable.WhereSelectEnumerableIterator 1..ctor(IEnumerable 1 source)的NuGet.PackageManagement.VisualStudio.VsManagedLanguagesProjectSystemServices.ToPackageLibraryDependency(PackageReference reference)中的NuGet.Versioning.VersionRange.Parse(String value,Boolean allowFloating).VisualStudio.VsManagedLanguagesProjectSystemServices.d__23.MoveNext()---从先前的位置在那里引发异常---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(工作任务)在System.Runtime.CompilerServices.TaskAwaiter堆栈跟踪结束. HandleNonSuccessAndDebuggerNotification(任务task)在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(工作任务) 在NuGet.PackageManagement.VisualStudio.LegacyPackageReferenceProject.d__27.MoveNext()---从先前的位置在那里引发异常堆栈跟踪的结尾--- System.Runtime.CompilerServices.TaskAwai上的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)ter.HandleNonSuccessAndDebuggerNotification(任务task)在NuGet.PackageManagement.VisualStudio.LegacyPackageReferenceProject.d__14.MoveNext()---从先前的位置堆栈跟踪,其中引发异常---在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess结束(任务任务)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(工作任务)在NuGet.PackageManagement.DependencyGraphRestoreUtility.d__6.MoveNext()---从先前的位置在那里引发异常---在System.Runtime堆栈跟踪结束. CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务task)在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(工作任务)在NuGet.PackageManagement.DependencyGraphRestoreUtility.d__2.MoveNext()---从以前的位置堆栈跟踪的结束,其中异常被抛出- - System.Runtime.CompilerServices.TaskAwaiter.HandleN上的System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)onSuccessAndDebuggerNotification(任务task)在System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(工作任务) 在NuGet.PackageManagement.NuGetPackageManager.d__75.MoveNext()---从先前的位置堆栈跟踪,其中引发异常---在系统结束.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)2.MoveNext()
at System.Collections.Generic.List
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable


.net c# asp.net-core visual-studio-2017

7
推荐指数
1
解决办法
1498
查看次数

Alexa Skill - 如何检索Lambda函数中的槽值

我正在开发一个带有一个Intent的Alexa技能,其中包含一个带有几个可能值的Slot.

我的槽与所定义"name" : "Channel","type" : "LIST_OF_CHANNELS"和值

  1. iqram
  2. 英格丽
  3. 菲尔
  4. 克莱德

如何检索要在Lambda函数中使用的发出的槽值?这是"从话语部分检索插槽的价值"我希望得到回答.非常感谢.

 // retrieve value of slot from utterance     
 var c = intent.slots.Channel.value; 

 // append value to end of URL that references API
 fetchEnseParse("/channel/" + c, function(body) {

 // continuation of this function is below 
Run Code Online (Sandbox Code Playgroud)

alexa aws-lambda alexa-skills-kit

6
推荐指数
2
解决办法
8804
查看次数

KB4344167安全更新中断了TLS代码

希望有人可以帮助解决这个问题.最近我们的机器更新了KB4344167,其中包括.NET 4.7.1的安全更新. 不幸的是,这个更新破坏了我们的代码Webrequest.当我们运行下面的代码时,我们收到此错误:

请求已中止:无法创建SSL/TLS安全通道.

// Create a request for the URL.        
WebRequest request = WebRequest.Create(url);
//specify to use TLS 1.2 as default connection
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
request.Timeout = int.Parse(configmanager.GetSetting("Webtimeout"));
// Set proxy
request.Proxy = WebRequest.DefaultWebProxy;
request.Proxy.Credentials = CredentialCache.DefaultCredentials;
// Define a cache policy for this request only. 
HttpRequestCachePolicy noCachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.NoCacheNoStore);
request.CachePolicy = noCachePolicy;
ServicePointManager.ServerCertificateValidationCallback = (s, cert, chain, ssl) => true;
// Get the response.
HttpWebResponse response …
Run Code Online (Sandbox Code Playgroud)

c# .net-4.7

6
推荐指数
1
解决办法
1294
查看次数

通用存储库/工作单元问题

我一直在学习各种来源的知识库工作单元模式,包括:

http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/implementing-the-repository-and-unit-of-work-patterns-in-an-asp-net- MVC应用程序

如果您浏览上面的thr链接到创建工作单元类,则有以下内容:

    private GenericRepository<Department> departmentRepository;
    private GenericRepository<Course> courseRepository;
Run Code Online (Sandbox Code Playgroud)

这很好,但我想继续扩展Generic的工作单元类并设置GenericRepositories的集合,这样我就可以根据我通过的模型进行动态更新.

我最终想在我的控制器中执行以下操作:

public class LedgerUserController : Controller
{
    private GenericUnitOfWork unitOfWork = new GenericUnitOfWork();
    LedgerUser ledgeruser = new LedgerUser();


    public ActionResult Index()
    {
        //var ledgerusers = db.LedgerUsers.Include(l => l.Image).Include(l => l.UserType);
        var view = unitOfWork.Repository(ledgeruser).Get(l => l.LastName == "smith");
        return View(view.ToList());
    }
}
Run Code Online (Sandbox Code Playgroud)

所以这是我的类和接口到目前为止:

IRepository.cs

/// <summary>
/// Generic Repository for CRUD Operations and methods
/// to locate entities within your store. …
Run Code Online (Sandbox Code Playgroud)

c# generics repository-pattern asp.net-mvc-4

5
推荐指数
1
解决办法
5234
查看次数

C# - 输入字符串的格式不正确

我正在开发一个简单的 Windows 窗体应用程序,用户输入带有分隔符的字符串,我解析该字符串并仅从字符串中获取变量。例如,如果用户输入:

2X + 5Y + z^3
Run Code Online (Sandbox Code Playgroud)

我从“方程”中提取值 2,5 和 3,然后将它们简单地相加。

这就是我从字符串中获取整数值的方法。

int thirdValue
string temp;
temp = Regex.Match(variables[3], @"\d+").Value
thirdValue = int.Parse(temp);
Run Code Online (Sandbox Code Playgroud)

variables只是一个字符串数组,我用来在解析后存储字符串。

但是,当我运行该应用程序时,出现以下错误:

输入字符串的格式不正确

c#

5
推荐指数
1
解决办法
2617
查看次数

从WCF客户端连接到服务器的问题 - HTTPS端点 - 适用于本地开发但不适用于服务器

更新日志:

  1. 添加了更多详细信息 - 包括WCF跟踪.

首先,不是很多WCF经验,所以如果这是一个明显的错误,请道歉.我正在编写一个简单的控制台应用程序,需要连接到第三方SOAP Web服务.供应商提供的WSDL在这里:

http://pastebin.com/LJurv0qA

我已经使用它在Visual Studio 2010(使用.NET 4.0)中创建服务引用来创建后面自动生成的代码.我还为各种配置设置了app.config:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="CompanyCustomConfig"
             type="Company.Common.CustomConfigSections.EncryptedSomethingQuiteStrangeCredentialsSection, Company.Common"
             />
    <section name="CompanyMachineConfig"
             type="Company.Common.CustomConfigSections.MachineEnvironmentKeySection, Company.Common"
             />
  </configSections>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="sessionMethodsSoap"
                 receiveTimeout="00:10:00"
                 closeTimeout="00:10:00"
                 openTimeout="00:10:00"
                 sendTimeout="00:10:00"
                 maxBufferSize="2147483647"
                 maxBufferPoolSize="2147483647"
                 maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
        </binding>
        <binding name="sessionMethodsSoap1" />
        <binding name="recipientMethodsSoap">
          <security mode="Transport">
            <!--<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>-->
          </security>
        </binding>
        <!--<binding name="recipientMethodsSoap1" />-->
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https:test.jsp"
          binding="basicHttpBinding" bindingConfiguration="sessionMethodsSoap"
          contract="Session.sessionMethodsSoap" name="sessionMethodsSoap" />
      <endpoint address="https:test.jsp"
          binding="basicHttpBinding" bindingConfiguration="recipientMethodsSoap"
          contract="Recipient.recipientMethodsSoap" name="recipientMethodsSoap"        />
    </client>
  </system.serviceModel>
  <appSettings> …
Run Code Online (Sandbox Code Playgroud)

c# wcf web-services .net-4.0 windows-server-2008-r2

5
推荐指数
1
解决办法
1059
查看次数

基于ASP.NET核心自定义策略的授权 - 不清楚

好的,ASP.NET核心中基于自定义策略的授权.我有点理解这个新的身份框架的想法,但仍然没有100%清楚你可以用这个来实现.假设我们在HomeController中有一个名为List的Action.此操作将查询并显示数据库中的产品列表.必须访问此列表的用户必须是Marketing部门的一部分.因此,在我们的政策中,我们检查用户是否有一个名为Division的声明,其值是Marketing.如果是,那么他将被允许查看列表,否则不会.我们可以像这样装饰我们的动作:

[Authorize(Policy = "ProductsAccess")]
public IActionResult List()  
{
    //do query and return the products view model
    return View();
}
Run Code Online (Sandbox Code Playgroud)

这一切都很好.它会很完美.

场景1:如果我想在产品级别添加策略,并且根据策略,用户将只看到其部门的产品,该怎么办?所以营销人员会看到他的产品,研发人员会看到他的等等.我怎样才能做到这一点?是否可以通过政策完成?如果有,怎么样?

场景2:在现场级访问怎么样?让我们说也许我想要隐藏某些字段?示例:所有产品都有某些必须对Managers可见且对其他用户隐藏的列?可以使用自定义策略完成吗?如果有,怎么样?

c# asp.net-core asp.net-core-identity

5
推荐指数
1
解决办法
561
查看次数

将嵌套的JSON对象插入MySQL

我有一个运行时在Node.js中输出如下的JSON Console.log(myjsonobject):

{
"results":
[
    "id": 'xxxxxx',
    "size": 'xxxxx',
    "data":
        [ {             
            "date": 'xxxxx',
            "age": 'xxxx',
            "grade": 'xxxxxx'       
          },

          {             
            "date": 'xxxxx',
            "age": 'xxxx',
            "grade": 'xxxxxx'       
          }
          .... // many more data again

        ]
]   
"total": 'xxxxxxx',
"group": 'xxxxxxx'
}
Run Code Online (Sandbox Code Playgroud)

我是Node.js的新手并且很难myjsonobject在MySQL数据库中插入.

mysql json node.js

5
推荐指数
1
解决办法
1535
查看次数