///<summary>Launches the program if necessary. Then passes patient.Cur data using DDE.</summary> public static void SendData(Program ProgramCur, Patient pat) { ArrayList ForProgram=ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if(pat==null){ MessageBox.Show("Please select a patient first"); return; } if(!File.Exists(ProgramCur.Path)){ MessageBox.Show("Could not find "+ProgramCur.Path); return; } //Make sure the program is running //Documentation says to include the -nostartup command line switch (to avoid optional program preference startup command). if(Process.GetProcessesByName("Vipersoft").Length==0){ Process.Start(ProgramCur.Path,"-nostartup"); Thread.Sleep(TimeSpan.FromSeconds(4)); } //Data is sent to the Vipersoft DDE Server by use of the XTYP_EXECUTE DDE message only. //The format ot the XTYP_EXECUTE DDE message is" //command="\004hwnd|name|ID|Lastname|Firstname|MI|Comments|Provider|Provider Phone|Addrs1|Addrs2|City|State|Zip|Patient Phone|Practice Name|Patient SSN|restore server|" //\004 is one byte code for version 4. 0x04 or Char(4) //hwnd is calling software's windows handle. //name is for name of calling software (Open Dental) //ID is patient ID. Required and must be unique. //Provider field is for provider name. //hwnd, ID, Lastname, Firstname, and Provider fields are required. All other fields are optional. //All vertical bars (|) are required, including the ending bar. //The restore server flag is for a future release's support of the specialized capture/view commands (default is '1') //Visual Basic pseudo code: //Chan = DDEInitiate("Vipersoft", "Advanced IntraOral") //DDE_String$ = "" //etc //DDEExecute Chan, DDE_String$ //send XTYP_EXECUTE DDE command: //DDETerminate Chan Char char4=Convert.ToChar(4); string command=char4.ToString();//tested to make sure this is just one non-printable byte. IntPtr hwnd=Application.OpenForms[0].Handle; command+=hwnd.ToString()+"|"//hwnd +"OpenDental|";//name ProgramProperty PPCur=ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; string patID; if(PPCur.PropertyValue=="0"){ patID=pat.PatNum.ToString(); } else{ if(pat.ChartNumber==""){ MessageBox.Show("ChartNumber for this patient is blank."); return; } patID=pat.ChartNumber; } command+=patID+"|";//ID command+=pat.LName+"|";//Lastname command+=pat.FName+"|";//Firstname command+=pat.MiddleI+"|";// command+="|";//Comments: blank Provider prov=Providers.GetProv(Patients.GetProvNum(pat)); command+=prov.LName+", "+prov.FName+"|";//Provider command+="|";//Provider phone command+="|";//Addr command+="|";//Addr2 command+="|";//City command+="|";//State command+="|";//Zip command+="|";//Phone command+="|";//Practice command+=pat.SSN+"|";//SSN command+="1|";//Restore Server //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using(DdeContext context=new DdeContext()){ //Create a client. using(DdeClient client=new DdeClient("Vipersoft","Advanced IntraOral",context)){ //Establish the conversation. client.Connect(); //Select patient client.Execute(command,2000);//timeout 2 secs client.Disconnect(); } } } catch{ //MessageBox.Show(e.Message); } }
///<summary>Launches the program if necessary. Then passes patient.Cur data using DDE.</summary> public static void SendData(Program ProgramCur, Patient pat) { string path = Programs.GetProgramPath(ProgramCur); List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if (pat == null) { MessageBox.Show("Please select a patient first"); return; } if (!File.Exists(path)) { MessageBox.Show("Could not find " + path); return; } //Make sure the program is running //Documentation says to include the -nostartup command line switch (to avoid optional program preference startup command). if (Process.GetProcessesByName("Vipersoft").Length == 0) { ODFileUtils.ProcessStart(path, "-nostartup"); Thread.Sleep(TimeSpan.FromSeconds(4)); } //Data is sent to the Vipersoft DDE Server by use of the XTYP_EXECUTE DDE message only. //The format ot the XTYP_EXECUTE DDE message is" //command="\004hwnd|name|ID|Lastname|Firstname|MI|Comments|Provider|Provider Phone|Addrs1|Addrs2|City|State|Zip|Patient Phone|Practice Name|Patient SSN|restore server|" //\004 is one byte code for version 4. 0x04 or Char(4) //hwnd is calling software's windows handle. //name is for name of calling software (Open Dental) //ID is patient ID. Required and must be unique. //Provider field is for provider name. //hwnd, ID, Lastname, Firstname, and Provider fields are required. All other fields are optional. //All vertical bars (|) are required, including the ending bar. //The restore server flag is for a future release's support of the specialized capture/view commands (default is '1') //Visual Basic pseudo code: //Chan = DDEInitiate("Vipersoft", "Advanced IntraOral") //DDE_String$ = "" //etc //DDEExecute Chan, DDE_String$ //send XTYP_EXECUTE DDE command: //DDETerminate Chan Char char4 = Convert.ToChar(4); string command = char4.ToString(); //tested to make sure this is just one non-printable byte. IntPtr hwnd = Application.OpenForms[0].Handle; command += hwnd.ToString() + "|" //hwnd + "OpenDental|"; //name ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; string patID; if (PPCur.PropertyValue == "0") { patID = pat.PatNum.ToString(); } else { if (pat.ChartNumber == "") { MessageBox.Show("ChartNumber for this patient is blank."); return; } patID = pat.ChartNumber; } command += patID + "|"; //ID command += pat.LName + "|"; //Lastname command += pat.FName + "|"; //Firstname command += pat.MiddleI + "|"; // command += "|"; //Comments: blank Provider prov = Providers.GetProv(Patients.GetProvNum(pat)); command += prov.LName + ", " + prov.FName + "|"; //Provider command += "|"; //Provider phone command += "|"; //Addr command += "|"; //Addr2 command += "|"; //City command += "|"; //State command += "|"; //Zip command += "|"; //Phone command += "|"; //Practice command += pat.SSN + "|"; //SSN command += "1|"; //Restore Server //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using (DdeContext context = new DdeContext()){ //Create a client. using (DdeClient client = new DdeClient("Vipersoft", "Advanced IntraOral", context)){ //Establish the conversation. client.Connect(); //Select patient client.Execute(command, 2000); //timeout 2 secs client.Disconnect(); } } } catch { //MessageBox.Show(e.Message); } }
///<summary>Launches the program using the patient.Cur data.</summary> public static void SendData(Program ProgramCur, Patient pat){ ArrayList ForProgram=ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if(pat==null){ MessageBox.Show("Please select a patient first"); return; } //Get the program path from the ini file string windir=Environment.GetEnvironmentVariable("windir");// C:\WINDOWS string iniFile=windir+"\\dentx.ini"; if(!File.Exists(iniFile)){ MessageBox.Show("Could not find "+iniFile); return; } //Make sure the program is running string proimagePath=ReadValue(iniFile,"imagemgt","MainFile"); Process[] proImageInstances=Process.GetProcessesByName("ProImage"); if(proImageInstances.Length==0){ Process.Start(proimagePath); Thread.Sleep(TimeSpan.FromSeconds(10)); } //command="Xray,PatientNo,FirstName,LastName,Birth Date,Sex,Address,City,State,Code"(zip) string command="Xray,"; //PatientNo can be any string format up to 9 char ProgramProperty PPCur=ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; if(PPCur.PropertyValue=="0"){ command+=pat.PatNum.ToString()+","; } else{ if(pat.ChartNumber==""){ MessageBox.Show("ChartNumber for this patient is blank."); return; } command+=pat.ChartNumber.Replace(",","")+","; } command+=pat.FName.Replace(",","")+"," +pat.LName.Replace(",","")+"," +pat.Birthdate.ToShortDateString()+","; if(pat.Gender==PatientGender.Female) command+="F,"; else command+="M,"; command+=pat.Address.Replace(",","")+"," +pat.City.Replace(",","")+"," +pat.State.Replace(",","")+"," +pat.Zip.Replace(",",""); //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using(DdeContext context=new DdeContext()){ //Create a client. using(DdeClient client=new DdeClient("ProImage","Image",context)){ //Establish the conversation. client.Connect(); //Start ProImage and open to the Xray Chart screen client.Execute(command,2000);//timeout 2 secs } } } catch{ //MessageBox.Show(e.Message); } }
///<summary>Launches the program if necessary. Then passes patient.Cur data using DDE.</summary> public static void SendData(Program ProgramCur, Patient pat) { ArrayList ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if (pat == null) { MessageBox.Show("Please select a patient first"); return; } //The path is available in the registry, but we'll just make the user enter it. if (!File.Exists(ProgramCur.Path)) { MessageBox.Show("Could not find " + ProgramCur.Path); return; } //Make sure the program is running if (Process.GetProcessesByName("DentalEye").Length == 0) { Process.Start(ProgramCur.Path); Thread.Sleep(TimeSpan.FromSeconds(4)); } //command="[Add][PatNum][Fname][Lname][Address|Address2|City, ST Zip][phone1][phone2][mobile phone][email][sex(M/F)][birthdate (YYYY-MM-DD)]" ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; string patID; if (PPCur.PropertyValue == "0") { patID = pat.PatNum.ToString(); } else { if (pat.ChartNumber == "") { MessageBox.Show("ChartNumber for this patient is blank."); return; } patID = pat.ChartNumber; } string command = "[Add][" + patID + "]" + "[" + pat.FName + "]" + "[" + pat.LName + "]" + "[" + pat.Address + "|"; if (pat.Address2 != "") { command += pat.Address2 + "|"; } command += pat.City + ", " + pat.State + " " + pat.Zip + "]" + "[" + pat.HmPhone + "]" + "[" + pat.WkPhone + "]" + "[" + pat.WirelessPhone + "]" + "[" + pat.Email + "]"; if (pat.Gender == PatientGender.Female) { command += "[F]"; } else { command += "[M]"; } command += "[" + pat.Birthdate.ToString("yyyy-MM-dd") + "]"; //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using (DdeContext context = new DdeContext()){ //Create a client. using (DdeClient client = new DdeClient("DENTEYE", "Patient", context)){ //Establish the conversation. client.Connect(); //Add patient or modify if already exists client.Execute(command, 2000); //timeout 2 secs //Then, select patient command = "[Search][" + patID + "]"; client.Execute(command, 2000); } } } catch { //MessageBox.Show(e.Message); } }
private void DialPbx_Click(object sender, RoutedEventArgs e) { string dialNum = null; string loginName = null; string loginPassword = null; long baudRate; int dataBits; int stopBits; int parity; string selectedCustomer = CustomerList_Box.SelectedItem.ToString(); string[] selectedCustomerArr = selectedCustomer.Split(' '); int switchIdSelcted = int.Parse(selectedCustomerArr[0]); using (MainModel modelContainer = new MainModel(App.WorkMode)) { PbxConnection allSwitchIdData = modelContainer.PbxConnectionSet.Single(s => s.SwitchId == switchIdSelcted); dialNum = allSwitchIdData.DialNum; loginName = allSwitchIdData.LoginName; loginPassword = allSwitchIdData.LoginPassword; if (allSwitchIdData.ParDataStop != null && allSwitchIdData.BaudRate != 0) { string[] parDataStopArr = allSwitchIdData.ParDataStop.Split('-'); switch (parDataStopArr[0]) { case "N": parity = 0; break; case "O": parity = 1; break; case "E": parity = 2; break; case "M": parity = 3; break; case "S": parity = 4; break; default: throw new Exception("unexpected parity: " + parDataStopArr[0]); } dataBits = int.Parse(parDataStopArr[1]); stopBits = int.Parse(parDataStopArr[2]); baudRate = allSwitchIdData.BaudRate; } else { parity = 0; dataBits = 8; stopBits = 1; baudRate = 9600; } } string filePath = WriteScript(dialNum, loginName, loginPassword, baudRate, parity, dataBits, stopBits); try { using (DdeClient client = new DdeClient("PW5", "System")) { client.Connect(); client.Execute($"EXECUTE {filePath}", 30); } } catch (Exception ex) { } Application.Current.MainWindow.WindowState = WindowState.Minimized; }
///<summary>Launches the program using the patient.Cur data.</summary> public static void SendData(Program ProgramCur, Patient pat) { List <ProgramProperty> ForProgram = ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if (pat == null) { MessageBox.Show("Please select a patient first"); return; } //Get the program path from the ini file string windir = Environment.GetEnvironmentVariable("windir"); // C:\WINDOWS string iniFile = windir + "\\dentx.ini"; if (!File.Exists(iniFile)) { MessageBox.Show("Could not find " + iniFile); return; } //Make sure the program is running string proimagePath = ReadValue(iniFile, "imagemgt", "MainFile"); Process[] proImageInstances = Process.GetProcessesByName("ProImage"); if (proImageInstances.Length == 0) { ODFileUtils.ProcessStart(proimagePath); Thread.Sleep(TimeSpan.FromSeconds(10)); } //command="Xray,PatientNo,FirstName,LastName,Birth Date,Sex,Address,City,State,Code"(zip) string command = "Xray,"; //PatientNo can be any string format up to 9 char ProgramProperty PPCur = ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; if (PPCur.PropertyValue == "0") { command += pat.PatNum.ToString() + ","; } else { if (pat.ChartNumber == "") { MessageBox.Show("ChartNumber for this patient is blank."); return; } command += pat.ChartNumber.Replace(",", "") + ","; } command += pat.FName.Replace(",", "") + "," + pat.LName.Replace(",", "") + "," + pat.Birthdate.ToShortDateString() + ","; if (pat.Gender == PatientGender.Female) { command += "F,"; } else { command += "M,"; } command += pat.Address.Replace(",", "") + "," + pat.City.Replace(",", "") + "," + pat.State.Replace(",", "") + "," + pat.Zip.Replace(",", ""); //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using (DdeContext context = new DdeContext()){ //Create a client. using (DdeClient client = new DdeClient("ProImage", "Image", context)){ //Establish the conversation. client.Connect(); //Start ProImage and open to the Xray Chart screen client.Execute(command, 2000); //timeout 2 secs } } } catch { //MessageBox.Show(e.Message); } }
///<summary>Launches the program if necessary. Then passes patient.Cur data using DDE.</summary> public static void SendData(Program ProgramCur, Patient pat){ string path=Programs.GetProgramPath(ProgramCur); ArrayList ForProgram=ProgramProperties.GetForProgram(ProgramCur.ProgramNum);; if(pat==null){ MessageBox.Show("Please select a patient first"); return; } //The path is available in the registry, but we'll just make the user enter it. if(!File.Exists(path)){ MessageBox.Show("Could not find "+path); return; } //Make sure the program is running if(Process.GetProcessesByName("DentalEye").Length==0){ Process.Start(path); Thread.Sleep(TimeSpan.FromSeconds(4)); } //command="[Add][PatNum][Fname][Lname][Address|Address2|City, ST Zip][phone1][phone2][mobile phone][email][sex(M/F)][birthdate (YYYY-MM-DD)]" ProgramProperty PPCur=ProgramProperties.GetCur(ForProgram, "Enter 0 to use PatientNum, or 1 to use ChartNum");; string patID; if(PPCur.PropertyValue=="0"){ patID=pat.PatNum.ToString(); } else{ if(pat.ChartNumber==""){ MessageBox.Show("ChartNumber for this patient is blank."); return; } patID=pat.ChartNumber; } string command="[Add]["+patID+"]" +"["+pat.FName+"]" +"["+pat.LName+"]" +"["+pat.Address+"|"; if(pat.Address2!=""){ command+=pat.Address2+"|"; } command+=pat.City+", "+pat.State+" "+pat.Zip+"]" +"["+pat.HmPhone+"]" +"["+pat.WkPhone+"]" +"["+pat.WirelessPhone+"]" +"["+pat.Email+"]"; if(pat.Gender==PatientGender.Female) command+="[F]"; else command+="[M]"; command+="["+pat.Birthdate.ToString("yyyy-MM-dd")+"]"; //MessageBox.Show(command); try { //Create a context that uses a dedicated thread for DDE message pumping. using(DdeContext context=new DdeContext()){ //Create a client. using(DdeClient client=new DdeClient("DENTEYE","Patient",context)){ //Establish the conversation. client.Connect(); //Add patient or modify if already exists client.Execute(command,2000);//timeout 2 secs //Then, select patient command="[Search]["+patID+"]"; client.Execute(command,2000); } } } catch{ //MessageBox.Show(e.Message); } }
private void ViewWindow_FocusableChanged(object sender, EventArgs eventArgs) { _client.Execute(MsgTag.GetFocus, 60000); // Mediator.SendMessage("", MsgTag.GetFocus); //Mediator.SendMessage("Collapsed", "ChangeVisibility"); }