private void OnSaveSnapshot() { string filename = "snapshot"; int i = 0; while (File.Exists(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"))) { i++; } _Snapshot.Save(Path.Combine(CSettings.sFolderProfiles, filename + i + ".png"), System.Drawing.Imaging.ImageFormat.Png); CProfiles.LoadAvatars(); LoadAvatars(); _Snapshot = null; CWebcam.Stop(); CDraw.RemoveTexture(ref _WebcamTexture); for (int j = 0; j < CProfiles.Avatars.Length; j++) { if (CProfiles.Avatars[j].FileName == (filename + i + ".png")) { CProfiles.SetAvatar(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection, j); break; } } Buttons[htButtons(ButtonSaveSnapshot)].Visible = false; Buttons[htButtons(ButtonDiscardSnapshot)].Visible = false; Buttons[htButtons(ButtonTakeSnapshot)].Visible = false; Buttons[htButtons(ButtonWebcam)].Visible = true; }