Esempio n. 1
0
        internal async void Initilize()
        {
            //var url = String.Format(ApiBase.GetProfileKey, Constants.UserProfile.LabID);
            //var response = await AuthServices.Download(url);
            //if (response != null && response.Success && response.ImageData != null && response.ImageData.Length > 1)
            //{
            //    ProfilePhoto = ImageSource.FromStream(() =>
            //    {
            //        return new MemoryStream(response.ImageData);
            //    });
            //}
            //else
            //{
            //    ProfilePhoto = "dot.png";
            //}

            if (Settings.ProfilePhoto != string.Empty)
            {
                ProfilePhoto = ImageSource.FromStream(() =>
                {
                    return(new MemoryStream(Convert.FromBase64String(Settings.ProfilePhoto)));
                });
            }
            else
            {
                ProfilePhoto = "dot.png";
            }

            //LabCountVisibility = RadioCountVisibility = false;
            //var result = await ReportsService.GetLabReportsCount(Constants.UserProfile.Role, Constants.UserProfile.LabID);
            //if (result.Success)
            //{
            //    if (result.labCount > 0)
            //    {
            //        LabCount = result.labCount;
            //        LabCountVisibility = true;
            //    }
            //    if (result.radioCount > 0)
            //    {
            //        RadioCount = result.radioCount;
            //        RadioCountVisibility = true;
            //    }
            //}

            // Get Unseen Report Count
            var result = await ReportsService.GetLabReportsCount(Constants.UserProfile.Role, Constants.UserProfile.LabID);

            if (result.Success)
            {
                if (result.labCount > 0)
                {
                    //Settings.TotalLabortoryReportsCount = result.labCount;
                    Settings.TotalLabortoryReportsUnViewed = result.labCount;

                    LabCount           = Settings.TotalLabortoryReportsUnViewed;
                    LabCountVisibility = true;
                }
                if (result.radioCount > 0)
                {
                    //Settings.TotalRadiologyReportsCount = result.radioCount;
                    Settings.TotalRadiologyReportsUnViewed = result.radioCount;

                    RadioCount           = Settings.TotalRadiologyReportsUnViewed;
                    RadioCountVisibility = true;
                }
            }
        }
        public async void Initilize()
        {
            // MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Initilize Start");
            // Get Unseen Report Count
            var result = await ReportsService.GetLabReportsCount(Constants.UserProfile.Role, Constants.UserProfile.LabID);

            if (result.Success)
            {
                //MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Success");
                if (result.labCount > 0)
                {
                    //MessagingCenter.Send<string, string>("Hello", "DeviceLog", "First Iff");
                    //Settings.TotalLabortoryReportsCount = result.labCount;
                    Settings.TotalLabortoryReportsUnViewed = result.labCount;

                    MenuItemList[0].Count           = Settings.TotalLabortoryReportsUnViewed;
                    MenuItemList[0].CountVisibility = true;
                }
                if (result.radioCount > 0)
                {
                    // MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Second Iff");
                    //Settings.TotalRadiologyReportsCount = result.labCount;
                    Settings.TotalRadiologyReportsUnViewed = result.radioCount;

                    MenuItemList[1].Count           = Settings.TotalRadiologyReportsUnViewed;
                    MenuItemList[1].CountVisibility = true;
                }
                // MessagingCenter.Send<string, string>("Hello", "DeviceLog", "End If");
            }
            // MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Constant");
            if (Constants.IsAppOpenFirstTime)
            {
                //MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Here true");
                Constants.IsAppOpenFirstTime = false;
                UserDialogs.Instance.ShowLoading("Loading");

                AppLatestVersionResponseModel appLatestVersionResponseModel = new AppLatestVersionResponseModel();
                AppLatestVersion appLatestVersion = new AppLatestVersion();
                appLatestVersionResponseModel = await appLatestVersion.CheckAppVersion(Constants.GetDeviceType(), Constants.GetAppVersion());

                UserDialogs.Instance.HideLoading();
                //MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Hide Loading");
                if (appLatestVersionResponseModel.IsLatestAvailable)
                {
                    newversiondescription = appLatestVersionResponseModel.VersionDescription;
                    newversion            = appLatestVersionResponseModel.NewVersion;
                    showStoppingAlert();
                }
                else
                {
                    //MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Notification");
                    //AppBadgeClearService service = new AppBadgeClearService();
                    //await service.ClearBadgeForApp(Constants.UserProfile.LabID, Constants.UserProfile.Role);
                    //CrossBadge.Current.SetBadge(-1);
                    NavigatePageOnNofication();
                }
            }
            else
            {
                // MessagingCenter.Send<string, string>("Hello", "DeviceLog", "Here false");
                //AppBadgeClearService service = new AppBadgeClearService();
                //await service.ClearBadgeForApp(Constants.UserProfile.LabID, Constants.UserProfile.Role);
                //CrossBadge.Current.SetBadge(-1);
                NavigatePageOnNofication();
            }
        }