void HandleSearchPropertyChanged(object?sender, PropertyChangedEventArgs e) { if (sender is not SearchViewModel searchViewModel) { return; } if (e.PropertyName != nameof(searchViewModel.Operation)) { return; } if (this._lastSearchOperation != null) { BindingOperations.DisableCollectionSynchronization(this._lastSearchOperation.Results); BindingOperations.DisableCollectionSynchronization(this._lastSearchOperation.SearchErrors); } BindingOperations.EnableCollectionSynchronization( searchViewModel.Operation.Results, searchViewModel.Operation.ResultsLocker); BindingOperations.EnableCollectionSynchronization( searchViewModel.Operation.SearchErrors, searchViewModel.Operation.SearchErrorsLocker); this._lastSearchOperation = searchViewModel.Operation; }
public void Dispose() { // Dispose each item ProgressionSlots?.ForEach(x => x.Dispose()); // Disable collection synchronization BindingOperations.DisableCollectionSynchronization(ProgressionSlots); }
public void Dispose() { DisplayName?.Dispose(); // Disable collection synchronization BindingOperations.DisableCollectionSynchronization(InstalledGames); BindingOperations.DisableCollectionSynchronization(NotInstalledGames); }
private void NewsButton_MouseDown(object sender, MouseButtonEventArgs e) { TaskButton.UpdateColorToStart(); NewsButton.UpdateColorToEnd(); Items.ItemsSource = ((UserViewModels)DataContext).NormalUsers; BindingOperations.DisableCollectionSynchronization(((UserViewModels)DataContext).Admins); BindingOperations.EnableCollectionSynchronization(((UserViewModels)DataContext).NormalUsers, Items.ItemsSource); }
/// <summary> /// Disposes the directory and its containing files /// </summary> public virtual void Dispose() { // Disable collection synchronization BindingOperations.DisableCollectionSynchronization(Files); BindingOperations.DisableCollectionSynchronization(this); // Dispose files Files.DisposeAll(); }
public UserTab() { InitializeComponent(); this.DataContext = new UserViewModels(); NewsButton.Locked = true; Items.ItemsSource = ((UserViewModels)DataContext).NormalUsers; BindingOperations.DisableCollectionSynchronization(((UserViewModels)DataContext).Admins); BindingOperations.EnableCollectionSynchronization(((UserViewModels)DataContext).NormalUsers, Items.ItemsSource); }
public void method_2() { object @lock = this._lock; lock (@lock) { BindingOperations.DisableCollectionSynchronization(this.Filtered); this.Filtered = new ObservableCollection <TreeNode>(this.Filtered.Where(new Func <TreeNode, bool>(this.method_11))); BindingOperations.EnableCollectionSynchronization(this.Filtered, this._lock); } }
private void DeleteSpellCommand_Executed(object sender, ExecutedRoutedEventArgs e) { if (this.GetSpellCollection(this.TabControl_Spellbook.SelectedIndex).SelectedItem is Spell s) { object o = new object(); BindingOperations.EnableCollectionSynchronization(this[this.TabControl_Spellbook.SelectedIndex], o); this[this.TabControl_Spellbook.SelectedIndex].Remove(s); BindingOperations.DisableCollectionSynchronization(this[this.TabControl_Spellbook.SelectedIndex]); //this.GetSpellCollection(this.TabControl_Spellbook.SelectedIndex) } }
private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { viewModel.StatusText = ""; var newTab = e.AddedItems[0]; if (newTab != ScheduleTab) { foreach (var schedule in viewModel.Schedule) { BindingOperations.DisableCollectionSynchronization(schedule); } return; } string message = null; if (viewModel.Students.Count == 0) { message = "Nincsenek résztvevők!"; newTab = ParticipantsTab; } if (message != null) { viewModel.StatusText = message; viewModel.MagicPossible = false; SaveButton.IsEnabled = false; // we don't activate newTab here anymore, because it caused weird behaviour } else if (newTab == ScheduleTab) { viewModel.InitSchedule(); for (int i = 0; i < kcs.Length; i++) { if (i < viewModel.Teachers.Count) { BindingOperations.GetBindingExpression(kcs[i], ItemsControl.ItemsSourceProperty).UpdateTarget(); BindingOperations.GetBindingExpression(kcs[i], HeaderedItemsControl.HeaderProperty).UpdateTarget(); } else { kcs[i].Visibility = Visibility.Collapsed; } } viewModel.Algorithm = new Algorithms(viewModel, _lock); viewModel.MagicPossible = true; foreach (var schedule in viewModel.Schedule) { BindingOperations.EnableCollectionSynchronization(schedule, _lock); } } } }
protected override void OnSourceChanged(object oldSource, object newSource) { if (oldSource is IEnumerable oldEnumerable && IsSynchronized) { BindingOperations.DisableCollectionSynchronization(oldEnumerable); } if (newSource is IEnumerable newEnumerable && IsSynchronized) { BindingOperations.EnableCollectionSynchronization(newEnumerable, _lock); } }
private void OnIsSynchronizedChanged(DependencyPropertyChangedEventArgs args) { if (View != null && args.NewValue is bool value) { if (value) { BindingOperations.EnableCollectionSynchronization(View.SourceCollection, _lock); } else { BindingOperations.DisableCollectionSynchronization(View.SourceCollection); } } }
protected override void OnDispose() { ProcessModelItemCollection(0, mi => { if (mi.GetCurrentValue() is TDev2TOFn dto) { CEventHelper.RemoveAllEventHandlers(dto); } CEventHelper.RemoveAllEventHandlers(mi); }); if (ModelItemCollection != null) { BindingOperations.DisableCollectionSynchronization(ModelItemCollection); } ModelItemCollection = null; base.OnDispose(); }
public void UpdateOff() { BindingOperations.DisableCollectionSynchronization(ShemedTabItems); }
public void DisableConfigBinding(MainWindow configWindow) { configWindow.Dispatcher.Invoke(() => { BindingOperations.DisableCollectionSynchronization(inventory); }); }
/// <summary> /// Запретить обновление из потока Патерн MVVM /// </summary> public void UpdateOff() { BindingOperations.DisableCollectionSynchronization(XmlFiles); }
public void Disable(IEnumerable collection) { BindingOperations.DisableCollectionSynchronization(collection); }
/// <summary> /// Запретить обновление из потока Pattern MvVM /// </summary> public void UpdateOff(ObservableCollection <FileDb> modelPrint) { BindingOperations.DisableCollectionSynchronization(modelPrint); }
public void UpdateOff() { BindingOperations.DisableCollectionSynchronization(ShemesFilesReport); }
public void DisableConfigBinding(MainWindow configWindow) { configWindow.Dispatcher.Invoke(() => { BindingOperations.DisableCollectionSynchronization(criminalrecord); }); }
private void DBOperator(object state) { //Check dbonline or not. if (this.mDatabase is null) { try { this.mDatabase = new Database(); } catch { return; } } try { var locker = new object(); BindingOperations.EnableCollectionSynchronization(this.FileList, locker); var rmlist = this.mDatabase.LoadData().ToList(); foreach (var item in rmlist) { UploadFile hit = null; try { hit = FileList.Where(x => x.ID == item.ID).First(); } catch { }; if (hit is null) { try { var mf = new UploadFile(item, mDatabase); this.Execute(() => FileList.Add(mf)); } catch { $"[{item.ID}] [{item.FullFilePath}] ERROR, FILE NOT EXIST!".ErrorLognConsole(); } } else { hit.UpdateFile(item.FullFilePath); } } List <UploadFile> mlist = new List <UploadFile>(); foreach (var item in FileList) { if (!item.IsOver && !rmlist.Any(y => item.ID == y.ID)) { mlist.Add(item); } } foreach (var item in mlist) { this.Execute(() => FileList.Remove(item)); } BindingOperations.DisableCollectionSynchronization(this.FileList); FileList.ForEach(x => x.RefreshData()); this.TotalLength = FileList.Sum(x => x.Length); this.Processed = FileList.Sum(x => x.IsOver ? x.Length : 0); } catch { Console.WriteLine("OOPS! DB not good!"); return; } }
public static void DisableCollectionSynchronization(this IEnumerable source) { BindingOperations.DisableCollectionSynchronization(source); }
/// <summary> /// Запретить обновление из потока Патерн MVVM /// </summary> public void UpdateOff() { BindingOperations.DisableCollectionSynchronization(SchemesXlsx); }