public Subclipping(AMSClientV3 context, List <Asset> assetlist, Mainform mainform)
        {
            InitializeComponent();
            this.Icon                = Bitmaps.Azure_Explorer_ico;
            _amsClientV3             = context;
            _parentAssetManifestData = new ManifestTimingData();
            _selectedAssets          = assetlist;
            _mainform                = mainform;

            buttonShowEDL.Initialize();
            buttonShowEDL.EDLChanged += ButtonShowEDL_EDLChanged;
            buttonShowEDL.Offset      = new TimeSpan(0);

            // temp locator creation
            if (_selectedAssets.Count == 1 && MessageBox.Show("A temporary clear locator of 1 hour is going to be created to stream the content in the player. It will be deleted when you close the subclipping window.", "Locator creation", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
            {
                try
                {
                    _tempStreamingLocator = Task.Run(() => AssetInfo.CreateTemporaryOnDemandLocatorAsync(_selectedAssets.First(), _amsClientV3)).GetAwaiter().GetResult();
                }
                catch
                {
                }
            }

            if (_selectedAssets.Count == 1 && _selectedAssets.FirstOrDefault() != null)  // one asset only
            {
                var myAsset = assetlist.FirstOrDefault();
                textBoxAssetName.Text = myAsset.Name;

                // let's try to read asset timing
                XDocument manifest = null;
                try
                {
                    manifest = Task.Run(() => AssetInfo.TryToGetClientManifestContentAsABlobAsync(myAsset, _amsClientV3)).GetAwaiter().GetResult();
                }
                catch
                {
                }

                if (manifest == null)
                {
                    try
                    {
                        manifest = Task.Run(() => AssetInfo.TryToGetClientManifestContentUsingStreamingLocatorAsync(myAsset, _amsClientV3, _tempStreamingLocator?.Name)).GetAwaiter().GetResult();
                    }
                    catch
                    {
                    }
                }

                if (manifest != null)
                {
                    _parentAssetManifestData = AssetInfo.GetManifestTimingData(manifest);
                }

                labelDiscountinuity.Visible = _parentAssetManifestData.DiscontinuityDetected;

                if (!_parentAssetManifestData.Error)  // we were able to read asset timings and not live
                {
                    _timescale = timeControlStart.TimeScale = timeControlEnd.TimeScale = _parentAssetManifestData.TimeScale;
                    timeControlStart.ScaledFirstTimestampOffset = timeControlEnd.ScaledFirstTimestampOffset = _parentAssetManifestData.TimestampOffset;
                    buttonShowEDL.Offset = timeControlStart.GetOffSetAsTimeSpan();

                    textBoxOffset.Text  = _parentAssetManifestData.TimestampOffset.ToString();
                    labelOffset.Visible = textBoxOffset.Visible = true;

                    textBoxFilterTimeScale.Text    = _timescale.ToString();
                    textBoxFilterTimeScale.Visible = labelAssetTimescale.Visible = true;

                    timeControlStart.Max = timeControlEnd.Max = _parentAssetManifestData.AssetDuration;

                    labelassetduration.Visible = textBoxAssetDuration.Visible = true;
                    textBoxAssetDuration.Text  = timeControlStart.Max.ToString(@"d\.hh\:mm\:ss") + (_parentAssetManifestData.IsLive ? " (LIVE)" : "");
                    // let set duration and active track bat
                    timeControlStart.TotalDuration   = timeControlEnd.TotalDuration = _parentAssetManifestData.AssetDuration;
                    timeControlStart.DisplayTrackBar = true;
                    timeControlEnd.DisplayTrackBar   = true;
                    timeControlEnd.SetTimeStamp(timeControlEnd.Max);
                }

                else // one asset but not able to read asset timings
                {
                    timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false;
                    timeControlStart.TimeScale       = timeControlEnd.TimeScale = _timescale;
                    timeControlStart.Max             = timeControlEnd.Max = TimeSpan.MaxValue;
                    //timeControlEnd.SetTimeStamp(timeControlEnd.Max);
                }
            }
            else // several assets
            {
                groupBoxTrimming.Enabled         = panelAssetInfo.Visible = false; // no trimming and no asset info
                radioButtonAssetFilter.Enabled   = false; // no asset filter option
                timeControlStart.DisplayTrackBar = timeControlEnd.DisplayTrackBar = false;
                timeControlStart.TimeScale       = timeControlEnd.TimeScale = _timescale;
                timeControlStart.Max             = timeControlEnd.Max = TimeSpan.MaxValue;
                //timeControlEnd.SetTimeStamp(timeControlEnd.Max);
            }
        }