예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
        private void LoadDefaultIcon(string Location)
        {
            Image img = LayoutObjects.CreateImage();

            img.Source = LayoutObjects.GetIcon(Location);
            TheEventsHolder.Children.Add(img);
        }
예제 #4
0
 //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));
     }
 }
예제 #5
0
 public void CreateIconFromexe(string Location)
 {
     System.Windows.Controls.Image img = LayoutObjects.CreateImage();
     img.Source   = LayoutObjects.GetIcon(Location);
     ShortcutIcon = img;
 }