protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.StudyDetail); string[] studyInfo = new string[] { $"检查时间: {MyStudyList.SelectedStudy.SampleTime.ToLocalTime():HH:mm:ss}", $"诊断结果: {MyStudyList.SelectedStudy.Diagnose}", $"诊断医生: {MyStudyList.SelectedStudy.DoctorName}", }; ListView lsvStudyInfo = FindViewById <ListView>(Resource.Id.lsvStudyInfo); ArrayAdapter <string> adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, studyInfo); lsvStudyInfo.Adapter = adapter; ImageView imgWave = FindViewById <ImageView>(Resource.Id.imgWave); //初始化绘制ECG波形对象 MyDrawBioWave = new DrawBioWave(imgWave, MyStudyList.SelectedStudy.BioBuf); //onCreate时控件未显示,大小为0,不能直接初始化绘图对象,onStart,onResume都不行 //System.NullReferenceException: Object reference not set to an instance of an object. observer = imgWave.ViewTreeObserver; observer.AddOnGlobalLayoutListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.DiagnoseDetail); string[] studyInfo = new string[] { $"检查时间: {MyStudyList.SelectedStudy.SampleTime.ToLocalTime():HH:mm:ss}", $"患者姓名: {MyStudyList.SelectedStudy.PatientName}", }; ListView lsvStudyInfo = FindViewById <ListView>(Resource.Id.lsvStudyInfo); lsvStudyInfo.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, studyInfo); ImageView imgWave = FindViewById <ImageView>(Resource.Id.imgWave); //初始化绘制ECG波形对象 MyDrawBioWave = new DrawBioWave(imgWave, MyStudyList.SelectedStudy.BioBuf); //onCreate时控件未显示,大小为0,不能直接初始化绘图对象,onStart,onResume都不行 //System.NullReferenceException: Object reference not set to an instance of an object. observer = imgWave.ViewTreeObserver; observer.AddOnGlobalLayoutListener(this); //诊断结果列表 DiagnoseList = new List <string>() { "正常", "轻度异常", "严重异常" }; DiagnoseAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, DiagnoseList); spnDiagnose = FindViewById <Spinner>(Resource.Id.spnDiagnose); spnDiagnose.Adapter = DiagnoseAdapter; //自动分析 Button btnAutoAnalyse = FindViewById <Button>(Resource.Id.btnAutoAnalyse); btnAutoAnalyse.Click += (s1, e1) => AutoAnalyse(); //完成诊断 Button btnSave = FindViewById <Button>(Resource.Id.btnSave); btnSave.Click += (s1, e1) => SaveStudy(); }