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; }
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) { int dropIndex = appGrabber.QuickLaunch.IndexOf(replacedApp); appGrabber.InsertByPath(fileNames, dropIndex, AppCategoryType.QuickLaunch); } 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(); } setParentAutoHide(true); e.Handled = true; }
private void LaunchProgram(object sender, RoutedEventArgs e) { MenuItem item = (MenuItem)sender; ApplicationInfo app = item.DataContext as ApplicationInfo; // so that we only prompt to always run as admin if it's done consecutively if (app.AskAlwaysAdmin) { app.AskAlwaysAdmin = false; appGrabber.Save(); } if (!app.IsStoreApp && app.AlwaysAdmin) { Shell.StartProcess(app.Path, "", "runas"); } else if (!Shell.StartProcess(app.Path)) { CairoMessage.Show("The file could not be found. If you just removed this program, try removing it using the right-click menu to make the icon go away.", "Oops!", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void miProgramsChangeCategory_Click(object sender, RoutedEventArgs e) { MenuItem mi = sender as MenuItem; object[] appNewCat = mi.DataContext as object[]; ApplicationInfo ai = appNewCat[0] as ApplicationInfo; Category newCat = appNewCat[1] as Category; ai.Category.Remove(ai); newCat.Add(ai); appGrabber.Save(); }
private void btnSave_Click(object sender, RoutedEventArgs e) { appGrabber.Save(); this.Close(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { appGrabber.Save(); this.Close(); }