小编Zap*_*ica的帖子

我还可以在office 2013中使用Microsoft.Office.Interop程序集吗?

我不得不将一个较旧的项目(在.Net 2中)导入到Visual Studio 2013中,它使用了Microsoft Primary Interop Assemblies.

Visual Studio说我需要添加对项目的引用.现在我去做了一些阅读,显然微软只发布了2010年办公室的PIA?(我有Office 2013)

现在我想知道的是.

  1. 我可以让它与Office 2013一起使用并向后兼容吗?
  2. 如果是这样,这是一条走向未来的好途径?它会兼容吗?因为我认为你需要.Net 2(最迟)和Windows 8自带4.5而不是3(默认情况下),并且大多数新计算机都将拥有Office 2012或2013.

office-interop office-2013 visual-studio-2013

46
推荐指数
2
解决办法
7万
查看次数

将Android设备锁定到单个应用程序

我的公司正在寻找销售带有应用程序的Android设备,该设备将作为替代嵌入式设备的产品执行某项任务.

但是我们需要知道如何锁定设备只能访问我们将开发的应用程序,而无法访问正常的Android OS界面.

我想要以下内容:

  1. 当设备启动时,它必须自动加载我们的应用程序
  2. 必须没有办法退出应用程序(除非我们可能输入主密码),这将允许您访问该设备

这可能吗,怎么会这样做呢?

android kiosk-mode

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

调试时,Visual Studio网站将http重定向到https

我遇到IIS Express或Visual Studio 2013的问题.

该站点在属性中未启用或设置了https或ssl.

当我单击调试时,该站点将在broswer中启动并尝试加载: http://localhost:61488/Default.aspx

它然后由于某种原因自动重定向到: https://localhost:61488/Default.aspx 然后我得到一个Error code: ERR_SSL_PROTOCOL_ERROR

我不太清楚该怎么办?

c# asp.net https iis-express visual-studio-2013

38
推荐指数
4
解决办法
2万
查看次数

MVC 5身份自动注销

如何实现自动注销计时器.

所以基本上如果用户在x分钟内处于非活动状态,他们的会话结束了

我试过了:

<system.web> 
   <sessionState timeout="1"/>
</system.web>
Run Code Online (Sandbox Code Playgroud)

但它似乎没有用.

这是我的启动中的代码:

public void ConfigureAuth(IAppBuilder app)
{
  // Enable the application to use a cookie to store information for the signed in user
  app.UseCookieAuthentication(new CookieAuthenticationOptions
  {
      AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
      LoginPath = new PathString("/Account/Login")
   });
 }
Run Code Online (Sandbox Code Playgroud)

这说我正在使用cookie身份验证.所以,如果我能做到,我不会做什么.

asp.net-mvc asp.net-authentication owin asp.net-mvc-5 asp.net-identity

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

Android小部件onclick监听多个按钮

我正在尝试为我的应用程序创建一个小部件.从我阅读一个Android开发者网站,您的onclick听众都需要有一个Intent.但是如果我只是想让我的按钮更新小部件本身的数据并且我不想开始新活动呢?

这是一些Android演示代码:

Intent intent = new Intent(context, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);

// Get the layout for the App Widget and attach an on-click listener
// to the button
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_layout);
views.setOnClickPendingIntent(R.id.button, pendingIntent);
Run Code Online (Sandbox Code Playgroud)

我想要一个按钮,当我点击进行http网络呼叫,然后在小部件中显示结果.如果我必须使用意图,我该怎么做呢?此外,我需要能够区分单击哪些按钮.

为什么小部件使用意图而不是正常的onclick侦听器,它调用像活动这样的函数?

编辑

我的widget提供者:

public class MyWidgetProvider extends AppWidgetProvider {

private static final String MyOnClick1 = "myOnClickTag1";
private static final String MyOnClick2 = "myOnClickTag2";
private static final String MyOnClick3 = "myOnClickTag3";

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) …
Run Code Online (Sandbox Code Playgroud)

android android-widget android-intent

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

使用jquery和ajax将json对象发布到mvc控制器

我试图从表单中提交一些值到我的mvc控制器.

这是我的控制器:

 //Post/ Roles/AddUser
    [HttpPost]       
    public ActionResult AddUser(String json)
    {
        Log.submit(json);            
        return View();
    }
Run Code Online (Sandbox Code Playgroud)

这是js:

<script>
function submitForm() {

    var usersRoles = new Array;
    $("#dualSelectRoles2 option").each(function () {
        usersRoles.push($(this).val());
    });
    console.log(usersRoles);

    jQuery.ajax({
        type: 'POST',
        url: "@Url.Action("AddUser")",
        contentType: "application/json; charset=utf-8",
        datatype: 'json',
        data: JSON.stringify(usersRoles),
        success: function (data) { alert(data); },
        failure: function (errMsg) {
            alert(errMsg);
        }
    });
}
Run Code Online (Sandbox Code Playgroud)

当我在控制器上调试时,我的参数为null?该console.log(usersRoles)给我的数据.

我做错了什么?

如何在控制器中接收json对象?

javascript ajax asp.net-mvc jquery html5

24
推荐指数
2
解决办法
10万
查看次数

如何在主题中全局更改android按钮文本颜色

如何更改所有按钮的文字颜色?

我知道我可以设置背景颜色如下:

<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="colorButtonNormal">@color/buttonColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)

如何为按钮Text执行此操作?

android android-button material-design material-components material-components-android

23
推荐指数
4
解决办法
2万
查看次数

并行运行几个EntityFramework数据库查询

我试图并行运行3个db查询,但我不确定我是否正确执行.

我已经创建了3个函数,每个函数都对db进行查询.

private static async Task<string> getAccountCodeAsync(string deviceId)
{
    long deviceIdLong = long.Parse(deviceId);
    using (var db = new NetworksEntities())
    {
        return db.Devices.Where(x => x.DeviceId == deviceIdLong)
            .Select(x => x.AccountCode)
            .FirstOrDefault();
    }
}

private static async Task<string> getDeviceTypeAsync(string deviceId)
{
    long deviceIdLong = long.Parse(deviceId);
    using (var db = new NetworksEntities())
    {
        return db.Devices.Where(x => x.DeviceId == deviceIdLong)
            .Select(x => x.DeviceType)
            .FirstOrDefault()
            .DeviceType;
    }
}

private static async Task<string> getUserNameAsync(string userId)
{
    int userIdInt;
    Int32.TryParse(userId, out userIdInt);
    using (var db = new …
Run Code Online (Sandbox Code Playgroud)

c# asp.net multithreading asynchronous task-parallel-library

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

Android支持库23.2.0导致工具栏箭头变黑

我最近更新了我的Android支持库昨天到版本 23.2.0

并且所有前Lolipop设备突然将后箭头,汉堡包和(三点菜单)的颜色改为黑色.当他们总是白色的时候.

棒棒糖设备似乎很好.

这是我style.xml在更新之间根本没有编辑过的.

<?xml version="1.0" encoding="utf-8"?>
<resources>    
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/primaryColor</item>
        <item name="colorPrimaryDark">@color/primaryColorDark</item>
        <item name="colorAccent">@color/accentColor</item>
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppTheme.Base">
    </style> 

    <!-- Theme to customise the tool bar -->
    <style name="MyCustomToolBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="textColorPrimary">@color/textColorWhite</item>
    <!-- Added this now to test, still nothing --!> 
    <item name="colorControlNormal">@color/textColorWhite</item>

    </style>

    <style name="MyApp.MyCustomToolBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
        <!--to add-->
    </style>
</resources>
Run Code Online (Sandbox Code Playgroud)

然后这是我的工具栏布局

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="@dimen/toolbar_height"
    android:background="@color/primaryColor"
    app:theme="@style/MyCustomToolBarTheme"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Dark">
</android.support.v7.widget.Toolbar>
Run Code Online (Sandbox Code Playgroud)

android android-support-library android-toolbar

14
推荐指数
2
解决办法
1386
查看次数

asp.net mvc客户端验证不起作用?

出于某种原因,我的客户端验证似乎不起作用:

这是我的HTML:

@using (Html.BeginForm("Create", "Home", FormMethod.Post))
{

<hr />

@Html.ValidationSummary(true)
<hr />

<p>
    <label>Select Client_ID: </label>
    <span class="field">
        <select name="clientId" id="clientId">
            @foreach (var item in Model.ClientId)
            {
                <option value="@item">@item</option>
            }
        </select>
    </span>
</p>

<p>
    <label>@Html.LabelFor(model => model.UserModel.name)</label>
    <span class="field">
        @Html.EditorFor(model => model.UserModel.name)
    </span>
    @Html.ValidationMessageFor(model => model.UserModel.name)

</p>

<p>
    <label>@Html.LabelFor(model => model.UserModel.password)</label>
    <span class="field">
        @*<input name="password" id="password" type="password" />*@
        @Html.EditorFor(model => model.UserModel.password)
    </span>
    @Html.ValidationMessageFor(model => model.UserModel.password)
</p>

<p>
    <label>@Html.LabelFor(model => model.UserModel.email)</label>
    <span class="field">
        @*<input name="email" id="email" type="email" />*@
        @Html.EditorFor(model => model.UserModel.email) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc jquery-validate unobtrusive-validation

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