Beispiel #1
0
        /// <summary>
        /// Open therapist window
        /// </summary>
        public void OpenAddTherapistWindow()
        {
            if (_group == null || _group.Length < 1 || _indiv == null | _indiv.Length < 1)
            {
                return;
            }

            var dialog = new Dialog.Dialog();

            dialog.Title        = "Add New Therapist";
            dialog.QuestionText = "Please give a name to the new therapist.";

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    string mKeySetName = dialog.ResponseText;
                    therapistListViewModel.AllTherapists.Add(Therapist.CreateTherapist(mKeySetName));
                    using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, "Therapists.json"), false))
                    {
                        Therapists mCollector = new Therapists();
                        mCollector.PrimaryTherapists = therapistListViewModel.AllTherapists;

                        file.WriteLine(JsonConvert.SerializeObject(mCollector));
                    }
                    MessageBox.Show("Successfully added: " + dialog.ResponseText);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Open condition window
        /// </summary>
        public void OpenAddConditionDialog()
        {
            if (_group == null || _indiv == null || _eval == null || _group.Length < 1 || _indiv.Length < 1 || _eval.Length < 1)
            {
                return;
            }

            var dialog = new Dialog.Dialog();

            dialog.Title        = "Add New Condition";
            dialog.QuestionText = "Please give a name to the new condition.";

            if (dialog.ShowDialog() == true)
            {
                try
                {
                    DirectoryInfo di2 = Directory.CreateDirectory(Properties.Settings.Default.SaveLocation + "\\" + _group + "\\" + _indiv + "\\" + _eval + "\\" + dialog.ResponseText + "\\");
                    _cond = "";
                    conditionListViewModel.RefreshRepository(_group, _indiv, _eval);
                    MessageBox.Show("Successfully Created: " + dialog.ResponseText);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Open individual window
        /// </summary>
        public void OpenAddIndividualDialog()
        {
            if (_group == null || _group.Length < 1)
            {
                return;
            }

            var dialog = new Dialog.Dialog();

            dialog.Title        = "Add New Individual";
            dialog.QuestionText = "Please give a name to the new individual.";

            if (dialog.ShowDialog() == true)
            {
                DirectoryInfo di2 = Directory.CreateDirectory(Path.Combine(Properties.Settings.Default.SaveLocation, _group, dialog.ResponseText));
                _indiv = _eval = _cond = "";
                individualListViewModel.RefreshRepository(_group);
                evaluationListViewModel.AllEvaluations.Clear();
                conditionListViewModel.AllConditions.Clear();
                collectorListViewModel.AllCollectors.Clear();
                keyboardListViewModel.AllKeyboards.Clear();
                therapistListViewModel.AllTherapists.Clear();

                MessageBox.Show("Successfully Created: " + dialog.ResponseText);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Open group window
        /// </summary>
        public void OpenAddGroupDialog()
        {
            var dialog = new Dialog.Dialog();

            dialog.Title        = "Add New Group";
            dialog.QuestionText = "Please give a name to the new group.";
            if (dialog.ShowDialog() == true)
            {
                try
                {
                    DirectoryInfo di2 = Directory.CreateDirectory(Path.Combine(Properties.Settings.Default.SaveLocation, dialog.ResponseText));
                    _group = _indiv = _eval = _cond = "";
                    groupListViewModel.RefreshRepository();
                    individualListViewModel.AllIndividuals.Clear();
                    evaluationListViewModel.AllEvaluations.Clear();
                    conditionListViewModel.AllConditions.Clear();
                    collectorListViewModel.AllCollectors.Clear();
                    keyboardListViewModel.AllKeyboards.Clear();
                    therapistListViewModel.AllTherapists.Clear();
                    MessageBox.Show("Successfully Created: " + dialog.ResponseText);
                }
                catch (IOException e)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Open save dialog
        /// </summary>
        public void OpenSaveLocationDialog()
        {
            var dialog = new Dialog.Dialog();

            dialog.Title        = "Set Default Save Location";
            dialog.QuestionText = "Please set the default location for save files.";
            dialog.ResponseText = Properties.Settings.Default.SaveLocation;
            dialog.ShowDialog();

            if (Directory.Exists(dialog.ResponseText))
            {
                Properties.Settings.Default.SaveLocation = dialog.ResponseText;
                Properties.Settings.Default.Save();
                SaveLocation = Properties.Settings.Default.SaveLocation;
            }
            else
            {
                MessageBox.Show("This location doesn't seem to exist or isn't available.  Are you sure this is the correct location?");
            }
        }
Beispiel #6
0
        /// <summary>
        /// Open add keyboard window
        /// </summary>
        public void OpenAddKeyboardDialog()
        {
            if (_group == null || _group.Length < 1 || _indiv == null | _indiv.Length < 1)
            {
                return;
            }

            bool editingCurrent = false;

            var editDialog = new DialogEditYesNo();

            if (_keys != null && _keys.Length > 0)
            {
                editDialog.QuestionText = "Do you want new keys or to edit: " + _keys;

                if (editDialog.ShowDialog() == true)
                {
                    editingCurrent = editDialog.ReturnedAnswer;
                }
            }

            if (editingCurrent && editDialog.Clicked)
            {
                var mModel = new KeyboardScreenViewModel();
                mModel.PatientName = _indiv;
                mModel.GroupName   = _group;
                mModel.FileName    = _keys;

                var kbWindow = new KeyboardScreen();
                kbWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                kbWindow.DataContext           = mModel;

                mModel.SetupKeysEditing(editingCurrent);

                if (kbWindow.ShowDialog() == true)
                {
                    using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, _keys + ".json"), false))
                    {
                        file.WriteLine(JsonConvert.SerializeObject(mModel.mReturnedKeys));
                    }

                    MessageBox.Show("Successfully Edited Keyboard: " + _keys);

                    FrequencyKeys.Clear();
                    DurationKeys.Clear();

                    keyboardListViewModel.RefreshRepository(_group, _indiv);
                }
            }
            else if (!editingCurrent)
            {
                var dialog = new Dialog.Dialog();
                dialog.Title        = "Add New Key Set";
                dialog.QuestionText = "Please give a name to the new key set.";

                if (dialog.ShowDialog() == true)
                {
                    string mKeySetName = dialog.ResponseText;

                    var mModel = new KeyboardScreenViewModel();
                    mModel.PatientName      = _indiv;
                    mModel.GroupName        = _group;
                    mModel.CurrentlyEditing = editingCurrent;
                    mModel.FileName         = mKeySetName;

                    Window MainWindow2 = Application.Current.MainWindow;
                    var    kbWindow    = new KeyboardScreen();
                    kbWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                    kbWindow.DataContext           = mModel;

                    if (kbWindow.ShowDialog() == true)
                    {
                        using (StreamWriter file = new StreamWriter(Path.Combine(Properties.Settings.Default.SaveLocation, _group, _indiv, mKeySetName + ".json"), false))
                        {
                            file.WriteLine(JsonConvert.SerializeObject(mModel.mReturnedKeys));
                        }

                        MessageBox.Show("Successfully Created Keyboard: " + mKeySetName);

                        FrequencyKeys.Clear();
                        DurationKeys.Clear();

                        keyboardListViewModel.RefreshRepository(_group, _indiv);
                    }
                }
            }
        }