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) (我正在使用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)