public void Drop(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { GongSolutions.Wpf.DragDrop.DragDrop.DefaultDropHandler.Drop(dropInfo); var sourceIndex = dropInfo.DragInfo.SourceIndex; var insertIndex = dropInfo.InsertIndex; if (sourceIndex == insertIndex || sourceIndex == insertIndex - 1) { return; } var persons = (ObservableCollection <Person>)dropInfo.TargetCollection; if (persons.Count <= 1) { return; } var index = insertIndex - (sourceIndex < insertIndex ? 1 : 0); var person = persons[index]; person.Priority = index == 0 ? persons[1].Priority - 1 : index == persons.Count - 1 ? persons[persons.Count - 2].Priority + 1 : (persons[index - 1].Priority + persons[index + 1].Priority) / 2; Console.WriteLine(string.Join(", ", persons.OrderBy(p => p.Priority))); }
public void Drop(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { try { var files = ((DataObject)dropInfo.Data).GetFileDropList().Cast <string>().Where(name => System.IO.File.Exists(name)).ToList(); if (files.Count == 0) { return; } if (!this.ExistingTextEndProcess()) { return; } var file = files[0]; if (this.CurrentFileInfoViewModel.LoadCommand.CanExecute(file)) { this.CurrentFileInfoViewModel.LoadCommand.Execute(file); } } catch (Exception e) { var msg = String.Format( "Failed to load file, Exception={0}, InnerException={1}", e.Message, e.InnerException?.Message ?? "null" ); System.Windows.MessageBox.Show(this.WindowObject, msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error); System.Environment.Exit(1); } }
//========================================================== // IDropTarget インターフェースの実装 //========================================================== public void DragOver(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { var dragFileList = ((DataObject)dropInfo.Data).GetFileDropList().Cast <string>(); dropInfo.Effects = dragFileList.Any(dat => { var extension = Path.GetExtension(dat); return(extension != null && extension == ".wav" && IsPlay == false); }) ? DragDropEffects.Copy : DragDropEffects.None; }
public void DragOver(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { var sourceIndex = dropInfo.DragInfo.SourceIndex; var insertIndex = dropInfo.InsertIndex; if (sourceIndex == 0 || insertIndex == 0) { dropInfo.Effects = DragDropEffects.None; return; } GongSolutions.Wpf.DragDrop.DragDrop.DefaultDropHandler.DragOver(dropInfo); }
public void Drop(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { var dragFileList = ((DataObject)dropInfo.Data).GetFileDropList().Cast <string>(); dropInfo.Effects = dragFileList.Any(dat => { var extension = Path.GetExtension(dat); return(extension != null && extension == ".wav"); }) ? DragDropEffects.Copy : DragDropEffects.None; if (dragFileList.Count() >= 1) { LoadWavFile(dragFileList.ToArray()[0]); } }
public void DragOver(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { var files = ((DataObject)dropInfo.Data).GetFileDropList().Cast <string>(); dropInfo.Effects = files.Any(name => System.IO.File.Exists(name)) ? DragDropEffects.Copy : DragDropEffects.None; }
public void Drop(GongSolutions.Wpf.DragDrop.IDropInfo dropInfo) { }