|
|
|
@ -25,7 +25,7 @@ public class ChartImage |
|
|
|
|
// initialize the ChartImage |
|
|
|
|
mFullPath = fullPath ; |
|
|
|
|
mJsonConfig = new JsonConfig( config ) ; |
|
|
|
|
mImage = Image.FromFile( fullPath ) ; |
|
|
|
|
mImage = null ; // nb: we load this on demand |
|
|
|
|
|
|
|
|
|
// parse the shortcut |
|
|
|
|
ILog logger = LogManager.GetLogger( "shortcuts" ) ; |
|
|
|
@ -155,8 +155,24 @@ public class ChartImage |
|
|
|
|
) ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Image image() |
|
|
|
|
{ |
|
|
|
|
// return the image data |
|
|
|
|
// NOTE: It would be nice to reuse the ImageListView cache, but it only seems to cache thumbnails. |
|
|
|
|
if ( mImage == null ) { |
|
|
|
|
try { |
|
|
|
|
mImage = Image.FromFile( mFullPath ) ; |
|
|
|
|
} catch( Exception ex ) { |
|
|
|
|
// NOTE: This crashes on Linux, but we can live with that - ChartImage's are created by iterating |
|
|
|
|
// over files in the data directory, so if we can't load the file, it'll be because the file was deleted |
|
|
|
|
// after startup, or a permissions problem i.e. things we don't really need to worry about. |
|
|
|
|
Program.showErrorMsg( $"Can't load image file:\n {mFullPath}\n\n{ex}" ) ; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return mImage ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public JsonConfig jsonConfig { get { return mJsonConfig ; } } |
|
|
|
|
public Image image { get { return mImage ; } } |
|
|
|
|
public ImageListViewItem imageListViewItem { get { return mImageListViewItem ; } } |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|