public MainWindowViewModel() { AllConfigsVM = new AllConfigsViewModel( ); AllConfigsVM.Configs.Add(new SingleConfigViewModel()); Workspace = AllConfigsVM; }
public ProcessingViewModel() { WorkSpace = new AllConfigsViewModel(); SingleConfigViewModel scvm = new SingleConfigViewModel(null); WorkSpace.Configs.Add(scvm); }
void LoadFile() { Filename = WindART.Utils.GetFile(); if (Filename.Length < 1) { return; } FileIsLoading = true; if (AllConfigsVM == null) { AllConfigsVM = new AllConfigsViewModel(); } Workspace = AllConfigsVM; try { worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; DataRepository repository = new DataRepository(Filename, DataSourceType.CSV); repository.FileOpening += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); repository.FileLoading += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); repository.FileLoaded += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); worker.DoWork += delegate(object sender, DoWorkEventArgs args) { DataTable data = repository.GetAllData(); SingleConfigViewModel thisConfig = new SingleConfigViewModel(new SessionColumnCollection(data), data); thisConfig.DisplayName = Path.GetFileNameWithoutExtension(Filename); this.Dispatcher.Invoke(DispatcherPriority.DataBind, new Action ( delegate() { AllConfigsVM.Configs.Add(thisConfig); })); //need a better way to convert this collection to multithreaded oibservable ObservableCollection <ISessionColumn> colClxn = new MultiThreadObservableCollection <ISessionColumn>(); foreach (SessionColumn sc in thisConfig.ColumnCollection.Columns) { colClxn.Add(sc); } //add to an observable collection thisConfig.LiveCollection = colClxn; FileIsLoading = false; }; worker.RunWorkerAsync(); } catch (Exception e) { throw e; } }
public ProcessingViewModel(List <SessionColumnCollection> collections) { WorkSpace = new AllConfigsViewModel(collections); }