private void OnFormClosing(object sender, FormClosingEventArgs e) { if (_session != null) { _session.Dispose(); _session = null; } }
private void OnLoad(object sender, EventArgs e) { picSource.Image = new Bitmap(_paths[0]); picMask.Image = new Bitmap(_paths[1]); var session = InpaintingSession.Make(_paths[0], _paths[1]); if (session == null) { MessageBox.Show("Failed to create the inpainting session", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } _session = session; }