Example #1
0
        private void openFileButton_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (openFileDialog.SafeFileName.EndsWith(".json"))
                {
                    tweetsPath = openFileDialog.FileName;
                    tweetDatas = JsonFileController.ReadDataFromJsonFile <TweetData[]>(tweetsPath);

                    // RegisterUsers() should be called before ParseTweets()
                    // because we check words array is null or not in RegisterUsers().
                    RegisterUsers();
                    ParseTweets();

                    // save parsed tweets to json file.
                    JsonFileController.WriteToJsonFile(tweetsPath, tweetDatas);

                    // Navigate to first tweet.
                    NavigateLabeledData_Click(null, new EventArgs());

                    FillTweetInfo();
                }
                else
                {
                    MessageBox.Show("Please choose a json file.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (fileChanged)
            {
                DialogResult dialogResult = MessageBox.Show("Would you like to save changed datas to file?", "Data Changed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                switch (dialogResult)
                {
                case DialogResult.None:
                    break;

                case DialogResult.OK:
                    break;

                case DialogResult.Cancel:
                    e.Cancel = true;
                    break;

                case DialogResult.Abort:
                    break;

                case DialogResult.Retry:
                    break;

                case DialogResult.Ignore:
                    break;

                case DialogResult.Yes:
                    JsonFileController.WriteToJsonFile(tweetsPath, tweetDatas);
                    break;

                case DialogResult.No:
                    break;

                default:
                    break;
                }
            }
            Application.Exit();
        }
Example #3
0
 private void btnSaveANN_Click(object sender, EventArgs e)
 {
     trainer.trainingType = trainedType;
     JsonFileController.WriteToJsonFile(Path.Combine(nnParentPath, TrainDataFile), trainer);
 }
Example #4
0
 private void WriteToFile_Click(object sender, EventArgs e)
 {
     JsonFileController.WriteToJsonFile(tweetsPath, tweetDatas);
     fileChanged = false;
 }