public void It_does_not_throw_exception_if_already_disposed() { var collection = new SynchronizedObservableCollection <string>(); Assert.DoesNotThrow(() => collection.Dispose()); Assert.DoesNotThrow(() => collection.Dispose()); }
private void onGetingEndpointsCompleted(object sender, RunWorkerCompletedEventArgs e) { object addresses = e.Result; if (PeersInfo == null) { PeersInfo = new SynchronizedObservableCollection <PeerInfo>(new ObservableCollection <PeerInfo>()); } PeersInfo.Clear(); foreach (EndpointAddress endpointAddress in (IEnumerable <EndpointAddress>)addresses) { var peerInfo = new PeerInfo { Address = endpointAddress, HostName = endpointAddress.Uri.Host.ToUpper(), IsSyncAvailable = false }; PeersInfo.Add(peerInfo); } IsBusy = false; }
public MainViewModel() { m_searchCommand = new RelayCommand(Search, CanSearch); m_openPdfCommand = new RelayCommand(OpenPdf); m_loadMoreResultCommand = new RelayCommand(LoadMoreResults, CanLoadMoreResults); m_addToFavouritesCommand = new RelayCommand(AddToFavourites); m_saveFavouritesCommand = new RelayCommand(SaveFavourites); m_showFavouritesCommand = new RelayCommand(ShowFavourites, CanShowFavourites); m_settingsCommand = new RelayCommand(Settings); m_requestMoreInfoCommand = new RelayCommand(RequestMoreInfo); m_addCustomCommand = new RelayCommand(AddCustom); m_filteredResults = CollectionViewSource.GetDefaultView(m_searchResults); m_filteredResults.Filter = TagsFilter; m_filteredResults.Refresh(); m_savedParts = new SynchronizedObservableCollection <PartViewModel, Part>(Global.SavedParts, (m) => new PartViewModel(m)); #if DEBUG == false CheckForUpdates(); #endif if (Global.Configuration.FavouritesOnStart) { ShowFavourites(null); } }
public void It_inserts_the_item_when_index_is_equal_to_count() { var collection = new SynchronizedObservableCollection <string>(); Assert.DoesNotThrow(() => { collection.Insert(0, "0"); }); Assert.That(collection.Count, Is.EqualTo(1)); }
//really absurd way of fixing order issue public void ReorderSkillContainer(DragablzItemsControl container, SynchronizedObservableCollection <FixedSkillCooldown> collection) { var positions = new Dictionary <int, double>(); //index, X for (var i = 0; i < container.Items.Count; i++) { var curr = container.ItemContainerGenerator.ContainerFromIndex(i) as UIElement; var p = curr.TransformToAncestor(this).Transform(new Point(0, 0)); positions.Add(i, p.X); } var needsReorder = false; for (var j = 0; j < positions.Count; j++) { if (j + 1 == positions.Count) { continue; } if (positions[j] > positions[j + 1]) { needsReorder = true; break; } } if (!needsReorder) { return; } container.ItemsSource = null; container.ItemsSource = collection; }
public AppWnd_VM(INavigationService NavigationService_) { LongTasks = new SynchronizedObservableCollection<ProgressBar_Model>(); if (!IsInDesignMode) { NavigationService = NavigationService_; NavigationService.SetAppWndVM(this); NavigationService.NavigateForward(Form.Login); NavigationBack = new RelayCommand(NavigateBack_cmd); ViewModelLocator.Instance.MainMetroWindow.Closed += MainMetroWindow_Closed; CommandDispatcher = new RelayCommand<string>(CmdDispatcher); } if (IsInDesignMode) { LongTasks.Add(new ProgressBar_Model() { Text = "A very long task",IsIndeterminate=true}); } }
public Dictionary() : base() { Words = new SynchronizedObservableCollection<WordOfDictionary>(); LearnedWords = new SynchronizedObservableCollection<LearnedWord>(); Date = DateTime.Today; }
private SynchronizedObservableCollection <AaronCarPartAttribute> PrepareAttributes(DBCarPart dbCarPart) { SynchronizedObservableCollection <AaronCarPartAttribute> attributes = new SynchronizedObservableCollection <AaronCarPartAttribute>(); AttributeOffsetTable attributeOffsetTable = _attributeOffsetTables[dbCarPart.AttributeTableOffset]; foreach (var offset in attributeOffsetTable.Offsets) { var rawAttribute = _attributes[offset]; AaronCarPartAttribute newAttribute = this.ConvertAttribute(rawAttribute); //AaronCarPartAttribute newAttribute = new AaronCarPartAttribute(); //newAttribute.Name = HashResolver.Resolve(rawAttribute.NameHash); //newAttribute.Value = rawAttribute.iParam; //switch (newAttribute.Hash) //{ // case 0xB1027477: // case 0x46B79643: // case 0xFD35FE70: // case 0x7D65A926: // this.LoadSingleAttribString(newAttribute, rawAttribute); // break; // case 0xFE613B98: // this.LoadDoubleAttribString(newAttribute, rawAttribute); // break; //} attributes.Add(newAttribute); } return(attributes); }
public PopupNotification() { InitializeComponent(); notificationBalloons = new SynchronizedObservableCollection <Balloon>(); notificationBalloons.CollectionChanged += NotificationBalloons_CollectionChanged; content.ItemsSource = notificationBalloons; }
/// <summary> /// Returns DataTable of Contact from contacts cache /// </summary> /// <returns>DataTable of Contact</returns> public static DataTable GetDataTableFromContacts() { List <string> columns = ContactExtension.GetContactsColumnNames(new Contact()).ToList(); DataTable table = new DataTable(); foreach (string column in columns) { table.Columns.Add(column); } table.Columns.Add("_ContactID"); SynchronizedObservableCollection <Contact> contacts = ContactsManager.Current.ContactsCache; int i; DataRow row; string fieldValue; foreach (Contact contact in contacts) { row = table.NewRow(); for (i = 0; i < columns.Count; i++) { // Get value of specified column fieldValue = contact.GetType().GetProperty(columns[i]).GetValue(contact, null) as string; row[i] = fieldValue; } row[i] = contact.ContactID; table.Rows.Add(row); } return(table); }
public void It_throws_exception_when_old_index_is_less_than_zero() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentOutOfRangeException>(() => { collection.Move(-1, 2); }); }
public void It_throws_exception_when_new_index_is_greater_than_count() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentOutOfRangeException>(() => { collection.Move(0, 4); }); }
public void It_does_not_throw_exception_when_collection_and_context_are_not_null() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }, new SynchronizationContext()); Assert.That(collection.Count, Is.EqualTo(3)); }
public void It_throws_exception_when_value_is_not_compatible_object() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentException>(() => ((IList)collection)[2] = 2); }
public void It_returns_item_when_index_is_in_range() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(collection[2], Is.EqualTo("3")); }
public void It_throws_exception_when_arrayIndex_is_less_than_zero() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentException>(() => ((ICollection)collection).CopyTo(new string[1], -1)); }
public void It_returns_true_when_collection_contains_item() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(((IList)collection).Contains("3"), Is.True); }
public void It_returns_index_of_item_when_item_is_found() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(collection.IndexOf("2"), Is.EqualTo(1)); }
public void It_returns_false_when_collection_does_not_contain_item() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(((IList)collection).Contains("4"), Is.False); }
public void It_returns_false_when_value_is_not_compatible_object() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(((IList)collection).Contains(3), Is.False); }
public void It_throws_exception_when_arrayIndex_is_greater_than_or_equal_to_array_length() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentException>(() => ((ICollection)collection).CopyTo(new string[1], 1)); }
public void It_throws_exception_when_offset_is_less_than_count() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentException>(() => ((ICollection)collection).CopyTo(new string[3], 1)); }
public void It_throws_exception_when_array_is_null() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.Throws <ArgumentNullException>(() => collection.CopyTo(null, 0)); }
public void It_throws_exception_when_array_is_null() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); // ReSharper disable once AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => ((ICollection)collection).CopyTo(null, 0)); }
public PlayerInfo(Player user, DamageTracker tracker) { Tracker = tracker; Player = user; SkillLog = new SynchronizedObservableCollection <SkillResult>(); Received = new SkillStats(tracker, SkillLog); Dealt = new SkillStats(tracker, SkillLog); }
public EventGroup(string name, DateTime start, DateTime end, bool rc) { _dispatcher = InfoWindowViewModel.Instance.GetDispatcher(); Events = new SynchronizedObservableCollection <DailyEvent>(_dispatcher); Name = name; RemoteCheck = rc; _start = start; _end = end; }
public void It_returns_false_when_collection_does_not_contain_item() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(collection.Remove("4"), Is.False); Assert.That(collection.Count, Is.EqualTo(3)); }
public EventGroup(string name, DateTime start, DateTime end, bool rc) { Dispatcher = WindowManager.Dashboard.Dispatcher; Events = new SynchronizedObservableCollection <DailyEvent>(Dispatcher); Name = name; RemoteCheck = rc; _start = start; _end = end; }
public void It_removes_all_items() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.That(collection.Count, Is.GreaterThan(0)); collection.Clear(); Assert.That(collection.Count, Is.EqualTo(0)); }
public MergedInventoryViewModel() { MergedInventory = new SynchronizedObservableCollection <MergedInventoryItem>(); MergedInventoryView = Utils.InitLiveView(o => o != null, MergedInventory, new string[] { }, new[] { new SortDescription("Item.Item.Id", ListSortDirection.Ascending), new SortDescription("Item.Item.RareGrade", ListSortDirection.Ascending), }); ((ICollectionView)MergedInventoryView).CollectionChanged += Reeeee; }
public void It_remove_the_item_when_index_is_in_range() { var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); Assert.DoesNotThrow(() => { collection.RemoveAt(1); }); Assert.That(collection.Count, Is.EqualTo(2)); Assert.That(collection[0], Is.EqualTo("1")); Assert.That(collection[1], Is.EqualTo("3")); }
public void It_updates_item_when_index_is_in_range() { // ReSharper disable once UseObjectOrCollectionInitializer var collection = new SynchronizedObservableCollection <string>(new List <string> { "1", "2", "3" }); collection[2] = "It_updates_item_when_index_is_in_range"; Assert.That(collection[2], Is.EqualTo("It_updates_item_when_index_is_in_range")); }
// functions public Subtitles() : base() { Items = new SynchronizedObservableCollection<SubtitleItem>(); Name = ""; Language = ""; Type = ""; Format = ""; TrackUID = 0; }
public static void UpdateLanguageServiceCollection() { LangServCollection_ = new SynchronizedObservableCollection<LanguageService>(); List<LanguageService> servs= EFDbConnect.Main.Table<LanguageService>().ToList(); foreach(LanguageService serv in servs) { LanguageService ls = (LanguageService)serv.Clone(Type.GetType("OpenLearningPlayer.Shared.API.LanguageServices." + serv.Discriminator)); //LanguageService ls = (LanguageService)Activator.CreateInstance(Type.GetType("OpenLearningPlayer.Shared.Domain."+serv.Discriminator)); LangServCollection_.Add(ls); ls.Languages = new SynchronizedObservableCollection<LanguageService.LanguageOfService>(EFDbConnect.Main.Table<LanguageService.LanguageOfService>().Where(x => x.LanguageService_id == serv.id).ToList()); } }
public void RunProbes(IList<IPEndPoint> socketsToProbe, int[] associatedKeys) { results = new SynchronizedObservableCollection<KeyValuePair<int, bool>>(); Results = new ReadOnlySynchronizedObservableCollection<KeyValuePair<int, bool>>(results); threads = new List<Thread>(); for (int i = 0; i < socketsToProbe.Count; i++) { KeyValuePair<IPEndPoint, int> pair = new KeyValuePair<IPEndPoint, int>(socketsToProbe[i], associatedKeys[i]); Thread thread = new Thread(Start); thread.Start(pair); threads.Add(thread); } }
public Download_ViewModel( INavigationService NavigationService_, IDialogService DialogService_, AppSetting AppSetting_, IStore Store_, ILocalization Loc_, ILogger logger_) : base() { if (!IsInDesignMode) { NavigationService = NavigationService_; DialogService = DialogService_; AppSettings = AppSetting_; Store = Store_; Tx = Loc_; logger = logger_; CommandDispatcher = new MvxCommand<string>(CmdDispatcher); Command_DownloadStoreItem = new MvxCommand<StoreItemExt>((x)=>CmdDispatcher_StoreItem(x,"Download")); } StoreItems = new SynchronizedObservableCollection<StoreItemExt>(); if (IsInDesignMode) { StoreItemExt item; item = new StoreItemExt { Name = "South Park" }; item.DownloadButton.State1 = true; StoreItems.Add(item); item = new StoreItemExt { Name = "Chuggington" }; item.DownloadButton.State2 = true; StoreItems.Add(item); item = new StoreItemExt { Name = "Futurama" }; item.DownloadButton.State3 = true; StoreItems.Add(item); } }
public void enumeratorTestInternalEntry() { //test object SynchronizedObservableCollection<int> testCol = new SynchronizedObservableCollection<int>(); //the items to add var r = (Enumerable.Range(0, 100)); var z = (Enumerable.Range(100, 100)); //add a range of numbers (0-4) to increment on foreach (int i in r) { testCol.Add(i); } //the list that will contain the enumerated items. List<int> k = new List<int>(); Thread s = new Thread(new ThreadStart(() => { //for-each item in the test wait a bit so the adder //thread has a chance to add more items then add to the //counter of how many items the enumerator got. foreach (int i in testCol) { Thread.Sleep(10); k.Add(i); } })); s.Start(); //add more numbers during the execution of the other thread. adds //(5-14) at a random location. Random rnd = new Random(); foreach (int i in z) { testCol.Insert(rnd.Next(0, testCol.Count-1),i); } s.Join(); //assert that there are no duplicate items. (that the enumerator did //not back over something already enumerated) all items in testCol //are distinct in this test. Assert.AreEqual(k.Distinct().Count(), k.Count()); //assert that the enumerator is not adding any items. Assert.IsTrue(k.Count() <= testCol.Count); }
public MainViewModel() { m_searchCommand = new RelayCommand(Search, CanSearch); m_openPdfCommand = new RelayCommand(OpenPdf); m_loadMoreResultCommand = new RelayCommand(LoadMoreResults, CanLoadMoreResults); m_addToFavouritesCommand = new RelayCommand(AddToFavourites); m_saveFavouritesCommand = new RelayCommand(SaveFavourites); m_showFavouritesCommand = new RelayCommand(ShowFavourites, CanShowFavourites); m_settingsCommand = new RelayCommand(Settings); m_requestMoreInfoCommand = new RelayCommand(RequestMoreInfo); m_addCustomCommand = new RelayCommand(AddCustom); m_filteredResults = CollectionViewSource.GetDefaultView(m_searchResults); m_filteredResults.Filter = (x) => { if (!IsFavouritesMode) return true; PartViewModel part = (PartViewModel)x; string[] tokens = m_searchField.ToUpper().Split(' '); string upperName = (part.Name == null ? string.Empty : part.Name.ToUpper()); foreach (var item in tokens) { var result = part.Tags.FirstOrDefault(tag => tag.Value.ToUpper().StartsWith(item)); if (result == null) { if (!upperName.Contains(item)) return false; } } return true; }; m_filteredResults.Refresh(); m_savedParts = new SynchronizedObservableCollection<PartViewModel, Part>(Global.SavedParts, (m) => new PartViewModel(m)); CheckForUpdates(); if (Global.Configuration.FavouritesOnStart) ShowFavourites(null); }
public void getEnumeratorTest() { //test object SynchronizedObservableCollection<int> testCol = new SynchronizedObservableCollection<int>(); var r = (Enumerable.Range(0, 5)); var z = (Enumerable.Range(5, 10)); //add a range of numbers (0-4) to increment on foreach (int i in r) { testCol.Add(i); } //the counter to use to make sure the thread is getting updates to //the enumerator while it is computing. int k = 0; Thread s = new Thread(new ThreadStart(() => { //for-each item in the test wait a bit so the adder //thread has a chance to add more items then add to the //counter of how many items the enumerator got. foreach (int i in testCol) { Thread.Sleep(10); k++; } })); s.Start(); //add more numbers during the execution of the other thread. adds //(5-14) foreach (int i in z) { testCol.Add(i); } s.Join(); //assert that the number of items counted by the enumerator is equal //to that of the final count. Assert.Equals(k, testCol.Count); }
public LanguageService() : base() { Languages = new SynchronizedObservableCollection<LanguageOfService>(); }
public BookmarkManager() { _bookmarks = new SynchronizedObservableCollection<Station>(); }
private void search(string contactName) { if (!string.IsNullOrEmpty(contactName)) { if (_originalContactsCollection == null) _originalContactsCollection = Contacts; Contacts = ContactsManager.Current.SearchByFullName(contactName); } else { if (_originalContactsCollection == null) return; Contacts = _originalContactsCollection; _originalContactsCollection = null; } }
// Methods public AppSetting() : base() { LearningItems = new SynchronizedObservableCollection<LearningItem>(); DictionariesCollection = new SynchronizedObservableCollection<Dictionary>(); // default values FirstStart = DateTime.Today.ConvertToUTC(); NumberOfPrasesForUndestandingTest_ = 3; isFirstStart = true; }
public WordOfDictionary() : base() { created_at = DateTime.Today.ConvertToUTC(); last_updated_at = DateTime.Today.ConvertToUTC(); //DateOfRepetition = DateTime.Today; //ViewModelLocator.Instance.AppSetting.LearningWordStrategy.SetNextStep(this); //LearningWordStrategy.InitializeWord(this); translations = new SynchronizedObservableCollection<TranslationOfWord>(); selected_translation_ = new SynchronizedObservableCollection<TranslationOfWord>(); }
private void onGetingEndpointsCompleted(object sender, RunWorkerCompletedEventArgs e) { object addresses = e.Result; if (PeersInfo == null) PeersInfo = new SynchronizedObservableCollection<PeerInfo>(new ObservableCollection<PeerInfo>()); PeersInfo.Clear(); foreach (EndpointAddress endpointAddress in (IEnumerable<EndpointAddress>)addresses) { var peerInfo = new PeerInfo { Address = endpointAddress, HostName = endpointAddress.Uri.Host.ToUpper(), IsSyncAvailable = false }; PeersInfo.Add(peerInfo); } IsBusy = false; }
public void RefreshCache(string fieldName = null) { _orderByField = fieldName; Context.Refresh(RefreshMode.StoreWins, Context.Contacts); if (_contactsCache == null) _contactsCache = new SynchronizedObservableCollection<Contact>(new ObservableCollection<Contact>()); // _contactsCache.Clear(); _contactsCache = new SynchronizedObservableCollection<Contact>(new ObservableCollection<Contact>(orderContactsByField(fieldName))); if (CacheChanged != null) CacheChanged.Invoke(this, EventArgs.Empty); //foreach (Contact contact in orderContactsByField(fieldName)) //{ // _contactsCache.Add(contact); //} }
public ResultOfParsingMKV() { dicSub = new Dictionary<int, Subtitles>(); AudioTracks = new SynchronizedObservableCollection<AudioTrack>(); }
/// <summary> /// Method for refreshing local Companies cache. /// </summary> public void RefreshCache(string orderByField = null) { _orderByField = orderByField; Context.Refresh(RefreshMode.StoreWins, Context.Companies); if (_companiesCache == null) _companiesCache = new SynchronizedObservableCollection<Company>(new ObservableCollection<Company>()); _companiesCache.Clear(); foreach (Company company in orderCompaniesByField(orderByField)) { _companiesCache.Add(company); } }
//public SubtitleItem SubtitleItem_reference { get; set; } /* private SynchronizedObservableCollection<FormsOfWord> word_forms_; public virtual SynchronizedObservableCollection<FormsOfWord> word_forms { get { return word_forms_; } set { Set(() => word_forms, ref word_forms_, value); } } */ public WordOfDictionary() : base() { created_at = DateTime.Today; last_updated_at = DateTime.Today; DateOfRepetition = DateTime.Today; translations = new SynchronizedObservableCollection<TranslationOfWord>(); selected_translation_ = new SynchronizedObservableCollection<TranslationOfWord>(); AddSelectedTranslation_Command = new RelayCommand<TranslationOfWord>(AddSelectedTranslation_Cmd); DeleteSelectedTranslation_Command = new RelayCommand<TranslationOfWord>(DeleteSelectedTranslation_Cmd); }
// Methods public Statistics() : base() { StatByDay = new SynchronizedObservableCollection<StatisticsItem>(); }
public LearningItem() : base() { SubtitleCollection = new SynchronizedObservableCollection<Subtitles>(); SpeechVolume = 50; NumberOfPrasesForUndestandingTest = 3; }
public SubtitleItem() : base() { WordsCollection = new SynchronizedObservableCollection<Word>(); }
public AppWnd_ViewModel() { LongTasks = new SynchronizedObservableCollection<ProgressBar_Model>(); if (!IsInDesignMode) { WindowTitle = Tx.T("AppWnd.ApplicationHeader") + " " + Assembly.GetExecutingAssembly().GetName().Version; } if (IsInDesignMode) { LongTasks.Add(new ProgressBar_Model() { Text = "A very long task", IsIndeterminate =true, Title="This is a title"}); WindowTitle = "Open learning player 1.1.1.2"; } }
public LearningWordStrategy() : base() { StrategyItems = new SynchronizedObservableCollection<StrategyItem>(); }
// Methods public AppSetting() : base() { LearningItems = new SynchronizedObservableCollection<LearningItem>(); DictionariesCollection = new SynchronizedObservableCollection<Dictionary>(); FirstStart = DateTime.Today.Date; }
public FrequencyDictionary() : base() { Items = new SynchronizedObservableCollection<Item>(); Range = new SynchronizedObservableCollection<RangeOfSpeechParts>(); }
public async Task<SynchronizedObservableCollection<StoreItemExt>> GetStoreItems(int from =0,int quantity = 0) { SynchronizedObservableCollection<StoreItemExt> itemsext = new SynchronizedObservableCollection<StoreItemExt>(); List<StoreItem> items = await WebAPI_LearningItems.GetCollection(from,quantity); foreach (StoreItem item in items) { StoreItemExt itemext = item.Clone<StoreItem,StoreItemExt>(); itemext.LearningItem = EFDbContext.Context.Find<LearningItem>(new UUID(itemext.id)); itemext.isInstalled = itemext.LearningItem != null; itemext.CoverFileFullPath = UriHelper.Combine(new string[] { StaticProperties.StoreAddress,"App_Data",itemext.id.ToString(),itemext.CoverFile}); itemext.UpdateDownloadButtonStatus(); itemsext.Add(itemext); } return itemsext; }
public Language() : base(){ ProcessingWordsRules = new SynchronizedObservableCollection<ProcessingWordsRules>(); DictionariesCollection = new SynchronizedObservableCollection<Dictionary>(); }
/// <summary> /// Search Company by name. /// </summary> /// <param name="companyName">Company Name</param> private void search(string companyName) { if (!string.IsNullOrEmpty(companyName)) { if (_originalCompaniesCollection == null) _originalCompaniesCollection = Companies; Companies = CompaniesManager.Current.Search("Name", companyName); } else { if (_originalCompaniesCollection == null) return; Companies = _originalCompaniesCollection; _originalCompaniesCollection = null; } }