c# - Global Project Static Variables -


i have 3 windows libraries drawing different types of bitmaps. 1 thing share in common the: font, colors, , pens.

i design library have standard fonts, colors, , pens if make font change changed globally across other libraries.

for example: i've got 3 libraries draw onto bitmaps , use these same settings:

      internal static readonly font elevation_font = new font("segoe ui semibold", 7.9f),                                   detail_box_font = new font(fontfamily.genericserif, 8f, fontstyle.regular);//"palatino linotype"      internal static readonly color back_color_screen = color.black,                                    line_color_screen = color.fromargb(161, 161, 161),                                    back_color = color.white,                                    line_color = color.black; 

i create 1 library called mysoluctionnamedrawing , other libraries use these settings drawing onto bitmaps use ones mysoluctionnamedrawing.

this maintainability.

mysoluctionname name of solution, i'm sure point demo purposes.

anyone got ideas easiest , cleanest way have drawing related tools in 1 library , access them other libraries with-out making mess?


here i've come with.

drawing dll

namespace alumclouddrawing     {          public static class drawingoptions         {             public static readonly font elevation_font = new font("segoe ui semibold", 7.9f),                                             detail_box_font = new font(fontfamily.genericserif, 8f, fontstyle.regular);//"palatino linotype"                     public static readonly color back_color_screen = color.black,                                                  line_color_screen = color.fromargb(161, 161, 161),                                                  back_color = color.white,                                                  line_color = color.black;         }     } 

usage ref library depends on drawing dll library.

 internal static readonly font elevation_font = alumclouddrawing.drawingoptions.elevation_font,                                   detail_box_font = alumclouddrawing.drawingoptions.detail_box_font;      internal static readonly color back_color_screen = alumclouddrawing.drawingoptions.back_color_screen,                                    line_color_screen = alumclouddrawing.drawingoptions.line_color_screen,                                    back_color = alumclouddrawing.drawingoptions.back_color,                                    line_color = alumclouddrawing.drawingoptions.line_color; 

i follow pattern

/src     fooapp.sln                       -- solution file     /apps                            -- folder apps         /fooapp.core                 -- core project         /fooapp.drawing1             -- project references core         /fooapp.drawing2             -- project references core         /tests                           -- tests         /fooapp.core.test         /fooapp.drawing1.test         /fooapp.drawing2.test 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -