本文整理汇总了C#中System.Collections.ObservableCollection.ToObservableChangeSet方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.ToObservableChangeSet方法的具体用法?C# ObservableCollection.ToObservableChangeSet怎么用?C# ObservableCollection.ToObservableChangeSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.ObservableCollection
的用法示例。
在下文中一共展示了ObservableCollection.ToObservableChangeSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WindowViewModel
public WindowViewModel(IObjectProvider objectProvider,
IWindowFactory windowFactory,
ILogger logger,
IWindowsController windowsController,
RecentFilesViewModel recentFilesViewModel,
GeneralOptionsViewModel generalOptionsViewModel,
ISchedulerProvider schedulerProvider)
{
_logger = logger;
_windowsController = windowsController;
RecentFiles = recentFilesViewModel;
Views = new ObservableCollection<ViewContainer>();
GeneralOptions = generalOptionsViewModel;
_schedulerProvider = schedulerProvider;
_objectProvider = objectProvider;
InterTabClient = new InterTabClient(windowFactory);
DropMonitor = new FileDropMonitor();
OpenFileCommand = new Command(OpenFile);
ShowInGitHubCommand = new Command(()=> Process.Start("https://github.com/RolandPheasant"));
ZoomOutCommand= new Command(()=> { GeneralOptions.Scale = GeneralOptions.Scale + 5; });
ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; });
Version = "v" + Assembly.GetEntryAssembly().GetName().Version.ToString(3);
var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile);
var isEmptyChecker = Views.ToObservableChangeSet()
.ToCollection()
.Select(items=>items.Count)
.StartWith(0)
.Select(count=>count==0)
.Subscribe(isEmpty=> IsEmpty = isEmpty);
var openRecent = recentFilesViewModel.OpenFileRequest
.Subscribe(file =>
{
MenuIsOpen = false;
OpenFile(file);
});
_cleanUp = new CompositeDisposable(recentFilesViewModel,
isEmptyChecker,
fileDropped,
DropMonitor,
openRecent,
Disposable.Create(() =>
{
Views.Select(vc => vc.Content)
.OfType<IDisposable>()
.ForEach(d=>d.Dispose());
}));
}