小编Eid*_*o95的帖子

如何使用NAudio播放音频原始数据的字节数组?

byte[] bytes = new byte[1024];
Run Code Online (Sandbox Code Playgroud)

假设bytes是一个充满音频原始数据的数组.

如何使用WaveOut对象播放此字节数组?

_waveOut.Init(bytes); // <- Error: cannot resolve method.
_waveOut.Play();
Run Code Online (Sandbox Code Playgroud)

.net c# audio naudio

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

如何使用DataTemplates通过ViewModel-First方法缓存动态切换的视图

(我正在使用GalaSoft.MvvmLight框架)

我有一些观点,我MainWindow.xaml通过用户选择在运行时动态切换它们.

这些视图使用以下技术与其对应的视图模型绑定:

MainWindow.xaml

...
<Window.Resources>
        <DataTemplate DataType="{x:Type vm:Control1ViewModel}">
            <v:Control1/>
        </DataTemplate>
    ... // Assume there is more then one DataTemplate. Every view has a unique view-model.
</Window.Resources>
...
Run Code Online (Sandbox Code Playgroud)

Control1ViewModel.cs

public class Control1ViewModel : ViewModelBase
{
    ...
}
Run Code Online (Sandbox Code Playgroud)

MainWindow.xaml使用以下技术上述视图之间切换:

MainWindow.xaml

...
<ContentControl Content="{Binding CurrentView}"/> // This is were the view appears.
...
Run Code Online (Sandbox Code Playgroud)

MainViewModel.cs

public class MainViewModel : ViewModelBase
{
    ...
    private ViewModelBase _currentView;
    public ViewModelBase CurrentView
    {
        get { return _currentView; }
        private set
        { …
Run Code Online (Sandbox Code Playgroud)

c# wpf xaml mvvm

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

标签 统计

c# ×2

.net ×1

audio ×1

mvvm ×1

naudio ×1

wpf ×1

xaml ×1