コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DmsDatasetViewModel"/> class. 
 /// </summary>
 /// <param name="datasetInfo">
 /// Existing data set to edit.
 /// </param>
 public DmsDatasetViewModel(DmsLookupUtility.UdtDatasetInfo? datasetInfo = null)
 {
     if (datasetInfo != null)
     {
         this.DatasetId = datasetInfo.Value.DatasetId;
         this.Dataset = datasetInfo.Value.Dataset;
         this.Experiment = datasetInfo.Value.Experiment;
         this.Organism = datasetInfo.Value.Organism;
         this.Instrument = datasetInfo.Value.Instrument;
         this.Created = datasetInfo.Value.Created;
         this.DatasetFolderPath = datasetInfo.Value.DatasetFolderPath;
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DmsLookupViewModel"/> class.
        /// </summary>
        public DmsLookupViewModel()
        {
            this.SearchCommand = new RelayCommand(this.SearchImpl, () => !string.IsNullOrWhiteSpace(this.dataSetFilter) && this.numberOfWeeks > 0);
            this.OpenCommand   = new RelayCommand(
                async() => await this.OpenImpl(),
                () => this.Datasets.Any(ds => ds.Selected) &&
                this.ValidateDataSet() &&
                !string.IsNullOrEmpty(this.OutputDirectory) &&
                Directory.Exists(this.OutputDirectory) && !this.IsCopying);
            this.CancelCommand = new RelayCommand(this.CancelImpl);
            this.BrowseOutputDirectoriesCommand = new RelayCommand(this.BrowseOutputDirectoriesImpl);

            this.ShouldCopyFiles         = true;
            this.Status                  = false;
            this.NumberOfWeeks           = 10;
            this.Datasets                = new ObservableCollection <DmsDatasetViewModel>();
            this.AvailableFiles          = new ObservableCollection <string>();
            this.dmsLookupUtility        = new DmsLookupUtility();
            this.OutputDirectory         = string.Empty;
            this.CopyStatusText          = string.Empty;
            this.cancellationTokenSource = new CancellationTokenSource();

            // Update file list when dataset is selected/deselected.
            MessengerInstance.Register <PropertyChangedMessage <bool> >(
                this,
                args =>
            {
                if (args.Sender is DmsDatasetViewModel && args.PropertyName == "Selected")
                {
                    var availableFiles = this.Datasets.Where(ds => ds.Selected).SelectMany(ds => ds.GetAvailableFiles());
                    this.AvailableFiles.Clear();
                    foreach (var file in availableFiles)
                    {
                        this.AvailableFiles.Add(Path.GetFileName(file));
                    }

                    this.OpenCommand.RaiseCanExecuteChanged();
                }
            });
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DmsLookupViewModel"/> class.
        /// </summary>
        public DmsLookupViewModel()
        {
            this.SearchCommand = new RelayCommand(this.SearchImpl, () => !string.IsNullOrWhiteSpace(this.dataSetFilter) && this.numberOfWeeks > 0);
            this.OpenCommand = new RelayCommand(
                                                async () => await this.OpenImpl(), 
                                                () => this.SelectedDataset != null &&
                                                      !string.IsNullOrEmpty(this.SelectedDataset.DatasetFolderPath) &&
                                                      !string.IsNullOrEmpty(this.OutputDirectory) &&
                                                      Directory.Exists(this.OutputDirectory) && !this.IsCopying);
            this.CancelCommand = new RelayCommand(this.CancelImpl);
            this.BrowseOutputDirectoriesCommand = new RelayCommand(this.BrowseOutputDirectoriesImpl);

            this.ShouldCopyFiles = true;
            this.Status = false;
            this.NumberOfWeeks = 10;
            this.Datasets = new ObservableCollection<DmsDatasetViewModel>();
            this.AvailableFiles = new ObservableCollection<string>();
            this.dmsLookupUtility = new DmsLookupUtility();
            this.SelectedDataset = new DmsDatasetViewModel();
            this.OutputDirectory = string.Empty;
            this.CopyStatusText = string.Empty;
            this.cancellationTokenSource = new CancellationTokenSource();
        }