/// <summary>
        /// Add a input file.
        /// </summary>
        /// <param name="file">The path of the file</param>
        public async Task AddInputFile(string file)
        {
            switch (OutOfProcessHelper.TestSourceFile(file))
            {
            //File is corrupt pdf.
            case OutOfProcessHelper.SourceTestResult.Unreadable:
                //Tell the user the pdf is corrupt.
                Application.Current.Dispatcher.BeginInvoke(new Action(() => ((MetroWindow)Application.Current.MainWindow).ShowMessageAsync("The file " + Path.GetFileName(file) + " could not be opened as a PDF or image", "Some thing went wrong when opening " + Path.GetFileName(file))));
                break;

            //File is a valid pdf.
            case OutOfProcessHelper.SourceTestResult.Ok:
                //Add the pdf to the ListBox.
                Application.Current.Dispatcher.Invoke(new Action(() => Files.Add(new PDFItem(file, null))));
                break;

            //File is a image (maybe not valid!).
            case OutOfProcessHelper.SourceTestResult.Image:
                break;
            }
            //Update Commands
            Application.Current.Dispatcher.Invoke(() => MergeCommand.RaiseCanExecuteChanged());
            MoveUpCommand.RaiseCanExecuteChanged();
            MoveDownCommand.RaiseCanExecuteChanged();
            Application.Current.Dispatcher.Invoke(() => RemoveCommand.RaiseCanExecuteChanged());
        }
Exemplo n.º 2
0
 void RefreshCommands()
 {
     //CloneViewCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     MoveDownCommand.RaiseCanExecuteChanged();
     MoveUpCommand.RaiseCanExecuteChanged();
 }
Exemplo n.º 3
0
 private void RefreshCommands()
 {
     AddDeviceCommand.RaiseCanExecuteChanged();
     MoveUpCommand.RaiseCanExecuteChanged();
     MoveDownCommand.RaiseCanExecuteChanged();
     DeleteDeviceCommand.RaiseCanExecuteChanged();
 }
        private void RaiseRefreshView(bool refreshCollectionView)
        {
            DeleteJobCommand.RaiseCanExecuteChanged();
            MergeJobsCommand.RaiseCanExecuteChanged();
            MergeAllJobsCommand.RaiseCanExecuteChanged();
            MoveUpCommand.RaiseCanExecuteChanged();
            MoveDownCommand.RaiseCanExecuteChanged();

            if (refreshCollectionView)
            {
                JobInfos.Refresh();
            }
        }
        private void Move(bool up)
        {
            //The selected item
            PDFItem dataItem = Files[SelectedIndex];
            int     index    = SelectedIndex;

            if (!up)
            {
                index--;
            }
            if (up)
            {
                index++;
            }
            Files.Remove(dataItem);
            Files.Insert(index, dataItem);
            SelectedIndex = 0;
            SelectedIndex = index;
            MoveDownCommand.RaiseCanExecuteChanged();
            MoveUpCommand.RaiseCanExecuteChanged();
        }