public void DockLast() { var window = DialogExtensions.GetAll <PlotWindow>().LastOrDefault(); if (window != null) { Dock(window.DataContext); } }
PlotViewModel ConvertToViewModel(Object obj) { if (obj is PlotValue) { return(_contexts.FirstOrDefault(m => Object.ReferenceEquals(m.Plot, obj)) ?? DialogExtensions.GetAll <PlotWindow>(). Select(m => m.DataContext as PlotViewModel). Where(m => m != null). FirstOrDefault(m => Object.ReferenceEquals(m.Plot, obj))); } return(obj as PlotViewModel); }
public void Dock(Object obj) { var context = ConvertToViewModel(obj); if (context != null) { App.Current.Dispatcher.Invoke(() => { DialogExtensions.GetAll <PlotWindow>().Where(m => Object.ReferenceEquals(m.DataContext, context)).ForEach(window => { Display(context); window.Close(); }); }); } }