private void RemoveUiPogressComponent(ProgressBarTransform ctrl) { IEnumerable <string> subs; using (var pbt = ctrl) { subs = pbt.GetSubscribers(); pbt.StopSubscriber(); } foreach (var subscription in subs) { _workloadContextReceiverModel.RemoveTask(subscription); var pgt = _pbtdict[subscription]; _pbtdict.Remove(subscription); if (pgt.IsDisposed || !pgt.Disposing) { pgt.Dispose(); } } }
private void AddNewUiProgressComponent(string ordnr) //OrdinalNumbersType ordnr) { if (string.IsNullOrEmpty(ordnr)) { return; } //var sOrndNrHex = ordnr;//.ToStringHex(); var splittedordNr = ordnr.Split('_'); if (splittedordNr.Count() < 2) { return; } string tbkey = string.Concat("tb", splittedordNr[0]); string flpKey = string.Concat("flp", splittedordNr[0]); string pbtKey = ordnr; // string.Concat("pbtKey", splittedordNr[1]); if (!tabControl1.TabPages.ContainsKey(tbkey)) { tabControl1.TabPages.Add(tbkey, tbkey); } var tp = tabControl1.TabPages[tbkey]; FlowLayoutPanel flp; if (!tp.Controls.ContainsKey(flpKey)) { flp = new FlowLayoutPanel(); flp.Name = flpKey; flp.AutoScroll = true; flp.FlowDirection = FlowDirection.TopDown; flp.WrapContents = false; tp.Controls.Add(flp); flp.Dock = DockStyle.Fill; tp.Controls.Add(flp); } else { flp = (FlowLayoutPanel)tp.Controls[flpKey]; } ProgressBarTransform pbt; if (!flp.Controls.ContainsKey(pbtKey)) { pbt = new ProgressBarTransform(_workloadContextReceiverModel, pbtKey); flp.Controls.Add(pbt); } else { pbt = (ProgressBarTransform)flp.Controls[pbtKey]; } if (!_pbtdict.ContainsKey(pbtKey)) { _pbtdict[pbtKey] = pbt; } pbt.StartSubscriber(); //_workloadContextReceiverModel.AddSubscriber(); }