存储设置

屏幕截图: 数据存储设置面板

StorageSettingsPanel - 用于选择行情数据存储位置的面板。可在本地目录与远程服务器之间切换,并设置所选方式的参数。

主要属性

任何修改都会触发 SettingsChanged 事件,应用程序据此重新创建 IMarketDataDrive

下面是其使用的代码片段:

<Window x:Class="Sample.StorageWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:xaml="http://schemas.stocksharp.com/xaml"
	Height="300" Width="500">
	<xaml:StorageSettingsPanel x:Name="StoragePanel" />
</Window>
// 选择本地目录
StoragePanel.IsLocal = true;
StoragePanel.Path = @"C:\Data";

// 标记设置已被修改
StoragePanel.SettingsChanged += () => _isModified = true;

// 根据面板设置创建存储
var drive = StoragePanel.IsLocal
	? new LocalMarketDataDrive(StoragePanel.Path)
	: (IMarketDataDrive)new RemoteMarketDataDrive(StoragePanel.Address.To<EndPoint>());

另请参阅

服务面板