private void btn_Drop(object sender, DragEventArgs e)
{
Button dropContainer = sender as Button;
ApplicationInfo replacedApp = dropContainer.DataContext as ApplicationInfo;
String[] fileNames = e.Data.GetData(DataFormats.FileDrop) as String[];
if (fileNames != null)
{
foreach (String fileName in fileNames)
{
appGrabber.AddByPath(fileNames, AppCategoryType.QuickLaunch);
int dropIndex = appGrabber.QuickLaunch.IndexOf(replacedApp);
ApplicationInfo addedApp = appGrabber.QuickLaunch[appGrabber.QuickLaunch.Count - 1];
appGrabber.QuickLaunch.Move(appGrabber.QuickLaunch.Count - 1, dropIndex);
appGrabber.Save();
}
}
else if (e.Data.GetDataPresent(typeof(ApplicationInfo)))
{
ApplicationInfo dropData = e.Data.GetData(typeof(ApplicationInfo)) as ApplicationInfo;
int initialIndex = appGrabber.QuickLaunch.IndexOf(dropData);
int dropIndex = appGrabber.QuickLaunch.IndexOf(replacedApp);
appGrabber.QuickLaunch.Move(initialIndex, dropIndex);
appGrabber.Save();
}
e.Handled = true;
}