WriteMultiFile error occurred
When calling the WriteMultiFile API, the following error occurs:
"System.InvalidOperationException: 'The specified element is already the logical child of another element. Disconnect it first.'"
The current development environment is Visual Studio 2022 and Eyeshot 2024 FEM Version.
The code is simple, creating a design and then using the WriteMultiFile API in the behind code as follows:
XAML:
<Window x:Class="TelerikWpfApp5.Window1"
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:telerik="http://schemas.telerik.com/2008/xaml/presentation"
xmlns:ddes="http://schemas.devdept.com/winfx/2008/xaml/control"
xmlns:local="clr-namespace:TelerikWpfApp5"
mc:Ignorable="d"
Title="Window1" Height="450" Width="800">
<Grid>
<ddes:Design x:Name="design1"
Grid.Row="0"
Renderer="OpenGL"
HorizontalAlignment="left" Height="auto">
<ddes:Design.ProgressBar>
<ddes:ProgressBar x:Name="ProgressModel"
Lighting ="False"
Visible="True"/>
</ddes:Design.ProgressBar>
<ddes:Design.Viewports>
<ddes:Viewport Name="viewportLayout1"
DisplayMode="Rendered"
InitialView="Isometric"
>
<ddes:Viewport.OriginSymbols>
<ddes:OriginSymbol Lighting="true"
Visible="False"/>
</ddes:Viewport.OriginSymbols>
<ddes:Viewport.CoordinateSystemIcon>
<ddes:CoordinateSystemIcon Lighting="true"/>
<!--<ddes:CoordinateSystemIcon Lighting="True" ArrowColorZ="AliceBlue"/>-->
</ddes:Viewport.CoordinateSystemIcon>
<ddes:Viewport.ViewCubeIcon>
<ddes:ViewCubeIcon Lighting="true"/>
</ddes:Viewport.ViewCubeIcon>
<ddes:Viewport.Grids>
<ddes:Grid x:Name="gridLine"
AutoSize="False"
AutoStep="False"
Visible="False"
Lighting="False"/>
</ddes:Viewport.Grids>
<ddes:Viewport.ToolBars>
<!--<ddes:ToolBar Position="HorizontalTopCenter">-->
<ddes:ToolBar Position="VerticalMiddleRight">
<ddes:ToolBar.Buttons>
<ddes:HomeToolBarButton />
<ddes:MagnifyingGlassToolBarButton/>
<!--<ddes:ToolBarSeparator />-->
<ddes:ZoomWindowToolBarButton/>
<ddes:ZoomToolBarButton/>
<ddes:PanToolBarButton />
<ddes:RotateToolBarButton x:Name="RotateToolBar"/>
<ddes:ZoomFitToolBarButton/>
</ddes:ToolBar.Buttons>
</ddes:ToolBar>
</ddes:Viewport.ToolBars>
</ddes:Viewport>
</ddes:Design.Viewports>
</ddes:Design>
</Grid>
</Window>
.CS:
using devDept.Eyeshot.Translators;
using devDept.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace TelerikWpfApp5
{
/// <summary>
///
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
WriteMultiFile writeFile = new WriteMultiFile(new WriteMultiFileParams(this.design1.Document),
@"C:\TESTSETSTEST.eye", new FileSerializer());
design1.StartWork(writeFile);
}
}
}
Comments
Hello ChulHee,
This might be a bug that has already been fixed. Please try using the latest nightly build.
If the error continues, kindly open a support request with all the details. Thank you for your understanding and cooperation.
Please sign in to leave a comment.