public MainForm() { InitializeComponent(); word = new WordSearchClassifier(); cvWord = new ClassifierValidator(word); cvWord.OnClassifierScored += CvWord_OnClassifierScored; }
private void MainForm_Load(object sender, EventArgs e) { if (!File.Exists("api.key")) { ApiKeyForm keyForm = new ApiKeyForm(); if (keyForm.ShowDialog() != DialogResult.OK || !File.Exists("api.key")) { MessageBox.Show("You need to set up an Azure API key and web service first!", "Spam ML", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } else { string apikey = File.ReadAllText("api.key"); string endpoint = ConfigurationManager.AppSettings["AzureEndpoint"]; azure = new AzureMachineLearningClassifier(apikey, endpoint); azure.OnMessagesClassified += Ws_OnMessagesClassified; cvAzure = new ClassifierValidator(azure); cvAzure.OnClassifierScored += Cv_OnClassifierScored; } }