Example #1
0
        private void btnSaveSampleToFile_Click(object sender, EventArgs e)
        {
            if (this.state.pbState != null)
            {
                var descriptionForm = new SampleDescriptionForm();
                descriptionForm.ShowDialog();
                Stream         myStream;
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();

                saveFileDialog1.Filter           = "txt files (*.txt)|*.txt|All files (*.*)|*.*";
                saveFileDialog1.FilterIndex      = 2;
                saveFileDialog1.RestoreDirectory = true;

                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if ((myStream = saveFileDialog1.OpenFile()) != null)
                    {
                        var bytesToWrite = Encoding.UTF8.GetBytes(state.ToString());
                        myStream.Write(bytesToWrite, 0, bytesToWrite.Length);
                        myStream.Close();
                    }
                }
                MessageBox.Show(descriptionForm.getInput());
            }
        }
Example #2
0
        private void btnAddToSamples_Click(object sender, EventArgs e)
        {
            showInputImage_Click(sender, e);

            var descriptionForm = new SampleDescriptionForm();

            descriptionForm.ShowDialog();

            state.addSample(new Sample(descriptionForm.getInput(), state.pbState.imgArr));
        }