public override void RefreshFromMainData()
 {
     if (theAas != null)
     {
         var ci = theAas.ToCaptionInfo();
         this.Caption = ci.Item1;
         this.Info    = ci.Item2;
         var asset = theEnv.FindAsset(theAas.assetRef);
         if (asset != null)
         {
             this.Info += $" of [{asset.identification.idType}, {asset.identification.id}, {asset.kind.kind}]";
         }
     }
 }
        public void AddByAas(AdminShell.AdministrationShellEnv env, AdminShell.AdministrationShell aas, string fn)
        {
            // access
            if (env == null || aas?.identification == null)
            {
                return;
            }
            var aasId = "" + aas.identification.id;

            // demand also asset
            var asset = env.FindAsset(aas.assetRef);

            if (asset?.identification == null)
            {
                return;
            }
            var assetId = "" + asset.identification.id;

            // try determine tag
            // ReSharper disable ConditionIsAlwaysTrueOrFalse
            var tag = "";

            try
            {
                var threeFn = Path.GetFileNameWithoutExtension(fn);
                tag = AdminShellUtil.ExtractPascalCasingLetters(asset.idShort);
                if (tag == null || tag.Length < 2)
                {
                    tag = AdminShellUtil.ExtractPascalCasingLetters(threeFn).SubstringMax(0, 3);
                }
                if (tag == null || tag.Length < 2)
                {
                    tag = ("" + asset.idShort).SubstringMax(0, 3).ToUpper();
                }
                if (tag == null || tag.Length < 3)
                {
                    tag = ("" + threeFn).SubstringMax(0, 3).ToUpper();
                }
            }
            catch (Exception ex)
            {
                AdminShellNS.LogInternally.That.SilentlyIgnoredError(ex);
            }
            // ReSharper enable ConditionIsAlwaysTrueOrFalse

            // build description
            var desc = "";

            if (aas.idShort.HasContent())
            {
                desc += $"\"{aas.idShort}\"";
            }
            if (asset.idShort.HasContent())
            {
                if (desc.HasContent())
                {
                    desc += ",";
                }
                desc += $"\"{asset.idShort}\"";
            }

            // ok, add
            var fi = new FileItem(
                assetId: assetId, aasId: aasId, fn: fn, tag: "" + tag, description: desc);

            fi.VisualState = FileItem.VisualStateEnum.ReadFrom;
            fi.VisualTime  = 2.0;
            this.Add(fi);
        }