public CustomProblemViewModel(INavigationService navigationService, IFilePathSelector filePathSelector)
        {
            this.SelectFilePathCommand = new SimpleCommand(() =>
            {
                string filePath = filePathSelector.GetFilePath();
                try
                {
                    var customProblemLoader  = new CustomProblemLoader(filePath);
                    this.customProblemLoader = customProblemLoader;
                    this.SelectedFilePath    = filePath;
                }
                catch
                {
                }
            }
                                                           , () => true);

            this.CreateSearchCommand = new SimpleCommand(() =>
            {
                if (this.customProblemLoader != null)
                {
                    navigationService.NavigateToSearch(this.customProblemLoader.CreateSearch(this.SelectedSearchMethod));
                }
            }
                                                         , () => true);
        }
Exemple #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="SampleCommand" /> class.
 /// </summary>
 /// <param name="sampleCommandProperties">The command properties</param>
 /// <param name="sheetRetriever">The sheet retriever</param>
 /// <param name="dataTableCreator">The data table creator</param>
 /// <param name="filePathSelector">The file path selector</param>
 /// <param name="dataWriter">The data writer</param>
 /// <param name="dialogService">The dialog service</param>
 public SampleCommand(
     [NotNull] IRvtCommandProperties <SampleCommand> sampleCommandProperties,
     [NotNull] IElementRetriever sheetRetriever,
     [NotNull] IDataTableCreator dataTableCreator,
     [NotNull] IFilePathSelector filePathSelector,
     [NotNull] IDataWriter dataWriter,
     [NotNull] IDialogService dialogService)
     : base(sampleCommandProperties)
 {
     _dialogService    = dialogService ?? throw new ArgumentNullException(nameof(dialogService));
     _filePathSelector = filePathSelector ?? throw new ArgumentNullException(nameof(filePathSelector));
     _dataWriter       = dataWriter ?? throw new ArgumentNullException(nameof(dataWriter));
     _dataTableCreator = dataTableCreator ?? throw new ArgumentNullException(nameof(dataTableCreator));
     _sheetRetriever   = sheetRetriever ?? throw new ArgumentNullException(nameof(sheetRetriever));
 }