/// <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()); }
private void MoveDown(ColumnViewModel item) { var index = Columns.IndexOf(item); Columns.Move(index, index + 1); MoveUpCommand.RaiseCanExecuteChanged(); MoveDownCommand.RaiseCanExecuteChanged(); }
private void RefreshCommands() { AddDeviceCommand.RaiseCanExecuteChanged(); MoveUpCommand.RaiseCanExecuteChanged(); MoveDownCommand.RaiseCanExecuteChanged(); DeleteDeviceCommand.RaiseCanExecuteChanged(); }
void RefreshCommands() { //CloneViewCommand.RaiseCanExecuteChanged(); DeleteCommand.RaiseCanExecuteChanged(); MoveDownCommand.RaiseCanExecuteChanged(); MoveUpCommand.RaiseCanExecuteChanged(); }
void OnMoveDown() { var clause = SelectedClause; if (clause == null) { return; } clause.Container.MoveDown(clause); MoveUpCommand.RaiseCanExecuteChanged(); MoveDownCommand.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(); }
public void RefreshPosition() { MoveUpCommand.RaiseCanExecuteChanged(); MoveDownCommand.RaiseCanExecuteChanged(); }