protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { WindowsFormsHost?.Dispose(); ForegroundWindow?.Close(); } ViewContent = null; ForegroundWindow = null; disposedValue = true; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (!IsDesignMode) { var windowsFormsHost = WindowsFormsHost; if (windowsFormsHost != null) { ForegroundWindow = new ForegroundWindow(windowsFormsHost) { OverlayContent = ViewContent }; _operation.InitializationMapControl(WindowsFormsHost); DataContext = new MainWindowViewModel(); } } }