Exemple #1
0
 public void RemoveIcon(DesktopIcon icon)
 {
     lock (syncRoot)
     {
         icons.Remove(icon);
     }
 }
        public List <DesktopIcon> GetDesktopIcons()
        {
            var desktopIcons = new List <DesktopIcon>();

            for (var i = 0; i < _systemListView.Count; i++)
            {
                var iconTitle    = _systemListView[i].Title;
                var iconPosition = _systemListView[i].Position;

                if (desktopIcons.Any(d => d.Title == iconTitle))
                {
                    Log.WriteLine("Duplicate icon name found: '{0}'.", iconTitle);

                    continue;
                }

                var desktopIcon = new DesktopIcon(iconTitle, iconPosition);

                desktopIcons.Add(desktopIcon);

                Log.WriteLine("Desktop icon count: '{0}'. Getting desktop icon '{1}' with positions '{2}'.",
                              desktopIcons.Count,
                              desktopIcon.Title,
                              desktopIcon.Position
                              );
            }

            return(desktopIcons);
        }
Exemple #3
0
 public void AddIcon(DesktopIcon icon)
 {
     lock (syncRoot)
     {
         icons.Add(icon);
     }
 }
Exemple #4
0
        public void Dispose()
        {
            lock (syncRoot)
            {
                if (iconImage == null)
                {
                    return;
                }

                iconImage.Dispose();
                iconImage = null;
                icon      = null;
            }
        }
Exemple #5
0
        /// <summary>
        /// Removes a Windows shortcut from the desktop.
        /// </summary>
        /// <param name="desktopIcon">Information about the shortcut to be removed.</param>
        /// <param name="machineWide">The shortcut was created machine-wide instead of just for the current user.</param>
        public static void Remove([NotNull] DesktopIcon desktopIcon, bool machineWide = false)
        {
            #region Sanity checks
            if (desktopIcon == null)
            {
                throw new ArgumentNullException("desktopIcon");
            }
            #endregion

            string filePath = GetDesktopPath(desktopIcon.Name, machineWide);
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
        }
Exemple #6
0
        /// <summary>
        /// Creates a new Windows shortcut on the desktop.
        /// </summary>
        /// <param name="desktopIcon">Information about the shortcut to be created.</param>
        /// <param name="target">The target the shortcut shall point to.</param>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        /// <param name="machineWide">Create the shortcut machine-wide instead of just for the current user.</param>
        public static void Create([NotNull] DesktopIcon desktopIcon, FeedTarget target, [NotNull] ITaskHandler handler, bool machineWide = false)
        {
            #region Sanity checks
            if (desktopIcon == null)
            {
                throw new ArgumentNullException("desktopIcon");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            #endregion

            string filePath = GetDesktopPath(desktopIcon.Name, machineWide);
            Create(filePath, target, desktopIcon.Command, handler, machineWide);
        }
Exemple #7
0
        /// <summary>
        /// Creates a new Windows shortcut on the desktop.
        /// </summary>
        /// <param name="desktopIcon">Information about the shortcut to be created.</param>
        /// <param name="target">The target the shortcut shall point to.</param>
        /// <param name="iconStore">Stores icon files downloaded from the web as local files.</param>
        /// <param name="machineWide">Create the shortcut machine-wide instead of just for the current user.</param>
        public static void Create(DesktopIcon desktopIcon, FeedTarget target, IIconStore iconStore, bool machineWide)
        {
            #region Sanity checks
            if (desktopIcon == null)
            {
                throw new ArgumentNullException(nameof(desktopIcon));
            }
            if (iconStore == null)
            {
                throw new ArgumentNullException(nameof(iconStore));
            }
            #endregion

            string filePath = GetDesktopPath(desktopIcon.Name, machineWide);
            Create(filePath, target, desktopIcon.Command, iconStore);
        }
Exemple #8
0
 /// <summary>
 /// A default desktop icon.
 /// </summary>
 /// <param name="icon"></param>
 /// <param name="iconImage"></param>
 public DefaultDesktopIcon(DesktopIcon icon, Image iconImage)
 {
 }
Exemple #9
0
 public static void Remove(DesktopIcon desktopIcon, bool machineWide)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
 public static void Create(DesktopIcon desktopIcon, FeedTarget target, bool machineWide, ITaskHandler handler)
 {
     throw new NotImplementedException();
 }
Exemple #11
0
 public static void Remove(DesktopIcon desktopIcon, bool machineWide) => throw new NotImplementedException();
Exemple #12
0
 public static void Create(DesktopIcon desktopIcon, FeedTarget target, IIconStore iconStore, bool machineWide) => throw new NotImplementedException();
 public static void Create(DesktopIcon desktopIcon, FeedTarget target, bool machineWide, ITaskHandler handler)
 {
     throw new NotImplementedException();
 }