示例#1
0
 public ScreensaverVM()
 {
     // Set screen saver to activate after 1 minute
     _timeoutTimer  = ThreadPoolTimer.CreateTimer(TimeoutTimer_Tick, TimeSpan.FromMinutes(1));
     ImageSource    = new BitmapImage(DeviceInfoPresenter.GetBoardImageUri());
     ImageWidth     = 200;
     ImageHeight    = 200;
     IsImageVisible = true;
 }
        public async Task UpdateNetworkInfo()
        {
            this.DeviceName   = DeviceInfoPresenter.GetDeviceName();
            this.IpAddress1   = NetworkPresenter.GetCurrentIpv4Address();
            this.NetworkName1 = NetworkPresenter.GetCurrentNetworkName();

            var networkInfos = await NetworkPresenter.GetNetworkInformation();

            this.NetworkInfos = new ObservableCollection <NetworkPresenter.NetworkInfo>(networkInfos);
        }
        private void UpdateBoardInfo()
        {
            BoardName = DeviceInfoPresenter.GetBoardName();

            ulong version = 0;

            if (!ulong.TryParse(Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamilyVersion, out version))
            {
                var loader = new Windows.ApplicationModel.Resources.ResourceLoader();
                OsVersion = loader.GetString("OSVersionNotAvailable");
            }
            else
            {
                OsVersion = String.Format(CultureInfo.InvariantCulture, "{0}.{1}.{2}.{3}",
                                          (version & 0xFFFF000000000000) >> 48,
                                          (version & 0x0000FFFF00000000) >> 32,
                                          (version & 0x00000000FFFF0000) >> 16,
                                          version & 0x000000000000FFFF);
            }
        }
        private async Task <bool> UpdateNetworkInfo()
        {
            DeviceName  = DeviceInfoPresenter.GetDeviceName();
            IPAddress   = NetworkPresenter.GetCurrentIpv4Address();
            NetworkName = NetworkPresenter.GetCurrentNetworkName();
            AppBuild    = Common.GetAppVersion();

            AzureHub      = IoTHubService?.HostName ?? Common.GetLocalizedText("NotAvailable");
            AzureDeviceId = IoTHubService?.DeviceId ?? Common.GetLocalizedText("NotAvailable");

            var networkInfoList = await NetworkPresenter.GetNetworkInformation();

            if (networkInfoList != null)
            {
                NetworkCollection.Clear();
                foreach (var network in networkInfoList)
                {
                    NetworkCollection.Add(new NetworkInfoDataTemplate(network));
                }
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Updates the prescription data to the database via the API.
        /// </summary>
        /// <param name="currentMode">Current operation mode of patient view</param>
        /// <param name="groups">The group of medicines administered</param>
        /// <param name="hasItem">Boolean value whether the container has the prescriptions or not</param>
        /// <returns></returns>
        private async Task <bool> UpdatePrescriptionDataAsync(int currentMode, IEnumerable <PrescriptionGroup> groups, bool hasItem)
        {
            int sentCount = 0;
            int grpCount  = groups.Count();

            if (currentMode == 1)
            {
                Mode = 0;

                if (hasItem)
                {
                    Debug.WriteLine("Item detected at prep mode");

                    foreach (PrescriptionGroup group in groups)
                    {
                        foreach (var item in group.Prescriptions)
                        {
                            // update count of medicine inventory and timestamp of dispensing
                            if (item.LoadedOn.HasValue == false)
                            {
                                var med = item.Medicine;
                                med.StocksLeft       -= item.Amount;
                                med.TimeLastDispensed = DateTime.Now;

                                item.Medicine = await imsSvc.UpdateMedicineInventoryAsync(med);
                            }

                            item.LoadedOn = DateTime.Now;
                            item.LoadedBy = App.LoggedUser.Username;
                            item.LoadedAt = DeviceInfoPresenter.GetDeviceName();
                        }

                        bool isDataSent = await imsSvc.UpdatePrescriptionsAsync(AdmittedPatient.ID, group.Prescriptions);

                        if (isDataSent)
                        {
                            sentCount++;
                        }
                    }
                    return(grpCount == sentCount);
                }
                else
                {
                    return(false);
                }
            }
            else if (currentMode == 3)
            {
                Mode = 0;

                if (!hasItem)
                {
                    Mode = 4;

                    Debug.WriteLine("Vacancy detected at rounds mode");

                    foreach (PrescriptionGroup group in groups)
                    {
                        foreach (var item in group.Prescriptions)
                        {
                            item.AdministeredOn = DateTime.Now;
                            item.AdministeredBy = App.LoggedUser.Username;
                        }

                        bool isDataSent = await imsSvc.UpdatePrescriptionsAsync(AdmittedPatient.ID, group.Prescriptions);

                        if (isDataSent)
                        {
                            sentCount++;
                        }
                    }
                    return(grpCount == sentCount);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
示例#6
0
 private void SetupDeviceNames()
 {
     DeviceName      = DeviceInfoPresenter.GetDeviceName();
     DeviceIpAddress = NetworkPresenter.GetCurrentIpv4Address();
 }
 private void UpdateBoardInfo()
 {
     BoardName  = DeviceInfoPresenter.GetBoardName();
     BoardImage = new BitmapImage(DeviceInfoPresenter.GetBoardImageUri());
     OSVersion  = Common.GetOSVersionString();
 }
示例#8
0
 private void UpdateNetworkInfo()
 {
     DeviceName  = DeviceInfoPresenter.GetDeviceName();
     IPv4Address = NetworkPresenter.GetCurrentIpv4Address();
 }