void scsvm_DerivedWSCollectionUpdated(SingleConfigViewModel scvm) { this.Dispatcher.Invoke(DispatcherPriority.Render, new Action ( delegate() { CreateUnifiedDataTable(); })); }
public UnifiedHeightViewModel(SingleConfigViewModel scvm, AllConfigsViewModel acvm, double height) { _height = height; _scvm = scvm; _acvm = acvm; _acvm.PossibleUnifiedHeights.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(PossibleUnifiedHeights_CollectionChanged); OnPropertyChanged("PossibleColumns"); }
void OnCompositeUpdated(SingleConfigViewModel config) { this.Dispatcher.Invoke(DispatcherPriority.Render, new Action ( delegate() { PossibleConfig.Add(config); CreateUnifiedDataTable(); })); }
void OnWorkspaceRequestClose(object sender, EventArgs e) { SingleConfigViewModel workspace = sender as SingleConfigViewModel; workspace.Dispose(); this.Configs.Remove(workspace); PossibleConfig.Remove(workspace); UnifiedSetUp.ConfigHeaderRow.Remove(workspace.DisplayName); if (Configs.Count == 0) { AlphaCollection = null; } CreateUnifiedDataTable(); }
//unified set up properties public AllConfigsViewModel(List <SessionColumnCollection> Collections) { foreach (SessionColumnCollection collection in Collections) { SingleConfigViewModel sccv = new SingleConfigViewModel(collection); if (!Configs.Contains(sccv)) { Configs.Add(sccv); } } UnifiedSetUp = new UnifiedConfigSetUpViewModel(this); SingleConfigDerivedWS = new ObservableCollection <SingleConfigShearViewModel> () { { new SingleConfigShearViewModel() } }; }
public AllConfigsViewModel(SingleConfigViewModel scvm) { if (Configs.Count == 0) { Configs.Add(new SingleConfigViewModel()); Configs[0] = scvm; } else { if (!Configs.Contains(scvm)) { Configs.Add(scvm); } } UnifiedSetUp = new UnifiedConfigSetUpViewModel(this); SingleConfigDerivedWS = new ObservableCollection <SingleConfigShearViewModel>(); SingleConfigDerivedWS.Add(new SingleConfigShearViewModel()); }
//todo: avalailable comp heights public SingleConfigShearViewModel(SingleConfigViewModel scvm, string datasetname) { _collection = scvm; _shearedWS = new ShearedWS(scvm.ColumnCollection); _sourceDataSetName = datasetname; }
void LoadFile() { Filename = WindART.Utils.GetFile(); //Console.WriteLine("filename has been set inside view model " + Filename); if (string.IsNullOrEmpty(Filename)) { return; } if (Path.GetExtension(Filename) != ".csv") { MessageBox.Show("File must be in .csv format"); return; } //Console.WriteLine("Viewmodel thinks filename length is > 0"); FileIsLoading = true; try { worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; DataRepository repository = new DataRepository(Filename, DataSourceType.CSV); Console.WriteLine(repository.ToString()); repository.FileOpening += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); repository.FileLoading += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); repository.FileLoaded += new DataRepository.FileProgressEventHandler(repository_UpdateProgress); worker.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs args) { //Console.WriteLine("work complete"); }; worker.DoWork += delegate(object sender, DoWorkEventArgs args) { DataTable data = repository.GetAllData(); this.Dispatcher.UnhandledException += delegate(object s, DispatcherUnhandledExceptionEventArgs a) { Console.WriteLine(a.Exception.Message); }; this.Dispatcher.Invoke(DispatcherPriority.Normal, new Action ( delegate() { SingleConfigViewModel thisConfig = new SingleConfigViewModel(new SessionColumnCollection(data), data); thisConfig.DisplayName = Path.GetFileNameWithoutExtension(Filename); Console.WriteLine(thisConfig.DisplayName); // 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; if (Workspace == null) { AllConfigsVM = new AllConfigsViewModel(thisConfig); Workspace = AllConfigsVM; Console.WriteLine("allconfigs created"); } else { AllConfigsVM.Configs.Add(thisConfig); // Console.WriteLine("added new config at index " + AllConfigsVM.Configs.IndexOf(thisConfig)); } })); FileIsLoading = false; }; worker.RunWorkerAsync(); } catch (Exception e) { MessageBox.Show(e.Message); } }