コード例 #1
0
ファイル: ProcessIcon.cs プロジェクト: yangliGit/desktopPet
        /// <summary>
        /// Displays the icon in the system tray.
        /// </summary>
        public void SetIcon(System.IO.MemoryStream icon, string petName, string aboutAuthor, string aboutTitle, string aboutVersion, string aboutInfo)
        {
            bool success = true;

            try
            {
                ni.Icon = new Icon(icon, 32, 32);
                ContextMenus.UpdateIcon(ni.Icon, petName, aboutAuthor, aboutTitle, aboutVersion, aboutInfo);
                ni.Text = petName + " Desktop Pet";
            }
            catch (Exception)
            {
                success = false;
            }
            if (!success)
            {
                try
                {
                    StartUp.AddDebugInfo(StartUp.DEBUG_TYPE.error, "Animation ICON is invalid (icon converter is on the webpage)");
                    ni.Icon = new Icon(Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), 32, 32);
                    ContextMenus.UpdateIcon(ni.Icon, petName, aboutAuthor, aboutTitle, aboutVersion, aboutInfo);
                }
                catch (Exception) { } // probably thread error.
            }
        }
コード例 #2
0
ファイル: ProcessIcon.cs プロジェクト: rluiten/desktopPet
 /// <summary>
 /// Displays the icon in the system tray.
 /// </summary>
 public void SetIcon(System.IO.MemoryStream icon, string petName, string aboutAuthor, string aboutTitle, string aboutVersion, string aboutInfo)
 {
     ni.Icon = new Icon(icon, 32, 32);
     ContextMenus.UpdateIcon(ni.Icon, petName, aboutAuthor, aboutTitle, aboutVersion, aboutInfo);
     ni.Text = petName + " Desktop Pet";
 }