小编And*_*era的帖子

Xamarin:找不到与给定名称匹配的资源(AppCompat)

我在Azure上部署了一个虚拟机.我已经安装了Visual Studio 2015,Xamarin和其他移动开发工具.我在本地计算机上进行了相同的设置,以便从Visual Studio在我的设备上测试我的应用程序

唯一的区别是安装Android SDK.在我的本地机器上,我没有图像系统.

Android DSK Manager

我在我的虚拟机上开发了一个应用程序.编译期间我没有错误.我使用Android.Support.Design,Android.Support.V4,Android.Support.V7.AppCompat,Android.Support.V7.RecyclerView(来自NuGet的最新版本)及其MvvmCross实现.

我的Azure虚拟机

我想继续在我的本地计算机上开发应用程序.NuGet包正确恢复.

当我构建应用程序时,我有一些错误:

我的本地机器

Error       Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       Error retrieving parent for item: No resource found that matches the given name 'Base.Widget.AppCompat.Button'. Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'buttonStyle'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'colorAccent'.  Novatech.Droid  D:\Sources\Novatech\Novatech.Droid\Resources\values\styles.xml
Error       No resource found that matches the given name: attr 'colorPrimary'. …
Run Code Online (Sandbox Code Playgroud)

android xamarin android-support-library

16
推荐指数
3
解决办法
3万
查看次数

使用参数转换器并根据文化进行 Asp.Net Core 路由

我想根据 Web 应用程序的文化自定义路由,以获得“友好”的 url(以优化 SEO)。例如,对于名为“FirstItemController”的控制器和名为“TheIndexView”的视图:

  • www.myapp.com/fr/mon-premier-element/la-vue-index
  • www.myapp.com/en/my-first-item/the-index-view
  • www.myapp.com/es/mi-primer-elemento/la-vista-index

Asp.Net Core 2.2 将参数转换器的概念引入路由(https://blogs.msdn.microsoft.com/webdev/2018/10/17/asp-net-core-2-2-0-preview3-now-可用/ + https://www.hanselman.com/blog/ASPNETCore22ParameterTransformersForCleanURLGenerationAndSlugsInRazorPagesOrMVC.aspx )

我知道,这些文章是为 2.2.0 预览版 3 编写的。

目前,我已经创建了该类SlugifyParameterTransformer并将其注册在AddMvcoptions 中:

public class SlugifyParameterTransformer : IOutboundParameterTransformer
{
    public string TransformOutbound(object value)
    {
        if (value == null) { return null; }

        // Slugify value
        return Regex.Replace(value.ToString(), "([a-z])([A-Z])", "$1-$2").ToLower();
    }
}
Run Code Online (Sandbox Code Playgroud)

我在路线选项中尝试了两种方法:

app.UseMvc(routes => routes.MapRoute("default", "{culture=fr}/{controller=Home}/{action=Index}/{id?}")); 
// works

// AND

app.UseMvc(routes => routes.MapRoute("default", "{culture=fr}/{controller=Home:slugify}/{action=Index:slugify}/{id?}"));
// dosn't works, I don't know where I declare "slugify" for the …
Run Code Online (Sandbox Code Playgroud)

url localization routes asp.net-core asp.net-core-2.2

5
推荐指数
0
解决办法
934
查看次数

使用 Blazor 调用 JavaScript 函数(来自外部库)

我尝试调用一个 JS 函数。JS 脚本由第三方提供。

在简单的 HTML/JS 中,我可以写:

<html>
    <head>
        <script src="myscriptA.js"></script>
        <script src="myscriptB.js"></script>
    </head>
    <body>
        <div id="foo"></div>
        <div id="bar"></div>
        <script>
            var viewer = new foo.Viewer('foo', /*other params*/);
            viewer.function1().then(() => { /*ommited code*/ }).catch((error) => { console.log(error)});
            document.getElementById('bar').addEventListener('click', event => {
                var b1 = new B('bar', /*params*/)});
                var b2 = new B('foo');
            viewer.addB(b1, b2, { click: function(e) { viewer.function2() } });
        </script>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我想用 Blazor 做同样的事情。目前,我可以myscriptA.js使用我的组件访问该文件:

Page3.razor

@page "/Page3"
@inject IJSRuntime JS
@code {
    var scriptA = await …
Run Code Online (Sandbox Code Playgroud)

javascript c# blazor blazor-webassembly

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