Не сохраняется ChartActiveOrdersElement
Если добавить ChartActiveOrdersElement а область графика, а затем сохранить и загрузить то восстановления не происходит.
Код
<dx:DXWindow x:Class="Chart.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:charting="http://schemas.stocksharp.com/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
mc:Ignorable="d"
Title="MainWindow" Height="500" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<charting:ChartPanel Name="ChartPanel" IsInteracted="True"/>
<Button Content="Init" Click="Init_OnClick" Grid.Row="1"></Button>
<Button Content="Clear" Click="Clear_OnClick" Grid.Row="2"></Button>
<Button Content="Load" Click="Load_OnClick" Grid.Row="3"></Button>
<Button Content="Save" Click="Save_OnClick" Grid.Row="4"></Button>
</Grid>
</dx:DXWindow>
Код
using System.IO;
using Ecng.Serialization;
using System;
using System.Windows;
using Ecng.Collections;
using StockSharp.Xaml.Charting;
namespace Chart
{
public partial class MainWindow
{
private MyStrategy Strategy;
public MainWindow()
{
InitializeComponent();
}
private void Load_OnClick(object sender, RoutedEventArgs e)
{
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "/SettingsStorage.xml"))
{
var settingsStorage =
new XmlSerializer<SettingsStorage>().Deserialize(
AppDomain.CurrentDomain.BaseDirectory + "/SettingsStorage.xml");
ChartPanel.Load(settingsStorage);
}
}
private void Save_OnClick(object sender, RoutedEventArgs e)
{
var settingsStorage = new SettingsStorage();
ChartPanel.Save(settingsStorage);
new XmlSerializer<SettingsStorage>().Serialize(settingsStorage, AppDomain.CurrentDomain.BaseDirectory + "/SettingsStorage.xml");
}
private void Init_OnClick(object sender, RoutedEventArgs e)
{
var area = new ChartArea();
area.Elements.AddRange(new IChartElement[]{new ChartActiveOrdersElement() { FullTitle = "ChartActiveOrdersElement" }, new ChartCandleElement(){Title = "ChartCandleElement" }, });
ChartPanel.AddArea(area);
}
private void Clear_OnClick(object sender, RoutedEventArgs e)
{
ChartPanel.ClearAreas();
}
}
}