141 lines
5.9 KiB
C#
141 lines
5.9 KiB
C#
using DevExpress.XtraEditors;
|
|
using HL_FristAidPlatform_DTO;
|
|
using HL_FristAidPlatform_Public;
|
|
using Microsoft.AspNetCore.SignalR.Client;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace HL_FristAidPlatform_Frame
|
|
{
|
|
public partial class Form_TaskInfo : XtraForm
|
|
{
|
|
public string Guid { get; set; }
|
|
|
|
public static Form_Main main;
|
|
|
|
//定义一个连接对象
|
|
public HubConnection connection;
|
|
|
|
public Form_TaskInfo(DataTable dt)
|
|
{
|
|
InitializeComponent();
|
|
if (dt != null)
|
|
{
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
SignalRConnection();
|
|
connection.On<object>("ReceiveUpdate", (message) =>
|
|
{
|
|
Invoke(new Action(() =>
|
|
{
|
|
string path = AppDomain.CurrentDomain.BaseDirectory + "救护车.wav";
|
|
// AppDomain.CurrentDomain.BaseDirectory + "救护车.wav" .wav音频文件路径
|
|
string str = Environment.CurrentDirectory + "救护车.wav";
|
|
if (File.Exists(path))
|
|
{
|
|
System.Media.SoundPlayer player = new System.Media.SoundPlayer(path);
|
|
player.Play();//简单播放一遍
|
|
//player.Stop();
|
|
}
|
|
}));
|
|
|
|
});
|
|
Guid = dt.Rows[0]["GUID"].ToString();
|
|
|
|
labelControl21.Text = dt.Rows[0]["Name"].ToString() + "出车任务单";
|
|
if (!string.IsNullOrEmpty(dt.Rows[0]["AccidentName"].ToString()) && !string.IsNullOrEmpty(dt.Rows[0]["LevelName"].ToString()))
|
|
{
|
|
labelControl15.Visible = true;
|
|
lbl_AccidentName.Visible = true;
|
|
lbl_AccidentName.Text = dt.Rows[0]["AccidentName"].ToString();
|
|
|
|
labelControl17.Visible = true;
|
|
lbl_LevelName.Visible = true;
|
|
lbl_LevelName.Text = dt.Rows[0]["LevelName"].ToString();
|
|
labelControl19.Visible = true;
|
|
lbl_PatientsNumber.Text = dt.Rows[0]["PatientsNumber"].ToString();
|
|
}
|
|
|
|
lbl_PlateNumber.Text = dt.Rows[0]["PlateNumber"].ToString();
|
|
lbl_DispatchDatetime.Text = dt.Rows[0]["DispatchDatetime"].ToString();
|
|
lbl_DispatchNo.Text = dt.Rows[0]["DispatchNo"].ToString();
|
|
lbl_AccidentName.Text = dt.Rows[0]["DriverName"].ToString();
|
|
lbl_DoctorName.Text = dt.Rows[0]["DoctorName"].ToString();
|
|
lbl_NurseName.Text = dt.Rows[0]["NurseName"].ToString();
|
|
lbl_WaitingAddress.Text = dt.Rows[0]["WaitingAddress"].ToString();
|
|
lbl_Pathogeny.Text = dt.Rows[0]["Pathogeny"].ToString();
|
|
lbl_ChiefComplaint.Text = dt.Rows[0]["ChiefComplaint"].ToString();
|
|
lblPatientsNumber.Text = dt.Rows[0]["PatientsNumber"].ToString();
|
|
lbl_PatientName.Text = dt.Rows[0]["PatientName"].ToString();
|
|
lbl_PatientAddress.Text = dt.Rows[0]["PatientAddress"].ToString();
|
|
lbl_Consciousness.Text = dt.Rows[0]["Consciousness"].ToString();
|
|
lbl_Gender.Text = dt.Rows[0]["Gender"].ToString();
|
|
lbl_PatientPhone.Text = dt.Rows[0]["PatientPhone"].ToString();
|
|
lbl_PoliceCall.Text = dt.Rows[0]["PoliceCall"].ToString();
|
|
lbl_Age.Text = dt.Rows[0]["Age"].ToString();
|
|
|
|
Message(dt.Rows[0]["DoctorName"].ToString(), dt.Rows[0]["WaitingAddress"].ToString());
|
|
}
|
|
}
|
|
}
|
|
public async void SignalRConnection()
|
|
{
|
|
connection = new HubConnectionBuilder().WithUrl(ConfigurationManager.AppSettings["WebApiUrl"] + "signalr/chatHub")
|
|
.Build();
|
|
await connection.StartAsync();
|
|
connection.Closed += async (error) =>
|
|
{
|
|
await Task.Delay(new Random().Next(0, 5) * 1000);
|
|
await connection.StartAsync();
|
|
};
|
|
}
|
|
|
|
|
|
|
|
private async void Message(string name, string address)
|
|
{
|
|
//从客户端调用集线器方法 使用指定的方法名称和参数在服务器上调用中心方法
|
|
}
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
List<ConfirmTakeOrderseDTO> list = new List<ConfirmTakeOrderseDTO>();
|
|
ConfirmTakeOrderseDTO dto = new ConfirmTakeOrderseDTO();
|
|
dto.GUID = Guid;
|
|
list.Add(dto);
|
|
string Url = string.Empty;
|
|
Url = "api/service/T_Service_FirstAid_AlarmTaskInfo/ConfirmTakeOrderse";
|
|
ClientFactory<ConfirmTakeOrderseDTO> httpClient = new HttpClientFactory<ConfirmTakeOrderseDTO>();
|
|
Client<ConfirmTakeOrderseDTO> client = httpClient.VisitFactory();
|
|
|
|
//访问
|
|
ListEntity<ConfirmTakeOrderseDTO> t = client.Post(Url, list);
|
|
if (t.Success)
|
|
{
|
|
main = (Form_Main)this.Owner;
|
|
main.falg = true;
|
|
main.f_task = null;
|
|
main.ShowFormTask();
|
|
Close();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("保存失败");
|
|
}
|
|
}
|
|
|
|
private void Form_TaskInfo_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
|
|
main = (Form_Main)this.Owner;
|
|
main.falg = true;
|
|
main.f_task = null;
|
|
main.ShowFormTask();
|
|
}
|
|
}
|
|
}
|