小编win*_*sgm的帖子

来自麦克风的音频流

我正在创建一个视频聊天应用程序,但在传输麦克风音频时遇到问题。我已经可以使用视频流,但我希望找到捕获笔记本电脑内置麦克风并进行流传输的最佳方法。目前我正在使用 aNetworkStream来发送视频。我对 NAudio ( http://naudio.codeplex.com/ ) 的经验有限,但麦克风捕获的每个示例似乎都不包含New Audio Frame事件(这是我发送视频帧的方法)。

我一直在查看http://voicerecorder.codeplex.com/,但它似乎超出了我的需要,并且不包括流媒体。

如果可能的话,如何捕获麦克风音频并进行流式传输,而不需要将音频保存到文件中?我希望有一个简单的例子。

c# audio-streaming naudio

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

结果不一致 - 更新与选择

我正在运行以下语句,并且无法理解为什么update影响0行而select具有相同的连接并where返回1行.它们都是类型Varchar和crmnumberAC更大,所以应该能够从AccountNumber中获取字符串.思考?

begin transaction
update c
set c.crmnumberAC = a.AccountNumber
--select a.name, a.AccountNumber, c.fullname, c.crmnumberAC 
from Contact as c
right join Account as a
    on c.PFH_Mapping_Ac_ContacId = a.AccountId
WHERE (a.AccountNumber IS NOT NULL AND c.crmnumberAC IS NULL) 
    OR a.AccountNumber != c.crmnumberAC
rollback transaction
Run Code Online (Sandbox Code Playgroud)

当我取消注释select并且只运行那个时,这是结果集where;

在此输入图像描述

sql sql-server-2008

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

在代码中设置开关

我正在尝试在我的控制台应用程序中嵌入以下开关设置,但我不需要app.config.还有另一种方法可以在应用程序中设置此开关吗?

我遇到过,AppContext.SetSwitch但这只适用于.NET 4.6,但我的应用程序需要在XP机器上运行.还有另一种方法吗?

<runtime>
  <AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
</runtime>
Run Code Online (Sandbox Code Playgroud)

.net c#

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

PowerQuery 将记录列表转换为分隔字符串

鉴于下面的 JSON,我尝试将其加载到 Excel 中。我想将“评级”部分格式化为单个分​​隔字符串/单元格。我很新,PowerQuery所以我正在努力做到这一点。我已经设法将记录列表格式化为其自己的表,但是将其连接成一个字符串并将其添加回我的源表中是我绘制空白的地方。任何帮助,将不胜感激。

强大查询

let
    Source = Json.Document(File.Contents("C:\filename.json")),
    Ratings1 = Source[Ratings],
    #"Converted to Table" = Table.FromList(Ratings1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    LastStep = Table.ExpandRecordColumn(#"Converted to Table", "Column1", { "Source", "Value" })
in
    LastStep
Run Code Online (Sandbox Code Playgroud)

JSON

{
    "Title": "Iron Man",
    "Year": "2008",
    "Rated": "PG-13",
    "Ratings": [{
            "Source": "Internet Movie Database",
            "Value": "7.9/10"
        }, {
            "Source": "Rotten Tomatoes",
            "Value": "93%"
        }, {
            "Source": "Metacritic",
            "Value": "79/100"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

最终,像下面这样的东西将是理想的。

在此输入图像描述

m powerquery

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

多线程呼叫代表

引用Marc Gravell的话:

///...blah blah updating files
string newText = "abc"; // running on worker thread
this.Invoke((MethodInvoker)delegate {
    someLabel.Text = newText; // runs on UI thread
});
///...blah blah more updating files
Run Code Online (Sandbox Code Playgroud)

我希望用WPF做到这一点,所以无法使用该invoke方法.有什么想法吗?这个线程的东西正在我的头脑:/

更多详情

我这样开始我的新线程

Thread t = new Thread (LoopThread);
t.Start();
t.Join();
Run Code Online (Sandbox Code Playgroud)

但在整个过程中LoopThread,我想写入UI.

UPDATE

感谢Jon Skeet Dispatcher.Invoke.似乎MethodInvoker也是WinForms.WPF相当于?

更新2

感谢Adriano建议代替System.Windows.Forms.MethodInvoker,使用System.Action.

(你们对this参数混乱是正确的,只需要构建以消除错误.)

巴士自加入之后SimpleInvoke,现在我被击中了

Extension method must be defined in a non-generic static class
Run Code Online (Sandbox Code Playgroud)

在线上

public partial class …
Run Code Online (Sandbox Code Playgroud)

c# wpf multithreading

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

垂直进度条Wpf

我正在尝试在WPF中实现一个垂直进度条,并且遇到了一些困难.我正在关注格雷格D的垂直进度条模板.net的答案,但这对我不起作用.我试过使用外部风格和内联,没有运气.这很烦人,因为它似乎是一个相对简单的答案.

这是我的XAML;

<ProgressBar Name="VolumeMeter" Orientation="Vertical" Margin="4,30,0,0" 
Value="50" HorizontalAlignment="Left" VerticalAlignment="Top" Height="300" Width="10">
    <ProgressBar.Template>
    <ControlTemplate>

            <Border BorderBrush="Green" x:Name="Root" BorderThickness="1">
                <Grid Name="PART_Track" Background="Red">
                    <Rectangle Name="PART_Indicator" Fill="Blue"/>
                </Grid>
            </Border>

            <ControlTemplate.Triggers>
            <Trigger Property="Orientation" Value="Vertical">//Error Here

                <!-- Rotate the progressbar so the left edge is the bottom edge -->
                <Setter TargetName="Root" Property="LayoutTransform">
                    <Setter.Value>
                        <RotateTransform Angle="270" />
                    </Setter.Value>
                </Setter>

                <Setter TargetName="Root" Property="Width"
                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, 
Path=Height}"/>
                <Setter TargetName="Root" Property="Height"
                Value="{Binding RelativeSource={RelativeSource TemplatedParent}, 
Path=Width}"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    </ProgressBar.Template>
</ProgressBar>
Run Code Online (Sandbox Code Playgroud)

我得到的错误就<Trigger Property="Orientation" Value="Vertical">在线上,我正在接受; …

wpf xaml progress-bar

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