小编Mur*_*ilo的帖子

如何拨打C#windows universal 10中的号码

在win8你可以

using Microsoft.Phone.Tasks;
PhoneCallTask phoneCallTask = new PhoneCallTask();
phoneCallTask.PhoneNumber = "2065550123";
phoneCallTask.DisplayName = "Gage";
phoneCallTask.Show();
Run Code Online (Sandbox Code Playgroud)

但在Win 10通用应用程序中,您必须使用

Windows.ApplicationModel.Calls;
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(PhoneNumber, DisplayName);
Run Code Online (Sandbox Code Playgroud)

在msdn开发网络中有一个PhoneCallManager类 https://msdn.microsoft.com/en-us/library/windows.applicationmodel.calls.phonecallmanager.aspx

但是当我添加Windows.ApplicationModel.Calls; 我不能使用PhoneCallManager,因为没有任何callmanager ..

我激活了电话呼叫功能.

Visual Studio 2015 Windows Universal APP c#XAML谢谢

c# windows win-universal-app

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

MVC Compilation Error, using WebApplication1 in Temporary ASP.NET Files

I got this wierd error today and I can't solve it, obviously. I've created an entire ASP.NET API, which works just fine, no trouble. Now I want to add some MVC pages to the application. ASP.NET API automatically gives you one controller, (home controller) with the default asp.net page.

Now when I try to open this page, I browse to http://localhost:26264/home.

First I got the error with System.Web.MVC reference: Could not load file or assembly 'System.Web.Mvc, Version=5.2.2.0... I solved …

c# asp.net-mvc reference asp.net-web-api2

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

发布.NET Core Application时出错"无法找到路径的一部分"

我有一个非常简单的.NET Core Web应用程序(.NET Framework),使用Visual Studio 2015 Update 3创建,可以无错误地构建.

我可以使用x64配置文件在文件系统上发布.但是,当尝试使用目标运行时"win7-x86"发布时会出现以下错误:

找不到路径'c:\ Users\Developer\Documents\Visual Studio 2015\Projects\SelfHostTest\src\SelfHostTest\bin\Release \net452\win7-x86\SelfHostTest.exe'的一部分

我使用的是Windows 8.1 x64机器.我去了"配置管理器"并将"平台"从"任何CPU"更改为"x86"但是没有用.

我注意到有一个文件夹"src\SelfHost2\bin\Debug \net452\win7-x64",但我没有为x86创建一个结构.

此发布有效:

在此输入图像描述

此发布不起作用:

在此输入图像描述

这是我的project.json,以帮助别人帮助我.

{
  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.Server.WebListener": "0.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "net452": {
      "dependencies": {
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc publish asp.net-mvc-5 visual-studio-2015 asp.net-core

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

是否有 if(struct == null) 的可行替代方案?

我正在尝试检查是否已分配数组中的结构,但无法检查它或者它的数据为空。有什么方法可以检查它是否已分配吗?

结构:

    [StructLayout(LayoutKind.Explicit)]
    public struct CharInfo
    {
        [FieldOffset(0)]
        public CharUnion Char;
        [FieldOffset(2)]
        public short Attributes;
    }
Run Code Online (Sandbox Code Playgroud)

方法

    public void render(){
        for (int i = 0; i < (width * height - 1); i++) {
            if (screenBuffer[i].Char.UnicodeChar != Convert.ToChar(" ")) {
                ScreenDriver.screenBuffer[i] = screenBuffer[i];
            }
        }
       // ScreenDriver.screenBuffer = screenBuffer;
    }
Run Code Online (Sandbox Code Playgroud)

c# struct

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

更改资源文件后出现歧义错误

我有一个ASP.NET应用程序,有两种语言可供选择:默认为英语,第二选项为葡萄牙语.

一切都很好,看看第一张图片:

更改资源文件之前的资源管理器

然后,当我尝试添加或删除字符串资源时,visual studio在编译时开始给出歧义错误,如下所示:

命名空间'VolunteerGames.Web.Translations'已包含'翻译'的定义

和

'VolunteerGames.Web.Translations.Translation.ResourceManager'和'VolunteerGames.Web.Translations.Translation.ResourceManager'之间存在歧义

我注意到在更改了设计器(Translation.resx)中的资源之后,创建了一个名为Translation1.Designer.cs的新文件.它创建了另一个名为Translation的类.如果我删除这个新文件,我可以编译,但是当我尝试在我的控制器上使用时,找不到我刚刚创建的新字符串.

在此输入图像描述

我无法理解发生了什么.我在这个项目中已经工作了几个月,这一切都很好.

c# asp.net asp.net-mvc

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

我该如何重用where条件

我有一个必需的业务逻辑,应从PriceList表中获得产品价格.您可以在代码中看到查询的某些部分被重复.

我担心如何重用查询的某些部分:p.Sellers.Any(s => s.PersonId == personID)或者currentDate >= p.StartDate && currentDate <= p.EndDate例如.

var basicQuery = context.PriceList.Where(p => !p.Deleted);

// first search by product, salesman and date
var priceItem = basicQuery.FirstOrDefault(p => p.ProductId == productID && 
                                               p.Sellers.Any(s => s.PersonId == personID) &&
                                               currentDate >= p.StartDate &&
                                               currentDate <= p.EndDate);

if(priceItem != null)
   return priceItem;

priceItem = basicQuery.FirstOrDefault(p => p.ProductId == productID && 
                                           currentDate >= p.StartDate &&
                                           currentDate <= p.EndDate);

if(priceItem != null)
   return priceItem;    

priceItem …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework

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

ASP.Net MVC 5模型保留父级,但在Post中丢失子级集合

我有一个简单的亲子模型

   public class ApplicationTableAndFieldsViewModel
{
    [Key]
    [Required]
    public int ParentTableID { get; set; }
    [Required]
    public string Description { get; set; }

    public List<ApplicationTableField> ApplicationTableFields { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我将整个模型从控制器传递到视图没有问题:

        public ViewResult Edit(int parentTableID)
    {
        ApplicationTableAndFieldsViewModel applicationTable = repository.ApplicationTablesVM
                .FirstOrDefault(p => p.ParentTableID == parentTableID);
        ViewBag.FieldTypeList = repository.FieldTypes;

        IEnumerable<string> FieldTypeDrop = repository.FieldTypes;


        List<SelectListItem> selectList = new List<SelectListItem>();
        foreach (var c in FieldTypeDrop)
        {
            SelectListItem i = new SelectListItem();
            i.Text = c;
            i.Value = c;
            selectList.Add(i);
        }
        ViewBag.FieldTypeList = selectList;
        return …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc razor

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