private async void Button1_Click(object sender, EventArgs e) { string value = System.Configuration.ConfigurationManager.AppSettings["eventName"]; string eventNamePattern; //MessageBox.Show("val is: " + value + " much"); if (value == "text") { eventNamePattern = @"\w*[a-zA-Z]\w*"; } else { eventNamePattern = "(.*?)"; } string eventName = StringChanger.ChangeFirstLetterCase(eventText.Text); bool isEventNameValid = Regex.IsMatch(eventText.Text, eventNamePattern); if (!isEventNameValid) { add <string> conct = Concate; GenError <string>(conct("Please enter a valid event name, you entered - ", eventText.Text)); //MessageBox.Show("Please enter a valid event name"); } else { confirmButton.Enabled = false; LoadingScreen ls = new LoadingScreen(); ls.Open(); EmotDetector ed = new EmotDetector(); string emotions = await ed.WhatEmot(path, fileName); emotions = emotions.Replace("\"", ""); //MessageBox.Show(emotions); //creating enum Emotion emos = new Emotion(); int i = 0; string[] emotionArray = emotions.Split(','); if (emotionArray[0] == "") { emos = Emotion.UNKNOWN; emotions = "UNKNOWN"; } else { foreach (string emotion in emotionArray) { if (i == 0) { emos = (Emotion)Enum.Parse(typeof(Emotion), emotion); add <int> sum = AddNumber; i = sum(i, 1); //i++; } else { emos = emos | (Emotion)Enum.Parse(typeof(Emotion), emotion); } } } string binaryEmotions = Convert.ToString((int)emos, 2); // Send found emotions to loading screen ls.setEmotions(emotions); Byte[] image = File.ReadAllBytes(fileDir); Info info = new Info(eventName, emos); IEquatable <Info> narrow = info; if (Info.index > 1 && dublicateBox.Checked) { EventArgs arg = new EventArgs(); PossiblyDublicateUploads(this, arg); } else { //this.tableTableAdapter.Insert(info, image); //this.tableTableAdapter.Update(this.appData.Table); using (var context = new Database1Entities()) { context.Photoinfoes.Add(new Photoinfo(info, image)); context.SaveChanges(); } } ls.WaitForClose(); confirmButton.Enabled = true; if (Info.index > 2) { Info infoCurrent = info[Info.index - 1]; if (infoCurrent.emotion == 0 && info[Info.index - 2].emotion == 0 && info[Info.index - 3].emotion == 0) { int counter = 1; for (int n = Info.index - counter; n >= 0 && info[n].emotion == 0; n--) { counter++; } MultipleUnknownPhotosEventArgs arg = new MultipleUnknownPhotosEventArgs(counter - 1); PossiblyBadReferencePicture(arg); } //MessageBox.Show(info[0].eventName + '\n' + // info[1].eventName + '\n' + // info[2].eventName); } } }
public static void InviteReuploadRefPhoto(MultipleUnknownPhotosEventArgs e) { var invReuploadRefForm = new InvitationReuploadRefPhotoForm(e.HowManyUnknownInaRow); invReuploadRefForm.ShowDialog(); }