Beispiel #1
0
        /// <summary>
        /// Interface method
        /// </summary>
        public void GroupChangeInterfaceMethod(string value)
        {
            _group = value;

            individualListViewModel.IndividualListModelUpdate(_group);
            evaluationListViewModel.AllEvaluations.Clear();
            conditionListViewModel.AllConditions.Clear();
            keyboardListViewModel.AllKeyboards.Clear();
            collectorListViewModel.AllCollectors.Clear();
            therapistListViewModel.AllTherapists.Clear();

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

            _indiv = _eval = _cond = _keys = _collect = "";
        }
Beispiel #2
0
        /// <summary>
        /// Interface method
        /// </summary>
        public void IndividualChangeInterfaceMethod(string value)
        {
            _indiv = value;

            evaluationListViewModel.EvaluationListModelUpdate(_group, _indiv);
            conditionListViewModel.AllConditions.Clear();
            keyboardListViewModel.AllKeyboards.Clear();
            collectorListViewModel.AllCollectors.Clear();
            therapistListViewModel.AllTherapists.Clear();

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

            _eval = _cond = _keys = _collect = "";

            if (_group == null || _group.Length < 1 || _indiv == null || _indiv.Length < 1)
            {
                return;
            }

            keyboardListViewModel.RefreshRepository(_group, _indiv);
            collectorListViewModel.RefreshRepository(_group, _indiv);
            therapistListViewModel.RefreshRepository(_group, _indiv);
        }
Beispiel #3
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);
                    }
                }
            }
        }