小编May*_*ank的帖子

.Net 4.5中Async/Await的简要说明

异步任务(异步/等待)如何在.Net 4.5中运行?

一些示例代码:

private async Task<bool> TestFunction()
{
  var x = await DoesSomethingExists();
  var y = await DoesSomethingElseExists();
  return y;
}
Run Code Online (Sandbox Code Playgroud)

第二个await陈述是立即执行还是在第一次await返回后执行?

c# async-await .net-4.5

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

未安装.NET Core SDK或在路径下找不到

在VS 2015下编译.Net Core RC2项目时,我收到以下错误

GETSDKTOOLINGINFO:错误:未安装.NET Core SDK或在路径C:\ Program Files\dotnet\bin下找不到.构建和运行此项目需要这些组件.

该目录下存在文件.

此外,当我将dotnet输入命令行时,我确实看到了它正确的版本号和东西.(.NET命令行工具(1.0.0-beta-001598)

知道如何解决这个问题吗?

.net-core .net-core-rc2

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

Wrap TextBlock的最大行数

我有TextBlock以下设置:

TextWrapping="Wrap"
Run Code Online (Sandbox Code Playgroud)

我可以确定最大行数吗?

例如,考虑以下字符串TextBlock.Text:

This is a very good horse under the blackboard!!
Run Code Online (Sandbox Code Playgroud)

它目前已经显示如下:

This is a very 
good horse under 
the blackboard!!
Run Code Online (Sandbox Code Playgroud)

我需要这样做:

This is a very 
good horse ...
Run Code Online (Sandbox Code Playgroud)

任何解决方案

xaml textblock microsoft-metro windows-8

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

如何在不使用Java保存到磁盘的情况下生成zip文件?

我在内存中生成了许多BufferedImages,我想将它们压缩成一个zip文件,然后再将其作为电子邮件附件发送.如何在不从磁盘读取文件的情况下将文件保存到zip文件中.

有没有办法在不创建临时文件的情况下压缩这些文件?

由于创建了数千个文件,因此写入磁盘非常耗时.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cccprog;

import java.awt.Component;
import java.awt.Panel;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JRadioButton;

/**
 *
 * @author Z
 */
public class N {

    public static void main(String[] args) throws Exception {
        for (int i = 0; i < 10; i++) {
            JFrame jf = new JFrame();
            Panel a = new Panel();

            JRadioButton birdButton …
Run Code Online (Sandbox Code Playgroud)

java

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

在WinRT中包装的GridView方向

我正在用c#开发一个WinRT应用程序,我使用GridView来呈现我的项目.

我希望我的项目水平排列然后(当达到最大宽度时)下一项应添加到新行(简单: 只能看到垂直滚动条).

不幸的是,我当前的xaml只能在一行中添加水平项目(带有水平滚动条)

<GridView x:Name="GridChildItem" 
                  ItemContainerStyle="{StaticResource NonTickGridViewItem}" 
                  VerticalContentAlignment="Stretch" 
                  ItemTemplate="{StaticResource CustomChildItemTemplete}"
                  SelectionMode="Single" 
                  IsItemClickEnabled="True" 
                  ItemClick="gridViewChild_ItemClick_1"
                  Margin="0,40,0,0" 
                  Height="Auto"
                  Background="{StaticResource DropDownMenuBackColor}" 
                  ScrollViewer.IsHorizontalScrollChainingEnabled="False"
                  ScrollViewer.IsVerticalScrollChainingEnabled ="True"
                  VerticalAlignment="Top">
            <GridView.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" Margin="20,0,0,0" />
                </ItemsPanelTemplate>

           </GridView.ItemsPanel>
 </GridView>
Run Code Online (Sandbox Code Playgroud)

c# xaml gridview windows-runtime

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

Visual Studio 2017在加载解决方案时崩溃

我的VS 2017在EventViewer中不断出现以下错误.知道它崩溃的原因吗?

Exception Info: System.InvalidOperationException
   at System.Linq.Enumerable.Single[[System.Byte, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Generic.IEnumerable`1<Byte>)
   at System.Linq.ImmutableArrayExtensions.SingleOrDefault[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]](System.Collections.Immutable.ImmutableArray`1<System.__Canon>, System.Func`2<System.__Canon,Boolean>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker.GetOrCreateProjectFromArgumentsAndReferences(Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory, System.String, System.Collections.Generic.IReadOnlyDictionary`2<System.String,Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DeferredProjectInformation>, System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.String>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker.GetOrCreateProjectFromArgumentsAndReferences(Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory, System.String, System.Collections.Generic.IReadOnlyDictionary`2<System.String,Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.DeferredProjectInformation>, System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.String>)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker+<PopulateWorkspaceFromDeferredProjectInfoAsync>d__86.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioProjectTracker+<LoadSolutionFromMSBuildAsync>d__79.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Roslyn.Utilities.TaskExtensions+<FireAndForget>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0(System.Object)
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector.TryExecute()
   at Microsoft.VisualStudio.Threading.JoinableTaskFactory+SingleExecuteProtector+<>c.<.cctor>b__20_0(System.Object)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(System.Object)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext, …
Run Code Online (Sandbox Code Playgroud)

visual-studio-2017

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

onResume()没有触发TabHost项目切换

我有一个TabHost有两个tabs.我第一次切换到第二tabonResume()我的第二个的方法tab's activity调用.然后我有一个AlertDialog显示,并在它消失之后'onResume()'方法没有被调用,但我真的等待它.我假设调用'AlertDialog'触发'onPause()'方法并且'onResume()'应该在实际显示'Activity'并准备好与用户交互之前调用.但是当我切换回第一个tab是另一个时,没有调用'onPause()' activity.

您能否建议为什么不调用'onPause()'和'onResume()'方法以及在显示'AlertDialog'或切换之间调用哪些方法tabs

android android-tabhost

5
推荐指数
2
解决办法
5042
查看次数

如何检查windowsstore应用程序中是否存在文件

在Windows 8 app dev上创建实验室.我无法加载所需的所有图像.因此,为了共享部分使用共享图像,我需要检查图像文件是否可用.该项目是一个使用XAML和C#的Windows网格应用程序.过去我使用过

Using System.IO
 ... lost of code
privat void share()
....
    if (File.exist(filename)
    { 
       add file to share
    }
Run Code Online (Sandbox Code Playgroud)

如果我在我的window8项目中尝试这个.找不到File类.

我搜索互联网但无法找到一个代码示例来检查C#中windowsstore应用程序的存在

米希尔

c# windows-8 windows-store-apps

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

使用文件'key.pfx'中的公钥对输出进行签名时出错 - 值不在预期范围内

在尝试编译使用代码签名的ac#项目时,我在VS2015中遇到以下错误.我在VS2013中没有收到此错误.

此外,任何地方都没有关于此错误的信息.

c# visual-studio-2015

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

Wpf InkCanvas 将斯托克斯保存为 svg

是否可以将 InkCanvas 笔触集合保存到 svg 图像?我唯一能找到的是,我可以将笔画保存为带有嵌入式 ISF(墨水序列化格式)的 GIF,或者将它们呈现为位图。我想以可以与其他平台(如 Web)互操作的矢量格式保存笔画。

c# wpf svg inkcanvas

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