public PixelArtEditor(int pixels, IPixelArtToolbox toolbox, IProject project, ILog log, INotificator notificator) { // Wywalanie wyjątków. if (log == null && notificator == null) { throw new NullReferenceException("log i notificator są puste"); } else if (log == null) { Exception error = new NullReferenceException(Factory.GetProgrammerErrorString("log nie może być pusty.", true)); notificator.Notify(error); throw error; } else if (notificator == null) { Exception error = new NullReferenceException(Factory.GetProgrammerErrorString("notificator nie może być pusty.", true)); log.Write(error.Message); throw error; } else if (toolbox == null) { Exception error = new NullReferenceException(Factory.GetProgrammerErrorString("toolbox nie może być pusty.", true)); log.Write(error.Message); throw error; } // Inicjalizacja komponentów. InitializeComponent(); // Przypisywanie. pixelsValue = pixels; this.toolbox = toolbox; this.notificator = notificator; this.project = project; this.log = log; this.pixels = new PictureBox[pixelsValue, pixelsValue]; // Tworzenie menu. MainMenu menu = new MainMenu(); Menu = menu; MenuItem miFile = new MenuItem("Plik"); miFile.MenuItems.Add(new MenuItem("Nowy", miNew_Click)); miFile.MenuItems.Add(new MenuItem("Zapisz", miSave_Click)); miFile.MenuItems.Add(new MenuItem("Wczytaj", miLoad_Click)); MenuItem miSettings = new MenuItem("Ustawienia", miSettings_Click); miSettings.MenuItems.Add(new MenuItem("Blokuj Rozmiar Siatki", miBlockNetSize_Click)); Menu.MenuItems.Add(miFile); Menu.MenuItems.Add(miSettings); Reload(); }
static public PixelArtEditor ShowPixelArtEditor(int pixels, int realPixelsPerPixel, IPixelArtToolbox toolbox, IProject project, ILog log, INotificator notificator) { PixelArtEditor form = new PixelArtEditor(pixels, toolbox, project, log, notificator); form.Show(); form.FormClosed += OpenForm_FormClosed; openForms.Add(form); form.RealPixelsPerEditorPixels = realPixelsPerPixel; return(form); }
static public PixelArtEditor ShowPixelArtEditor(int pixels, int realPixelsPerPixel, IPixelArtToolbox toolbox, IProject project) { return(ShowPixelArtEditor(pixels, realPixelsPerPixel, toolbox, project, StandardLog, StandardNotificator)); }