Exemple #1
0
        private async void ButtonStart_OnClick(object sender, RoutedEventArgs e)
        {
            if (!Codes.Any())
            {
                Informer.RaiseOnResultReceived("No codes found");
                return;
            }

            ButtonIsEnabled(false);
            Utils.IsPermit = true;
            if (Utils.DriverList.Count > Settings.Default.CaptchaNum)
            {
                var num = Utils.DriverList.Count - Settings.Default.CaptchaNum;
                DeleteBrowsers(num);
            }
            else
            {
                var num = Settings.Default.CaptchaNum - Utils.DriverList.Count;
                LoadBrowsers(num);
            }
            CaptchaTimer.Elapsed += CaptchaTimer_Elapsed;
            Utils.CancelToken     = new CancellationTokenSource();
            CaptchaTimer.Start();

            await Task.Run(async() =>
            {
                try
                {
                    await MainCycle.InitializTask(Codes, Proxies, Settings.Default.CaptchaNum);
                }
                catch (Exception ex)
                {
                    Informer.RaiseOnResultReceived(ex);
                }
            });

            ButtonStop_OnClick(ButtonStop, null);
            ButtonIsEnabled(true);
        }
Exemple #2
0
        public override RegistryPackage ToRegistryObject()
        {
            var folder = new RegistryPackage
            {
                Id          = EntryUuid,
                Home        = HomeCommunityId,
                Status      = AvailabilityStatus,
                Description = XmlUtil.LocalString(Comments),
                Name        = XmlUtil.LocalString(Title)
            };

            folder.Classifications.Add(new Classification
            {
                ClassificationScheme = XdsClassification.Folder,
                ClassifiedObject     = EntryUuid,
            });

            if (Codes != null && Codes.Any())
            {
                Codes.ForEach(fc => folder.Classifications.Add(new Classification
                {
                    ClassificationScheme = XdsClassification.FolderCode,
                    ClassifiedObject     = EntryUuid,
                    Name = XmlUtil.LocalString(fc.DisplayName),
                    NodeRepresentation = fc.Value,
                    Slots = new List <Slot>
                    {
                        new Slot
                        {
                            Name   = "codingScheme",
                            Values = new List <string>
                            {
                                fc.CodeSystemId
                            }
                        }
                    }
                }));
            }
            if (!string.IsNullOrEmpty(UniqueId))
            {
                folder.ExternalIdentifiers.Add(new ExternalIdentifier
                {
                    IdentificationScheme = XdsIdentification.FolderUniqueId,
                    RegistryObject       = EntryUuid,
                    Name  = XmlUtil.LocalString("XDSFolder.uniqueId"),
                    Value = UniqueId
                });
            }
            string patientId = PatientId != null?PatientId.ToString() : "";

            if (!string.IsNullOrEmpty(patientId))
            {
                folder.ExternalIdentifiers.Add(new ExternalIdentifier
                {
                    IdentificationScheme = XdsIdentification.FolderPatientId,
                    RegistryObject       = EntryUuid,
                    Name  = XmlUtil.LocalString("XDSFolder.patientId"),
                    Value = patientId
                });
            }
            if (LastUpdateTime != null)
            {
                folder.Slots.Add(new Slot
                {
                    Name   = "lastUpdateTime",
                    Values = new List <string>
                    {
                        _hl7LastUpdateTime.Encode()
                    }
                });
            }
            if (LimitedMetadata)
            {
                folder.Classifications.Add(new Classification
                {
                    ClassificationScheme = XdsClassification.FolderLimitedMetadata,
                    ClassifiedObject     = EntryUuid
                });
            }
            return(folder);
        }