Ejemplo n.º 1
0
        public BoardViewModel()
        {
            WardNode = WardNode.StartWardNodeAsSystem(WebConfiguration.DefaultWebConfiguration);

            Patients = new ObservableCollection <PatientViewModel>();
            Patients.CollectionChanged += Patients_CollectionChanged;

            WardNode.PatientAdded   += WardNode_PatientAdded;
            WardNode.PatientRemoved += WardNode_PatientRemoved;

            WardNode.PatientChanged += WardNode_PatientChanged;
            WardNode.Patients.ToList().ForEach(p => Patients.Add(new PatientViewModel(p)
            {
                RoomNumber = _roomNumber++
            }));
        }
Ejemplo n.º 2
0
        public void ReorganizeDragAndDroppedPatients(object droppedData, object targetData)
        {
            var droppedPatientView = ((IDataObject)droppedData).GetData(typeof(PatientViewModel)) as PatientViewModel;
            var targetPatientView  = targetData as PatientViewModel;

            if (droppedPatientView == null)
            {
                return;
            }
            if (targetPatientView == null)
            {
                return;
            }

            var removedIdx = Patients.IndexOf(droppedPatientView);
            var targetIdx  = Patients.IndexOf(targetPatientView);

            if (removedIdx < targetIdx)
            {
                Patients.Insert(targetIdx + 1, droppedPatientView);
                Patients.RemoveAt(removedIdx);
            }
            else
            {
                var remIdx = removedIdx + 1;
                if (Patients.Count + 1 <= remIdx)
                {
                    return;
                }
                Patients.Insert(targetIdx, droppedPatientView);
                Patients.RemoveAt(remIdx);
            }

            Task.Factory.StartNew(() =>
            {
                _roomNumber = 1;
                Patients.ToList().ForEach(
                    p =>
                {
                    p.RoomNumber = _roomNumber++;
                    WardNode.UpdatePatient(p.Patient);
                });
            });
        }
        public MobileApplicationViewModel()
        {
            DefaultFontSize = 35;

            SelectedUser = new PatientViewModel(new Patient());
            Patients     = new ObservableCollection <PatientViewModel>();

            Patients.CollectionChanged += Patients_CollectionChanged;

            bool found = false;

            WardNode.WardNodeFound += (sender, config) =>
            {
                if (found)
                {
                    return;
                }
                found     = true;
                _wardNode = _wardNode = WardNode.StartWardNodeAsClient(config);

                _wardNode.PatientAdded   += WardNode_PatientAdded;
                _wardNode.PatientRemoved += WardNode_PatientRemoved;
                _wardNode.PatientChanged += WardNode_PatientChanged;


                Application.Current.Dispatcher.Invoke(() => _wardNode.Patients.ToList().ForEach(p => Patients.Add(new PatientViewModel(p)
                {
                    RoomNumber = _roomNumber++
                })));
            };
            WardNode.FindWardNodes();

            //_wardNode = WardNode.StartWardNodeAsSystem(WebConfiguration.DefaultWebConfiguration);
            //_wardNode.PatientAdded += WardNode_PatientAdded;
            //_wardNode.PatientRemoved += WardNode_PatientRemoved;
            //_wardNode.PatientChanged += WardNode_PatientChanged;


            //Application.Current.Dispatcher.Invoke(() => _wardNode.Patients.ToList().ForEach(p => Patients.Add(new PatientViewModel(p) { RoomNumber = _roomNumber++ })));

            MessageFlag = MessageFlags.Comment.ToString();

            InitializeDevice();
        }
Ejemplo n.º 4
0
 private void AddNewAnonymousPatient()
 {
     WardNode.AddPatient(new Patient());
 }
Ejemplo n.º 5
0
 void PatientUpdated(object sender, EventArgs e)
 {
     WardNode.UpdatePatient((Patient)sender);
 }