private void ChangeIcon_Click(object sender, RoutedEventArgs e) { MenuItem mnu = sender as MenuItem; StackPanel mystp = null; if (mnu != null) { ContextMenu MyContextMenu = (ContextMenu)mnu.Parent; mystp = MyContextMenu.PlacementTarget as StackPanel; } Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".jpg"; dlg.Filter = SupportedIconExtensions; bool?result = dlg.ShowDialog(); if (result == true) { IconSourceLocation = dlg.FileName; if (Path.GetExtension(dlg.FileName).ToUpper() == ".ICO" || Path.GetExtension(dlg.FileName).ToUpper() == ".EXE") { ChangeImage(LayoutObjects.GetIcon(dlg.FileName)); } else { ChangeImage(LayoutObjects.GetImageSource(dlg.FileName)); } } Data.SaveIcons(HomePage.AppsList); }
private void EditBackgroundButton_g_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".jpg"; dlg.Filter = SupportedIconExtensions; bool?result = dlg.ShowDialog(); if (result == true) { IconSourceLocation = dlg.FileName; if (System.IO.Path.GetExtension(dlg.FileName).ToUpper() == ".ICO" || System.IO.Path.GetExtension(dlg.FileName).ToUpper() == ".EXE") { ChangeImage(LayoutObjects.GetIcon(dlg.FileName)); } else { ChangeImage(LayoutObjects.GetImageSource(dlg.FileName)); } //Remove the Text Before Replacing it with an Image foreach (object child in TheEventsHolder.Children) { if (child is Viewbox) { TheEventsHolder.Children.Remove(child as UIElement); break; } } Data.SaveShortcuts(Shortcuts.ShortcutItems); } }
private void LoadDefaultIcon(string Location) { Image img = LayoutObjects.CreateImage(); img.Source = LayoutObjects.GetIcon(Location); TheEventsHolder.Children.Add(img); }
//Load The Image which The User Have Choosen private void LoadCustomDesign(string ImageLocation) { if (System.IO.Path.GetExtension(ImageLocation).ToUpper() == ".ICO" || System.IO.Path.GetExtension(ImageLocation).ToUpper() == ".EXE") { ChangeImage(LayoutObjects.GetIcon(ImageLocation)); } else { ChangeImage(LayoutObjects.GetImageSource(ImageLocation)); } }
public void CreateIconFromexe(string Location) { System.Windows.Controls.Image img = LayoutObjects.CreateImage(); img.Source = LayoutObjects.GetIcon(Location); ShortcutIcon = img; }