public static void InitInstance(ref PackageCollection value) { if (value == null) // UI window opened { value = instance; Instance.OnPackagesChanged = delegate { }; Instance.OnFilterChanged = delegate { }; Instance.SearchSignal.ResetEvents(); Instance.ListSignal.ResetEvents(); Instance.FetchListOfflineCache(true); Instance.FetchListCache(true); Instance.FetchSearchCache(true); } else // Domain reload { instance = value; Instance.RebuildPackageDictionary(); // Resume operations interrupted by domain reload Instance.FetchListOfflineCache(Instance.listOperationOfflineOngoing); Instance.FetchListCache(Instance.listOperationOngoing); Instance.FetchSearchCache(Instance.searchOperationOngoing); } }