FolderWidget/frmMain.cs
/// <summary>
/// Get the icon of the currently added item, 
/// if possible to extract ICO or PNG file then it will use it
/// if not, deafult icon would set by the item extension
/// </summary>
Get the icon of the currently added item,
if possible to extract ICO or PNG file then it will use it
if not, deafult icon would set by the item extension
Get the icon of the currently added item if possible to extract ICO or PNG file then it will use it if not deafult icon would set by the item extension
private dynamic GetIcon(DataRow dr)
        {
            if (!string.IsNullOrEmpty(dr["Icon"].ToString()))
            {
                Image img = (new Bitmap(Image.FromFile(ConfigurationManager.AppSettings["IconPath"] + dr["Icon"].ToString() + ".png"), new Size(48, 48)));
                return img;
            }
            var fileExtension = Path.GetExtension(dr["Path"].ToString());
            dynamic icon = string.Empty;
            if (string.IsNullOrEmpty(fileExtension))
            {
                icon = Resources.folder;
                if (dr["Path"].ToString().Split(',').Count() > 1)
                {
                    icon = Resources.Layers;
                }
            }
            else
            {
                if (dr["Path"].ToString().Split(',').Count() > 1)
                {
                    icon = Resources.Layers;
                }
                else
                {
                    if (fileExtension.Equals(".lnk"))
                    {
                        icon = Resources.software;
                    }
                    else
                    {
                        if (fileExtension.Equals(".txt"))
                        {
                            icon = Resources.doc;
                        }
                        else
                        {
                            icon = Resources.Other;
                        }
                    }
                }
            }
            return icon;
        }
private dynamic GetIcon ( DataRow dr ) { if ( ! string . IsNullOrEmpty ( dr [ " " ] . ToString ( ) ) ) { Image img = ( new Bitmap ( Image . FromFile ( ConfigurationManager . AppSettings [ " " ] + dr [ " " ] . ToString ( ) + " " ) , new Size ( 48 , 48 ) ) ) ; return img ; } var fileExtension = Path . GetExtension ( dr [ " " ] . ToString ( ) ) ; dynamic icon = string . Empty ; if ( string . IsNullOrEmpty ( fileExtension ) ) { icon = Resources . folder ; if ( dr [ " " ] . ToString ( ) . Split ( ' ' ) . Count ( ) > 1 ) { icon = Resources . Layers ; } } else { if ( dr [ " " ] . ToString ( ) . Split ( ' ' ) . Count ( ) > 1 ) { icon = Resources . Layers ; } else { if ( fileExtension . Equals ( " " ) ) { icon = Resources . software ; } else { if ( fileExtension . Equals ( " " ) ) { icon = Resources . doc ; } else { icon = Resources . Other ; } } } } return icon ; }
Get the icon of the currently added item,
if possible to extract ICO or PNG file then it will use it
if not, deafult icon would set by the item extension
Get the icon of the currently added item if possible to extract ICO or PNG file then it will use it if not deafult icon would set by the item extension
dr
DataRow