switch to correct tab if open when opening from file system
This commit is contained in:
parent
44c1146949
commit
dbe806b301
3 changed files with 37 additions and 21 deletions
|
|
@ -1417,6 +1417,32 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
}
|
||||
|
||||
public bool SwitchToWorkspaceIfAlreadyOpen(string assetPath)
|
||||
{
|
||||
var mainViewWidget = Instance.MainView;
|
||||
foreach (var openWorkspace in Instance.Workspaces)
|
||||
{
|
||||
if (openWorkspace.SceneContext.EditContext.SourceFilePath == assetPath
|
||||
|| (openWorkspace.SceneContext.EditContext.SourceItem is IAssetPath cloudItem
|
||||
&& cloudItem.AssetPath == assetPath))
|
||||
{
|
||||
foreach (var tab in mainViewWidget.TabControl.AllTabs)
|
||||
{
|
||||
if (tab.TabContent is DesignTabPage tabContent
|
||||
&& (tabContent.sceneContext.EditContext.SourceFilePath == assetPath
|
||||
|| (tabContent.sceneContext.EditContext.SourceItem is IAssetPath cloudItem2
|
||||
&& cloudItem2.AssetPath == assetPath)))
|
||||
{
|
||||
mainViewWidget.TabControl.ActiveTab = tab;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public DragDropData DragDropData { get; set; } = new DragDropData();
|
||||
|
||||
private string _uiHint = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue