小编Yog*_*ear的帖子

整个屏幕的onClickListener

我正在制作一个闹钟.我想做一个布局部分为空的活动(在背景上放一张照片)我想做的,如果我触摸屏幕上的任何地方,音乐就会停止.

我想过将img作为一个imageview ...但是当我这样做时它会在屏幕上拉直(即使参数在整个屏幕上)

救命?

android android-layout onclicklistener

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

Process.OutputDataReceived 未触发

我在 WPF 项目中有一个简单的函数。我有一个进度条,我希望当外部程序运行命令时进度条将更新。奇怪的是,它仅在外部程序完成时更新。

外部程序编辑特定文件夹中的所有图片,当完成编辑图片时,它会写入一个新行。

public string RunExternalExe(string filename, string arguments = null)
    {
        var process = new Process();

        process.StartInfo.FileName = filename;
        if (!string.IsNullOrEmpty(arguments))
        {
            process.StartInfo.Arguments = arguments;
        }

        process.StartInfo.CreateNoWindow = true;
        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        process.StartInfo.UseShellExecute = false;

        process.StartInfo.RedirectStandardError = true;
        process.StartInfo.RedirectStandardOutput = true;

        var stdOutput = new StringBuilder();

        // Use AppendLine rather than Append since args.Data is one line of output, not including the newline character.
        process.OutputDataReceived += (sender, args) =>
        {
            bgwMain.ReportProgress(i+=2);
            //Console.WriteLine(args.Data);
            //stdOutput.AppendLine(args.Data);
        };

        try
        {
            process.Start();
            process.BeginOutputReadLine(); …
Run Code Online (Sandbox Code Playgroud)

c# wpf stdout process

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

编译器让我让这个函数变为静态

我不知道为什么,但是visual studio的编译器让我让这个函数变得静态.

我有很多字符串列表

List<string> universe = new List<string>();
List<string> foo1 = new List<string>();
List<string> foo2 = new List<string>();
List<string> foo3 = new List<string>();
.
.
.
List<string> fooN = new List<string>();
Run Code Online (Sandbox Code Playgroud)

一些列表可能是空的而其他列表有数据,我想在有数据的人之间交叉,所以我做了这个函数:

public List<string> IntersectIgnoreEmpty(this List<string> list, List<string> other)
{
    if (other.Any())
        return list.Intersect(other).ToList();
    return list;
}
Run Code Online (Sandbox Code Playgroud)

它给了我错误,直到我把它变成静态.我不知道为什么.

c# linq

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

标签 统计

c# ×2

android ×1

android-layout ×1

linq ×1

onclicklistener ×1

process ×1

stdout ×1

wpf ×1