Exemplo n.º 1
0
        private void PatientImport_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new OpenFileDialog {
                Multiselect = true
            };

            if (dialog.ShowDialog() == true)
            {
                var spinner = new LoadingSpinner();
                ApplicationManager.SetContent(spinner);

                spinner.Start();
                this.MainMenu.IsEnabled = false;

                SyntheaRunner.ParsingSyntheaData += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Parsing Patient records."); }));
                };

                SyntheaRunner.StoringSyntheaData += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Storing Patient records."); }));
                };

                SyntheaRunner.FinishedSynthea += (o, args) =>
                {
                    this.Dispatcher.BeginInvoke(
                        new Action(
                            () =>
                    {
                        this.MainMenu.IsEnabled = true;
                        ApplicationManager.SetContent(new PatientCreation());
                    }));
                };

                var parsedPatients = SyntheaRunner.ParsePatientFromFiles(dialog.FileNames);
                SyntheaRunner.StoreParsedPatients(parsedPatients);
            }
        }
Exemplo n.º 2
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var spinner = new LoadingSpinner();

            ApplicationManager.SetContent(spinner);

            spinner.Start();

            SyntheaRunner.StartingSynthea += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Creating Patient records."); }));
            };

            SyntheaRunner.ParsingSyntheaData += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Parsing Patient records."); }));
            };

            SyntheaRunner.StoringSyntheaData += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { spinner.SetText("Storing Patient records."); }));
            };

            SyntheaRunner.FinishedSynthea += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(new Action(() => { ApplicationManager.SetContent(new PatientCreation()); }));
            };

            var amount        = ((TextBox)this.FindName("PatientAmount"))?.Text;
            var patientAmount = amount != null?int.Parse(amount) : 0;

            Task.Run(
                () =>
            {
                var patients = SyntheaRunner.CreatePatients(patientAmount, ApplicationManager.CurrentSyntheaVersion);
                this.Dispatcher.BeginInvoke(new Action(() => { ApplicationManager.SetContent(new PatientList(patients)); }));
            });
        }