Exemplo n.º 1
0
        public MainForm()
        {
            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            if
            (
                !Enum.TryParse <DeviceType>
                (
                    Properties.Settings.Default.Device,
                    true,
                    out var type
                )
            )
            {
                throw new ApplicationException("Unknown device type supplied in app.config.");
            }

            GICore.Init(new Spec(type));
            InitializeComponent();
            InitializeDatasetDisplay();
            InitializeDrawing();
            InitializeTraining();
            InitializeTesting();
            InitializeDataset();

            Text += $" [Running on: {Device.Active.Type}]";
        }
Exemplo n.º 2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (training || evaluating)
            {
                MessageBox.Show("Cannot close while training or evaluation is in progress.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.Cancel = true;
                return;
            }

            RawData.Clean();
            DisposeDatasetDisplay();
            DisposeDrawing();
            DisposeTraining();
            DisposeTesting();
            DisposeDataset();
            GICore.Release();
        }