private void CanvasContent_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2 && e.Source is FrameworkElement fe) { // check if (fe.Tag is AdminShell.Property prop && prop.parent is AdminShell.Entity ent) { // first check, if a navigate to reference element can be found var navTo = ent.statements?.FindFirstSemanticIdAs <AdminShell.ReferenceElement>( AasxPredefinedConcepts.ImageMap.Static.CD_NavigateTo?.GetReference(), AdminShellV20.Key.MatchMode.Relaxed); if (navTo?.value != null) { // try activate var ev = new AasxIntegrationBase.AasxPluginResultEventNavigateToReference(); ev.targetReference = new AdminShell.Reference(navTo.value); this.theEventStack?.PushEvent(ev); return; } // if not, have a look to the Entity itself if (ent.GetEntityType() == AdminShellV20.Entity.EntityTypeEnum.SelfManagedEntity && ent.assetRef != null && ent.assetRef.Count > 0) { // try activate var ev = new AasxIntegrationBase.AasxPluginResultEventNavigateToReference(); ev.targetReference = new AdminShell.Reference(ent.assetRef); this.theEventStack?.PushEvent(ev); return; } } // handle double click in any case return; } // now, take as event for underlying image HandleMouseClickOnImage(); }
private void MtpVisu_MtpObjectDoubleClick(MtpData.MtpBaseObject source) { // access var sme = this.theSubmodel?.submodelElements; var first = this.activeMtpFileElem.GetReference(); if (source == null || this.activeMtpFileElem == null || sme == null || first == null) { return; } // for the active file, find a Reference for it foreach (var searchId in new[] { source.Name, source.RefID }) { // access if (searchId == null) { continue; } // // Search for FileToNavigateElement // var firstFtn = first + (new AdminShell.Key( AdminShell.Key.GlobalReference, true, AdminShell.Key.Custom, searchId)); this.theLog?.Info($"DblClick MTP .. search reference: {firstFtn.ToString(1)}"); foreach (var fileToNav in sme.FindAllSemanticIdAs <AdminShell.RelationshipElement>( this.defsInterop?.CD_FileToNavigateElement?.GetReference(), AdminShell.Key.MatchMode.Relaxed)) { if (fileToNav.first?.Matches(firstFtn, AdminShell.Key.MatchMode.Relaxed) == true) { // try activate var ev = new AasxIntegrationBase.AasxPluginResultEventNavigateToReference(); ev.targetReference = new AdminShell.Reference(fileToNav.second); this.theEventStack?.PushEvent(ev); return; } } // // Search for FileToEntity // var firstFte = first + (new AdminShell.Key( AdminShell.Key.GlobalReference, true, AdminShell.Key.Custom, searchId)); this.theLog?.Info($"DblClick MTP .. search reference: {firstFte.ToString(1)}"); foreach (var fileToEnt in sme.FindAllSemanticIdAs <AdminShell.RelationshipElement>( this.defsInterop?.CD_FileToEntity?.GetReference(), AdminShell.Key.MatchMode.Relaxed)) { if (fileToEnt.first?.Matches(firstFte, AdminShell.Key.MatchMode.Relaxed) == true) { // debug this.theLog?.Info($"try find Entity {"" + fileToEnt.second} .."); // find Entity, check if self-contained var foundRef = this.thePackage?.AasEnv?.FindReferableByReference(fileToEnt.second); if (foundRef is AdminShell.Entity foundEnt && foundEnt.GetEntityType() == AdminShell.Entity.EntityTypeEnum.SelfManagedEntity && foundEnt.assetRef != null) { // try activate var ev = new AasxIntegrationBase.AasxPluginResultEventNavigateToReference(); ev.targetReference = new AdminShell.Reference(foundEnt.assetRef); this.theEventStack?.PushEvent(ev); return; } } } } }