//Remove session dialogs if dataset column names are added or removed. //04Aug2014 All the dialogs those have matching partial key, will be removed from dialog dictionary memory private void RemoveOldSessionDialogsFromMemory(string partialkey) { SessionDialogContainer sdc = LifetimeService.Instance.Container.Resolve <SessionDialogContainer>(); //string partialkey = GetActiveDocument().FileName + GetActiveDocument().Name; Dictionary <string, object> SessionDialogs = sdc.SessionDialogList; List <string> keylist = new List <string>(); KeyValuePair <string, object> kvp; //collecting all the keys those are supposed to be removed foreach (string fullkey in sdc.SessionDialogList.Keys) //collect all dialogkeys related to dataset that is currently closed { if (fullkey.Contains(partialkey)) { keylist.Add(fullkey); } } //removing all the dialogs whose keys were stored in keylist. foreach (string dlgfullkey in keylist) { if (sdc.SessionDialogList.ContainsKey(dlgfullkey)) //if it has that key { sdc.SessionDialogList.Remove(dlgfullkey); // then remove it } } }
/// <summary> /// Remove session dialog if dataset is closed //13Feb2013 /// </summary> /// <param name="data"></param> private void RemoveSessionDialogs(TabItem panel) { DataSource removedds = panel.Tag as DataSource; string semiKey = removedds.FileName + removedds.Name; List <string> fullkeylist = new List <string>(); SessionDialogContainer sdc = LifetimeService.Instance.Container.Resolve <SessionDialogContainer>(); foreach (string fullkey in sdc.SessionDialogList.Keys) //collect all dialogkeys related to dataset that is currently closed { if (fullkey.Contains(semiKey)) { fullkeylist.Add(fullkey); } } //Remove items(dialogs) from dictionary // foreach (string dlgfullkey in fullkeylist) { if (sdc.SessionDialogList.ContainsKey(dlgfullkey)) //if it has that key { sdc.SessionDialogList.Remove(dlgfullkey); // then remove it } } //remove QPro dataset related details of Qpro dataset is closed QproHandler.RemoveQPDatasetInfo(removedds.Name); }