public ImportProcessor(ImportFromBitmapComponent parent, IEnumerable<string> paths) { _parent = parent; _paths = paths; _waitShowProgressLock = new object(); _showProgress = false; }
/// <summary> /// Called by the host to assign this view to a component. /// </summary> public void SetComponent(IApplicationComponent component) { _component = (ImportFromBitmapComponent)component; }
/// <summary> /// Constructor. /// </summary> public ImportFromBitmapComponentControl(ImportFromBitmapComponent component) : base(component) { _component = component; InitializeComponent(); //set these values in case the underlying component's is null, so that when they are un-checked, //they will be reasonable. _dob.Value = Platform.Time; _studyDate.Value = Platform.Time; _studyTime.Value = Platform.Time; _patientId.DataBindings.Add("Value", _component, "PatientId", true, DataSourceUpdateMode.OnPropertyChanged); _dob.DataBindings.Add("Value", _component, "Dob", true, DataSourceUpdateMode.OnPropertyChanged); _firstName.DataBindings.Add("Value", _component, "FirstName", true, DataSourceUpdateMode.OnPropertyChanged); _lastName.DataBindings.Add("Value", _component, "LastName", true, DataSourceUpdateMode.OnPropertyChanged); _middleName.DataBindings.Add("Value", _component, "MiddleName", true, DataSourceUpdateMode.OnPropertyChanged); _accessionNumber.DataBindings.Add("Value", _component, "AccessionNumber", true, DataSourceUpdateMode.OnPropertyChanged); _studyDescription.DataBindings.Add("Value", _component, "StudyDescription", true, DataSourceUpdateMode.OnPropertyChanged); _studyDate.DataBindings.Add("Value", _component, "StudyDate", true, DataSourceUpdateMode.OnPropertyChanged); _studyTime.DataBindings.Add("Value", _component, "StudyTime", true, DataSourceUpdateMode.OnPropertyChanged); Binding maleBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); Binding femaleBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); Binding otherBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); _male.DataBindings.Add(maleBinding); _female.DataBindings.Add(femaleBinding); _other.DataBindings.Add(otherBinding); maleBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; e.Value = ((PatientsSex)e.Value) == PatientsSex.M; }; femaleBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; e.Value = ((PatientsSex)e.Value) == PatientsSex.F; }; otherBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; e.Value = ((PatientsSex)e.Value) == PatientsSex.O; }; maleBinding.Parse += new ConvertEventHandler(OnParseSex); femaleBinding.Parse += new ConvertEventHandler(OnParseSex); otherBinding.Parse += new ConvertEventHandler(OnParseSex); #region Bindings for Photometric Interpretation Binding monochrome2Binding = new Binding("Checked", _component, "PhotometricInterpretation", true, DataSourceUpdateMode.OnPropertyChanged); Binding rgbBinding = new Binding("Checked", _component, "PhotometricInterpretation", true, DataSourceUpdateMode.OnPropertyChanged); _piMonochrome2.DataBindings.Add(monochrome2Binding); _piRgb.DataBindings.Add(rgbBinding); monochrome2Binding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; e.Value = ((PhotometricInterpretation)e.Value) == PhotometricInterpretation.Monochrome2; }; rgbBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) return; e.Value = ((PhotometricInterpretation)e.Value) == PhotometricInterpretation.Rgb; }; monochrome2Binding.Parse += new ConvertEventHandler(OnParsePhotometricInterpretation); rgbBinding.Parse += new ConvertEventHandler(OnParsePhotometricInterpretation); #endregion _cancel.Click += delegate { _component.Cancel(); }; _ok.Click += delegate { _component.Accept(); }; }
/// <summary> /// Constructor. /// </summary> public ImportFromBitmapComponentControl(ImportFromBitmapComponent component) : base(component) { _component = component; InitializeComponent(); //set these values in case the underlying component's is null, so that when they are un-checked, //they will be reasonable. _dob.Value = Platform.Time; _studyDate.Value = Platform.Time; _studyTime.Value = Platform.Time; _patientId.DataBindings.Add("Value", _component, "PatientId", true, DataSourceUpdateMode.OnPropertyChanged); _dob.DataBindings.Add("Value", _component, "Dob", true, DataSourceUpdateMode.OnPropertyChanged); _firstName.DataBindings.Add("Value", _component, "FirstName", true, DataSourceUpdateMode.OnPropertyChanged); _lastName.DataBindings.Add("Value", _component, "LastName", true, DataSourceUpdateMode.OnPropertyChanged); _middleName.DataBindings.Add("Value", _component, "MiddleName", true, DataSourceUpdateMode.OnPropertyChanged); _accessionNumber.DataBindings.Add("Value", _component, "AccessionNumber", true, DataSourceUpdateMode.OnPropertyChanged); _studyDescription.DataBindings.Add("Value", _component, "StudyDescription", true, DataSourceUpdateMode.OnPropertyChanged); _studyDate.DataBindings.Add("Value", _component, "StudyDate", true, DataSourceUpdateMode.OnPropertyChanged); _studyTime.DataBindings.Add("Value", _component, "StudyTime", true, DataSourceUpdateMode.OnPropertyChanged); Binding maleBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); Binding femaleBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); Binding otherBinding = new Binding("Checked", _component, "Sex", true, DataSourceUpdateMode.OnPropertyChanged); _male.DataBindings.Add(maleBinding); _female.DataBindings.Add(femaleBinding); _other.DataBindings.Add(otherBinding); maleBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) { return; } e.Value = ((PatientsSex)e.Value) == PatientsSex.M; }; femaleBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) { return; } e.Value = ((PatientsSex)e.Value) == PatientsSex.F; }; otherBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) { return; } e.Value = ((PatientsSex)e.Value) == PatientsSex.O; }; maleBinding.Parse += new ConvertEventHandler(OnParseSex); femaleBinding.Parse += new ConvertEventHandler(OnParseSex); otherBinding.Parse += new ConvertEventHandler(OnParseSex); #region Bindings for Photometric Interpretation Binding monochrome2Binding = new Binding("Checked", _component, "PhotometricInterpretation", true, DataSourceUpdateMode.OnPropertyChanged); Binding rgbBinding = new Binding("Checked", _component, "PhotometricInterpretation", true, DataSourceUpdateMode.OnPropertyChanged); _piMonochrome2.DataBindings.Add(monochrome2Binding); _piRgb.DataBindings.Add(rgbBinding); monochrome2Binding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) { return; } e.Value = ((PhotometricInterpretation)e.Value) == PhotometricInterpretation.Monochrome2; }; rgbBinding.Format += delegate(object sender, ConvertEventArgs e) { if (e.DesiredType != typeof(bool)) { return; } e.Value = ((PhotometricInterpretation)e.Value) == PhotometricInterpretation.Rgb; }; monochrome2Binding.Parse += new ConvertEventHandler(OnParsePhotometricInterpretation); rgbBinding.Parse += new ConvertEventHandler(OnParsePhotometricInterpretation); #endregion _cancel.Click += delegate { _component.Cancel(); }; _ok.Click += delegate { _component.Accept(); }; }