示例#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 = "";
        }
示例#2
0
        /// <summary>
        /// Remove duration button
        /// </summary>
        void DurationRemoveButton()
        {
            if (SelectedDurationString == null || SelectedDurationString.KeyDescription.Length < 1)
            {
                return;
            }

            var mCopy = new ObservableCollection <KeyDefinitions>(DurationKeys);

            foreach (var item in mCopy)
            {
                if (item.KeyName == SelectedDurationString.KeyName)
                {
                    DurationKeys.Remove(item);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Add duration button
        /// </summary>
        void DurationButton()
        {
            var dialog = new AddKeyDialog();

            dialog.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            if (dialog.ShowDialog() == true)
            {
                if (dialog.ResponseText.Length == 0 || ((Button)dialog.buttonKey).Content.ToString().Contains("PRESS") || ((Button)dialog.buttonKey).Content.ToString().Contains("Press") || ((Button)dialog.buttonKey).Content.ToString().Length == 0)
                {
                    MessageBox.Show("The data you submitted was missing or incomplete!");
                }
                else
                {
                    DurationKeys.Add(new KeyDefinitions
                    {
                        KeyName        = ((Button)dialog.buttonKey).Content.ToString(),
                        KeyDescription = dialog.ResponseText,
                        KeyCode        = dialog.KeyValue
                    });
                }
            }
        }
示例#4
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);
        }
示例#5
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);
                    }
                }
            }
        }