//TODO: ZUR(2016-11-22)
        //There is probably a much better way of doing this, but at the moment I just did this...
        //Can come back and clean it up later when we have the time and do it the better way
        private void button_export_finish_Click(object sender, RoutedEventArgs e)
        {
            int subject_id;

            if (string.IsNullOrEmpty(this.textBox_subject_id.Text))
            {
                window.ShowMessageAsync("Error", "Please enter a subject ID");
            }
            else if (int.TryParse(this.textBox_subject_id.Text, out subject_id) == false)
            {
                window.ShowMessageAsync("Error", "Please enter a valid subject ID");
            }
            else
            {
                if (subject_id < 0)
                {
                    window.ShowMessageAsync("Error", "Please enter a positive two digit ID");
                }
                else
                {
                    //just in case
                    subject_id = subject_id % 100;
                    int from_epochs;
                    if (int.TryParse(this.textBox_epochs_from.Text, out from_epochs) == false)
                    {
                        window.ShowMessageAsync("Error", "Please enter a valid 'from' epochs value.");
                    }
                    else
                    {
                        if (from_epochs < 1)
                        {
                            window.ShowMessageAsync("Error", "From epochs must be greater than 1");
                        }
                        else
                        {
                            int to_epochs;
                            if (int.TryParse(this.textBox_epochs_to.Text, out to_epochs) == false)
                            {
                                window.ShowMessageAsync("Error", "Please enter a valid 'length'");
                            }
                            else
                            {
                                if (to_epochs <= 0)
                                {
                                    window.ShowMessageAsync("Error", "Length of period must be greater than 0");
                                }
                                else
                                {
                                    signals_to_export = new ExportSignalModel(subject_id, from_epochs, to_epochs);
                                    this.DialogResult = true;
                                    DialogManager.HideMetroDialogAsync(window, this);
                                    pmv.ExportSignalsOutput(DialogResult, signals_to_export);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
 public ExportSignalModel(ExportSignalModel signals_to_export)
 {
     this.Subject_ID    = signals_to_export.Subject_ID;
     this.Epochs_From   = signals_to_export.Epochs_From;
     this.Epochs_Length = signals_to_export.Epochs_Length;
 }