Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
* update binary files changed
Browse files Browse the repository at this point in the history
   by CR/LF flasg
* fix bugs in predefined data
* show AAS/thumbnail
  • Loading branch information
festo-i40 committed Oct 21, 2023
1 parent 7b80951 commit bc32a48
Show file tree
Hide file tree
Showing 17 changed files with 264 additions and 200 deletions.
Binary file removed .vs/AASXPackageExplorer/v17/.wsuo
Binary file not shown.
111 changes: 75 additions & 36 deletions src/AasxPackageExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public PackageCentral PackageCentral
get => Logic?.PackageCentral;

}

public AasxMenuWpf MainMenu = new AasxMenuWpf();
public AasxMenuWpf MainMenu = new AasxMenuWpf();

private string showContentPackageUri = null;
private string showContentPackageMime = null;
Expand Down Expand Up @@ -697,11 +697,73 @@ public void RedrawElementView(DispEditHighlight.HighlightFieldInfo hightlightFie
this.AssetId.Text = WpfStringAddWrapChars(
AdminShellUtil.EvalToNonNullString("{0}", asset.GlobalAssetId));

// asset thumbnail
try
{
// identify which stream to use..
if (PackageCentral.MainAvailable)
// asset thumbnail
try
{
// identify which stream to use..
var picFound = false;

// specific for the AAS
if (PackageCentral.MainAvailable)
try
{
if (asset?.DefaultThumbnail?.Path?.HasContent() == true)
{
using (var thumbStream = PackageCentral.Main.GetLocalStreamFromPackage(
uriString: asset.DefaultThumbnail.Path))
{
// load image
if (thumbStream != null)
{
var bi = new BitmapImage();
bi.BeginInit();

// See https://stackoverflow.com/a/5346766/1600678
bi.CacheOption = BitmapCacheOption.OnLoad;

bi.StreamSource = thumbStream;
bi.EndInit();
this.AssetPic.Source = bi;
picFound = true;
}
}
}
}
catch (Exception ex)
{
AdminShellNS.LogInternally.That.SilentlyIgnoredError(ex);
}


// no, ask online server?
if (!picFound && this.theOnlineConnection != null
&& this.theOnlineConnection.IsValid()
&& this.theOnlineConnection.IsConnected())
try
{
using (var thumbStream = this.theOnlineConnection.GetThumbnailStream())
{
if (thumbStream != null)
{
using (var ms = new MemoryStream())
{
thumbStream.CopyTo(ms);
ms.Flush();
var bitmapdata = ms.ToArray();

var bi = (BitmapSource)new ImageSourceConverter().ConvertFrom(bitmapdata);
this.AssetPic.Source = bi;
}
}
}
}
catch (Exception ex)
{
AdminShellNS.LogInternally.That.SilentlyIgnoredError(ex);
}

// no, from the AASX?
if (!picFound && PackageCentral.MainAvailable)
try
{
using (var thumbStream = PackageCentral.Main.GetLocalThumbnailStream())
Expand All @@ -726,30 +788,7 @@ public void RedrawElementView(DispEditHighlight.HighlightFieldInfo hightlightFie
AdminShellNS.LogInternally.That.SilentlyIgnoredError(ex);
}

if (this.theOnlineConnection != null && this.theOnlineConnection.IsValid() &&
this.theOnlineConnection.IsConnected())
try
{
using (var thumbStream = this.theOnlineConnection.GetThumbnailStream())
{
if (thumbStream != null)
{
using (var ms = new MemoryStream())
{
thumbStream.CopyTo(ms);
ms.Flush();
var bitmapdata = ms.ToArray();

var bi = (BitmapSource)new ImageSourceConverter().ConvertFrom(bitmapdata);
this.AssetPic.Source = bi;
}
}
}
}
catch (Exception ex)
{
AdminShellNS.LogInternally.That.SilentlyIgnoredError(ex);
}


}
catch (Exception ex)
Expand Down Expand Up @@ -1920,7 +1959,7 @@ private async Task HandleApplicationEvent(
UiHandleReRenderAnyUiInEntityPanel(update.PluginName, update.Mode, useInnerGrid: true);
}

#endregion
#endregion
}
catch (Exception ex)
{
Expand Down Expand Up @@ -2996,7 +3035,7 @@ private void mainWindow_PreviewKeyDown(object sender, KeyEventArgs e)
}
}

#region Modal Flyovers
#region Modal Flyovers
//====================

private List<StoredPrint> flyoutLogMessages = null;
Expand Down Expand Up @@ -3331,8 +3370,8 @@ public AnyUiContextBase GetDisplayContext()
return DisplayContext;
}

#endregion
#region Drag&Drop
#endregion
#region Drag&Drop
//===============

private void Window_DragEnter(object sender, DragEventArgs e)
Expand Down Expand Up @@ -3422,7 +3461,7 @@ private void DragSource_PreviewMouseLeftButtonDown(object sender, MouseButtonEve
dragStartPoint = e.GetPosition(null);
}

#endregion
#endregion

private void ButtonTools_Click(object sender, RoutedEventArgs e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/AasxPackageExplorer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"profiles": {
"AasxPackageExplorer": {
"commandName": "Project",
"commandLineArgs": "-read-json options-debug.json -script debug.MIHO.script"
"commandLineArgs": "-read-json options-debug.MIHO.json -script debug.MIHO.script"
}
}
}
3 changes: 2 additions & 1 deletion src/AasxPackageExplorer/options-debug.MIHO.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
/* "AasxToLoad": "C:\\Users\\miho\\Desktop\\Festo_SPAU_VR3_UA.aasx", */
/* "AasxToLoad": "C:\\MIHO\\Develop\\Aasx\\repo\\Festo_SPAU_VR3.aasx", */
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\PxC_aasT_2900542_ELR_H3_I_SC__24DC_500AC_0_6.aasx",
"AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Festo_SPAU-B2R-H-G18FD-L-PNLK-PNVBA-M8U_V3c.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\Festo_SPAU-B2R-H-G18FD-L-PNLK-PNVBA-M8U_V3c.aasx",
"AasxToLoad": "C:\\Users\\homi0002\\Desktop\\TempDesktop\\230619 Digi Twin Festo AASX Assessment\\231002_Feedback_1\\8001203_64be10f8-d4c8-4226-a56b-901b9fcbe29c_fb1.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\01_Festo_SPAU_VR3_DPPV2.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\bomtest1.aasx",
// "AasxToLoad": "C:\\HOMI\\Develop\\Aasx\\repo\\leitungssatz_tier1.aasx",
Expand Down
6 changes: 5 additions & 1 deletion src/AasxPackageLogic/ExplorerMenuFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ public static AasxMenu CreateMainMenu()
.Add("Asset", "String with Asset-Id.")))
.AddSeparator()
.AddMenu(header: "Import …", attachPoint: "import", childs: (new AasxMenu())
.AddWpfBlazor(name: "ImportAML", header: "Import AutomationML into AASX …",
.AddWpfBlazor(name: "ImportAASX", header: "Import further AASX file into AASX …",
help: "Import AASX file(s) with entities to overall AAS environment.",
args: new AasxMenuListOfArgDefs()
.Add("Files", "One or multiple AASX file(s) with AAS entities data."))
.AddWpfBlazor(name: "ImportAML", header: "Import AutomationML into AASX …",
help: "Import AML file with AAS entities to overall AAS environment.",
args: new AasxMenuListOfArgDefs()
.Add("File", "AML file with AAS entities data."))
Expand Down
27 changes: 26 additions & 1 deletion src/AasxPackageLogic/MainWindowAnyUiDialogs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,32 @@ await DisplayContextPlus.CheckIfDownloadAndStart(
}
}

if (cmd == "importaml")
if (cmd == "importaasx")
{
// start
ticket?.StartExec();

// filename
if (!(await DisplayContextPlus.MenuSelectOpenFilenameToTicketAsync(
ticket, "File",
"Select AML file to be imported",
null,
"AutomationML files (*.aml)|*.aml|All files (*.*)|*.*",
"Import AML: No valid filename.")))
return;

try
{
await CommandBinding_GeneralDispatchHeadless(cmd, menuItem, ticket);
MainWindow.RestartUIafterNewPackage();
}
catch (Exception ex)
{
LogErrorToTicket(ticket, ex, "When importing AML, an error occurred");
}
}

if (cmd == "importaml")
{
// start
ticket?.StartExec();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/AasxPluginDigitalNameplate/NameplateData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,21 +150,21 @@ public static NameplateData ParseSubmodelForV10(
var smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Pho?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_TelNum?.GetSingleKey());
tryAdd(smc2.Value, "\u260e", defs.CD_TelNum?.GetSingleKey());

// Fax

smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Fax?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_FaxNum?.GetSingleKey());
tryAdd(smc2.Value, "\U0001f5b7", defs.CD_FaxNum?.GetSingleKey());

// Email

smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Ema?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_EmaAdd?.GetSingleKey());
tryAdd(smc2.Value, "\U0001f4e7", defs.CD_EmaAdd?.GetSingleKey());
}

// find markings?
Expand Down Expand Up @@ -325,21 +325,21 @@ public static NameplateData ParseSubmodelForV20(
var smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Phone?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_TelephoneNumber?.GetSingleKey());
tryAdd(smc2.Value, "\u260e", defs.CD_TelephoneNumber?.GetSingleKey());

// Fax

smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Fax?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_FaxNumber?.GetSingleKey());
tryAdd(smc2.Value, "\U0001f5b7", defs.CD_FaxNumber?.GetSingleKey());

// Email

smc2 = smcContInf?.Value?
.FindFirstSemanticIdAs<Aas.ISubmodelElementCollection>(defs.CD_Email?.GetSingleKey(), mm);
if (smc2 != null)
tryAdd(smc2.Value, null, defs.CD_EmailAddress?.GetSingleKey());
tryAdd(smc2.Value, "\U0001f4e7", defs.CD_EmailAddress?.GetSingleKey());
}

// find markings?
Expand Down
4 changes: 2 additions & 2 deletions src/AasxPredefinedConcepts/Resources/DigitalNameplateV20.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
],
"administration": {
"version": "2",
"revision": "1"
"revision": "0"
},
"id": "https://admin-shell.io/zvei/nameplate/2/0/Nameplate",
"kind": "Template",
"semanticId": {
"type": "ExternalReference",
"keys": [
{
"type": "ConceptDescription",
"type": "Submodel",
"value": "https://admin-shell.io/zvei/nameplate/2/0/Nameplate"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"revision": "2"
},
"id": "0173-1#01-AHF578#001",
"kind": "Template",
"semanticId": {
"type": "ExternalReference",
"keys": [
Expand Down
Loading

0 comments on commit bc32a48

Please sign in to comment.