123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using Microsoft.Win32;
- using System;
- using System.ComponentModel;
- using System.IO;
- using System.Windows.Forms;
- namespace CLIP.eForm.Consent.UI {
- public partial class ConfigForm : Form {
- private IConsentMain consentMain = null;
- private ConsentCommandCtrl commandControl = null;
- private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
- public ConfigForm() {
- InitializeComponent();
- }
- public ConfigForm(IConsentMain consentMain) {
- this.consentMain = consentMain;
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e) {
- if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
- return;
- }
- //consentMain = ConsentMainControl.GetConsentMainInterface(this);
- commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
- hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- // AppDomain.CurrentDomain.DynamicDirectory
- // Server.MapPath("~")
- string path = Path.GetDirectoryName(Application.StartupPath);//@"C:\eForm Server\Consent-Web-Server-CNUH\";// HttpContext.Current.Request.PhysicalApplicationPath;
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- string sMoniterNumber = ini.GetIniValue("DCMC", "MONITER_NUMBER");
- decimal iMoniterNumber = 1;
- if (decimal.TryParse(sMoniterNumber, out iMoniterNumber)) {
- this.fixedMonitor.Value = iMoniterNumber;
- }
- int monitorCnt = 0;
- getActiveMonitors(out monitorCnt);
- fixedMonitor.Maximum = monitorCnt;
- base.OnLoad(e);
- }
- /// <summary>
- /// 현재 사용자의 최대 모니터 갯수를 가져온다
- /// </summary>
- /// <param name="monitorCount"></param>
- private static void getActiveMonitors(out int monitorCount) {
- monitorCount = Screen.AllScreens.Length;
- }
- /// <summary>
- /// 닫기 버튼 클릭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnOK_Click(object sender, EventArgs e) {
- this.Close();
- }
- /// <summary>
- /// 대구가톨릭대학교병원
- /// 고정할 모니터를 병원정보시스템의 기준자료로 등록한다
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e) {
- var monitorId = fixedMonitor.Value.ToString().Trim();
- HospitalSvcRef.SingleReturnData data = null;
- // config.ini 파일 및 사용자 기준자료에 등록하여야 한다.
- try {
- data = hospitalWebService.SetUserPrefMonitor(commandControl.CurrentEndUser.userId, monitorId);
- }
- catch(Exception ex) {
- throw ex;
- }
- if(data == null || string.IsNullOrEmpty(data.responseData)) {
- return;
- }
- //현재 프로그램이 실행되고 있는정보 가져오기: 디버깅 모드라면 bin/debug/프로그램명.exe
- FileInfo exefileinfo = new FileInfo(Path.GetDirectoryName(Application.StartupPath));
- //// AppDomain.CurrentDomain.DynamicDirectory
- //// Server.MapPath("~")
- string path = Path.GetDirectoryName(Application.StartupPath);//@"C:\eForm Server\Consent-Web-Server-CNUH\";// HttpContext.Current.Request.PhysicalApplicationPath;
- string fileName = @"\config.ini"; //파일명
- //만약 현재 실행 되는 경로가 아닌 특정한 위치를 원한다면 위에 과정 상관없이 바로 경로셋팅 해 주면 된다. (예: c:\config.ini)
- string filePath = path + fileName; //ini 파일 경로
- iniUtil ini = new iniUtil(filePath); // 만들어 놓았던 iniUtil 객체 생성(생성자 인자로 파일경로 정보 넘겨줌)
- //이제 ini 객체를 이용해 맘것 사용하면 된다.
- ini.SetIniValue("DCMC", "MONITER_NUMBER", this.fixedMonitor.Value.ToString());
- consentMain.setDualViewerOption(this.fixedMonitor.Value.ToString().Trim());
- }
- }
- }
|