Esempio n. 1
0
        public void LoadRecords(IEnumerable<IEnumerable<string>> newRecords, string fileName)
        {
            var enumerable = newRecords as IList<IEnumerable<string>> ?? newRecords.ToList();

            Title = fileName;
            Records = new RecordsCollection(enumerable.Select(i => i.ToList()).ToList());
            sourceCollection = enumerable.ToCompleteList();
        }
        public static AnalyzeDataViewModelBase GetModel(AnalyzeType analyzeType, RecordsCollection records)
        {
            if (!Dictionary.ContainsKey(analyzeType))
            {
                throw new NotImplementedException();
            }

            return Dictionary[analyzeType](records);
        }
        private void SelectionChanged(DataGridSelectionChangedMessage message)
        {
            selectedCollection = message.Records;
            forceHide = false;
            hasChanges = false;

            CurrentSelector = GetSelector();
            ApplyCommand.RaiseCanExecuteChanged();

            RaisePropertyChanged(() => CurrentSelector);
            RaisePropertyChanged(() => IsVisible);
        }
        private static void DataGridSelectionChanged(SelectedCellsChangedEventArgs args, RecordsCollection data)
        {
            if (!args.AddedCells.Any())
            {
                data.SelectedRow = -1;
                data.SelectedHeader = -1;

                return;
            }

            data.SelectedRow = data.Records.IndexOf((ObservableCollection<string>)args.AddedCells[0].Item);
            data.SelectedHeader = args.AddedCells[0].Column.DisplayIndex;

            ServiceLocator.Current.GetInstance<Messenger>().Send(new DataGridSelectionChangedMessage(data));
        }
        protected AnalyzeDataViewModelBase(RecordsCollection records, AnalyzeType type, string title)
        {
            Records = records;
            SelectedType = type;
            Title = title;
            MessengerInstance = ServiceLocator.Current.GetInstance<Messenger>();
            AnalyzeCommand = new RelayCommand(
                () =>
                    {
                        AnalyzeDataExecute();
                        CloseRequested = true;
                    },
                AnalyzeDataCanExecute);

            GroupHeaders = ExtractHeaders().ToObservable();
            Criteria = ExtractHeaders().Where(IsAcceptableForCriteria).ToObservable();
        }
 public static void SetDataSource(UIElement element, RecordsCollection value)
 {
     element.SetValue(DataSourceProperty, value);
 }
        private static void BindHeaders(DataGrid dataGrid, RecordsCollection data)
        {
            var indexer = 0;

            foreach (var column in data.Headers)
            {
                dataGrid.Columns.Add(CreateDataGridColumn(column, indexer));
                ++indexer;
            }
        }
        private static void BindData(DataGrid dataGrid, RecordsCollection data)
        {
            dataGrid.Columns.Clear();
            if (data == null)
            {
                return;
            }

            BindRows(dataGrid);
            BindHeaders(dataGrid, data);
        }
Esempio n. 9
0
 public MiddleMeanViewModel(RecordsCollection records)
     : base(records, AnalyzeType.MiddleMean, Strings.MiddleMean)
 {
 }
Esempio n. 10
0
 public MeanChanceViewModel(RecordsCollection records)
     : base(records, AnalyzeType.MeanChance, Strings.MeanChance)
 {
 }
 public SaveRecordsToFileMessage(RecordsCollection records, string filePath)
 {
     Records = records;
     FilePath = filePath;
 }
 public PearsonCorrelationViewModel(RecordsCollection records)
     : base(records, AnalyzeType.PearsonCorrelation, Strings.CorrelationCoefficient)
 {
 }
 public DataGridSelectionChangedMessage(RecordsCollection records)
 {
     Records = records;
 }
Esempio n. 14
0
 public void ResetToSource()
 {
     Records = new RecordsCollection(sourceCollection);
     Records.UpdateRowsAndHeaders();
 }
Esempio n. 15
0
 public TabViewModel(string title, List<List<string>> list)
 {
     Title = title;
     Records = new RecordsCollection(list);
     sourceCollection = list;
 }
Esempio n. 16
0
 public TabViewModel(string title)
 {
     Title = title;
     Records = new RecordsCollection();
     sourceCollection = new List<List<string>>();
 }