小编Lui*_*cia的帖子

如何将XAML用户控件放在网格中

我有以下main.xaml和usercontrol.

我需要在网格的第二行,第二列上放置几次用户控件,通过使用visual studio它不会允许拖放用户控件,所以我想我必须通过代码来完成,我只是不知道怎么样

MainPage.xaml中

<Grid HorizontalAlignment="Left" Height="768" VerticalAlignment="Top" Width="1366" x:Name="grid" Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="150"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="250"/>
        </Grid.ColumnDefinitions>
        <Border BorderBrush="White" BorderThickness="3" Grid.Column="1" Background="Red" CornerRadius="30"/>
        <TextBlock x:Name="txtCountry" Grid.Column="1" TextWrapping="Wrap"  FontSize="36" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        <TextBlock x:Name="txtTime" Grid.Row="1" TextWrapping="Wrap" FontSize="180" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Grid>
Run Code Online (Sandbox Code Playgroud)

用户控件

<UserControl
    x:Class="AlarmPro.TimeOnCity"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AlarmPro"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="150"
    d:DesignWidth="250">

    <Grid Background="Black">
        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Border BorderBrush="#FFDE6A6A" BorderThickness="1" Grid.Row="0" Grid.Column="0" Background="#FFDC4646">
            <TextBlock TextWrapping="Wrap" Text="TextBlock" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16"/>
        </Border>
        <Border BorderBrush="Black" BorderThickness="1" Grid.Row="1" Background="#FFAE4F00">
            <TextBlock TextWrapping="Wrap" …
Run Code Online (Sandbox Code Playgroud)

c# xaml microsoft-metro windows-8 windows-runtime

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

错误.在新的asp.net mvc4错误处理您的请求时发生错误,找不到sql server?

我创建了一个新的asp.net mvc4应用程序.我创建了一个控制器聊天和一个查看聊天.

 public class ChatController : Controller
    {
        //
        // GET: /Chat/

        public ActionResult Index()
        {
            return View();
        }

    }
Run Code Online (Sandbox Code Playgroud)

我不会粘贴聊天视图,因为我不认为它与错误无关.

在LoginPartial.cshtml中我有这个:

@if (Request.IsAuthenticated) {
    <text>
        Hello, @Html.ActionLink(User.Identity.Name, "Manage", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Manage" })!
        @Html.ActionLink("Dashboard", "Index", "Dashboard", routeValues: null, htmlAttributes: new { id = "dashboard" })
        @Html.ActionLink("Chat", "Index", "Chat", routeValues: null, htmlAttributes: new { id = "chat" })

        @using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm" })) {
            @Html.AntiForgeryToken()
            <a href="javascript:document.getElementById('logoutForm').submit()">Log …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-4

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

无法连接到redis服务器; 要创建断开连接的多路复用器,请禁用AbortOnConnectFail.PING上的SocketFailure

我试图做一个从azure redis缓存读取和写入的简单示例,我得到这个错误

StackExchange.Redis.dll中出现"StackExchange.Redis.RedisConnectionException"类型的异常,但未在用户代码中处理

附加信息:无法连接到redis服务器; 要创建断开连接的多路复用器,请禁用AbortOnConnectFail.PING上的SocketFailure

我正在使用的代码就是这个,我更改了dns和密码

// Get Connection instance
ConnectionMultiplexer connection = ConnectionMultiplexer
    .Connect("xx.redis.cache.windows.net,ssl=false,password=...");
// Get database
IDatabase databaseCache = connection.GetDatabase();
// Add items
databaseCache.StringSet("foo1", "1");
databaseCache.StringSet("foo2", "2");
// Add items with experation value
databaseCache.StringSet("foo3", "3", TimeSpan.FromMinutes(20));

Stopwatch sw = new Stopwatch();

sw.Start();

// Get item value
string foo1Value = databaseCache.StringGet("foo1");

sw.Stop();

Console.WriteLine("Elapsed={0}", sw.Elapsed);
return View();
Run Code Online (Sandbox Code Playgroud)

c# asp.net azure redis stackexchange.redis

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

Aurelia app"Hello World"根本不工作

我正在创建一个Sharepoint框架webpart,我正在尝试使用Aurelia作为我的JavaScript框架.

基本上我创建了一个Sharepoint框架webpart,当它与Yeoman一起创建时,创建了这个文件夹结构.

然后我的文件(只是一个简单的问候世界):

app.html

<template>
  ${message}
</template>
Run Code Online (Sandbox Code Playgroud)

app.js

export class App {
  message = 'hello world';
}
Run Code Online (Sandbox Code Playgroud)

main.ts

import {Aurelia} from 'aurelia-framework';

export function configure(aurelia) {
  aurelia.use
    .standardConfiguration()
    .developmentLogging();

  aurelia.start().then(a => a.setRoot());
}
Run Code Online (Sandbox Code Playgroud)

的index.html

 <div aurelia-app>
    <h1>Loading...</h1>
    <h2> ftw </h2>
    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
      System.import('aurelia-bootstrapper');
    </script>

  </div>
Run Code Online (Sandbox Code Playgroud)

和helloworld webpart:

import {
  BaseClientSideWebPart,
  IPropertyPaneSettings,
  IWebPartContext,
  PropertyPaneTextField
} from '@microsoft/sp-client-preview';

import styles from './HelloWorld.module.scss';
import * as strings from 'helloWorldStrings';
import { IHelloWorldWebPartProps } from './IHelloWorldWebPartProps';
import { configure …
Run Code Online (Sandbox Code Playgroud)

javascript sharepoint node.js typescript aurelia

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

如何在mac os上执行.net核心控制台应用程序

我刚安装了Visual Studio for MAC,并在底部窗口(应用程序输出)按下播放时创建了hello world console应用程序,我可以看到hello world.

但是,如何从命令/终端线执行该应用程序?

如果我尝试./myapp.dll,即使在sudo su之后我也被拒绝了.

所以,不知道如何运行它

这是我的json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0"
        }
      }
    }
  },
  "runtimes": {
    "win10-x64": {},
    "osx.10.10-x64": {}
  }
}
Run Code Online (Sandbox Code Playgroud)

更新

我已经运行了dotnet restore和dotnetrun,首先我得到了这个错误:无法找到与其中一个目标运行时兼容的框架'.NETCoreApp,Version = v1.0'的运行时目标:'osx.10.12-x64'.可能的原因:

然后我像这样改变了我的project.json:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable",
    "emitEntryPoint": true
  },
  "dependencies": {},
  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0"
        }
      }
    }
  },
  "runtimes": { …
Run Code Online (Sandbox Code Playgroud)

c# macos .net-core asp.net-core

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

无法加载文件或程序集'Microsoft.IdentityModel.Protocols.WsFederation,

我在startup.cs上添加了装配线后才出现此错误

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartupAttribute(typeof(InnovationInABoxWebApi.App_Start.Startup))]
namespace InnovationInABoxWebApi.App_Start
{
    public partial class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            ConfigureAuth(app);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

这是package.json

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
  <package id="bootstrap" version="3.0.0" targetFramework="net45" />
  <package id="jQuery" version="1.10.2" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net45" />
  <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" …
Run Code Online (Sandbox Code Playgroud)

.net c# owin asp.net-identity

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

ConnectionString属性尚未初始化

我使用实体框架进行2个查询,一个接一个,第一个总是正常工作,但第二个总是返回我:ConnectionString属性尚未初始化.

如果我改变方法的顺序,同样的事情发生,第一个工作正常,第二个抛出此异常.

我在页面中使用的代码如下:

>  var count = RequestBaseBL.GetGenericResultsCount(query.QuerySql);    
> 
>                     var datatable = RequestBaseBL.GetGenericResults(query.QuerySql, 0);
Run Code Online (Sandbox Code Playgroud)

在我的DAL中

public int  GetGenericResultsCount(string strsql)
            {
                using (var connection = (SqlConnection)_context.Database.Connection)
                {
                    var adapter = new SqlDataAdapter(strsql, connection);
                    var results = new DataSet();
                    adapter.Fill(results, "Results");
                    return results.Tables["Results"].Rows.Count;
                }
            }


        public DataTable GetGenericResults(string strsql, int pageIndex)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("WITH MyPagedData as ( ");
                int indexFrom = strsql.IndexOf("from");
                sb.Append(strsql.Substring(0, indexFrom));
                sb.Append(", ");
                sb.Append("ROW_NUMBER() OVER(ORDER BY RequestBaseId DESC) as RowNum ");
                sb.Append(strsql.Substring(indexFrom));
                sb.Append(") "); …
Run Code Online (Sandbox Code Playgroud)

entity-framework

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

如何在asp.net mvc应用程序中附加APPS的sharepoint所需参数?

根据sharepoint应用程序的文档,我们需要始终附加SP主机Web URL,以便应用程序可以从主机Web获取上下文.

Sharepoint Context提供程序和令牌帮助类自动检测此查询字符串值并创建上下文.

在我的asp.net mvc sharepoint应用程序中,我有以下代码:

 public ActionResult InstallDesignPackage()
{
    // Use TokenHelper to get the client context and Title property.
    // To access other properties, the app may need to request permissions
    // on the host web.
    var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
    // Publishing feature GUID to use the infrastructure for publishing
    Guid PublishingFeature = Guid.Parse("f6924d36-2fa8-4f0b-b16d-06b7250180fa");
    // The site-relative URL of the design package to install.
    // This sandbox design package should be uploaded to a document library
    // …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc sharepoint sharepoint-apps

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

VS30063:您无权访问

我刚刚将tfs 2013移到了新服务器上,还升级到了tfs 2015 update 1。

在我的配置项上,我收到这个奇怪的错误。

我是Project Collection Administrator,但无法正常工作,我删除了构建控制器,代理并再次创建了它们,但没有任何区别。

我什至以其他管理员的身份开始以管理员身份启动VS,但是它没有解决任何问题

TF215097:初始化构建定义\ PowerData.Comisiones \ MAIN_Comisiones的构建时发生错误:异常消息:发生一个或多个错误。(类型AggregateException)异常堆栈跟踪:在1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.TeamFoundation.Build.Client.FileContainerHelper.GetFile(TfsTeamProjectCollection projectCollection, String itemPath, Stream outputStream) at Microsoft.TeamFoundation.Build.Client.FileContainerHelper.GetFileAsString(TfsTeamProjectCollection projectCollection, String itemPath) at Microsoft.TeamFoundation.Build.Client.ProcessTemplate.Download(String sourceGetVersion) at Microsoft.TeamFoundation.Build.Hosting.BuildControllerWorkflowManager.PrepareRequestForBuild(WorkflowManagerActivity activity, IBuildDetail build, WorkflowRequest request, IDictionaryMicrosoft.TeamFoundation.Build.Hosting.BuildWorkflowManager.TryStartWorkflow(WorkflowRequest请求,WorkflowManagerActivity活动,BuildWorkflowInstance&工作流实例,Exception&错误,Boolean&syncLockTaken)处的System.Threading.Tasks.Task 2 dataContext) :异常消息:VS30063:您无权访问http:// myserver:8080。(类型为VssUnauthorizedException)异常堆栈跟踪:在Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.d__17.MoveNext()---从上次引发异常的位置开始的堆栈跟踪---在System.Runtime.CompilerServices.TaskAwaiter。 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)位于System.Runtime.CompilerServices.ConfiguredTaskAwaitable处的1.ConfiguredTaskAwaiter.GetResult() at Microsoft.VisualStudio.Services.WebApi.VssHttpRetryMessageHandler.<SendAsync>d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitableThrowForNonSuccess(任务任务)1.Microsoft.VisualStudio.Services.WebApi.HttpClientExtensions.d(d3)上的ConfiguredTaskAwaiter.GetResult()

tfs

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

找不到模块:错误:无法解析模块'fs'

我正在尝试集成ADAL JS示例代码:

https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/sample/client-credentials-sample.js

进入sharepoint框架客户端webpart:

我的代码非常简单,我已经安装了NPM,adal,fs,node-fs等.

However I see this error

./~/adal-node/lib/util.js
Module not found: Error: Cannot resolve module 'fs' in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib
resolve module fs in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib
  looking for modules in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib
    /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib/fs doesn't exist (module as directory)
    resolve 'file' fs in /Users/luis.valencia/Documents/GraphSamples/Sample1/node_modules/adal-node/lib
      resolve file
Run Code Online (Sandbox Code Playgroud)

我的代码是这样的:

我甚至评论了需要JS系列,但它看起来像adal js库本身使用的FS似乎没有正确安装?

import {
  BaseClientSideWebPart,
  IPropertyPaneSettings,
  IWebPartContext,
  PropertyPaneTextField
} from '@microsoft/sp-client-preview';

import styles from './Hellomsgraph.module.scss';
import * as strings from 'hellomsgraphStrings';
import { IHellomsgraphWebPartProps } from './IHellomsgraphWebPartProps';
import * as MicrosoftGraph from "microsoft-graph"

const accessToken:string …
Run Code Online (Sandbox Code Playgroud)

javascript node.js typescript adal adal.js

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