本文整理汇总了C#中action类的典型用法代码示例。如果您正苦于以下问题:C# action类的具体用法?C# action怎么用?C# action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
action类属于命名空间,在下文中一共展示了action类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnReset_Click
private void btnReset_Click(object sender, EventArgs e)
{
vAction = action.Insert;
txtID.Text = "-1";
txtName.Clear();
txtName.Focus();
}
示例2: run
/// <summary>
/// 运行线程
/// </summary>
private void run()
{
action task, domainUnload;
action<Exception> onError;
Monitor.Enter(threadLock);
try
{
if (this.task == null) Monitor.Wait(threadLock);
task = this.task;
domainUnload = this.domainUnload;
onError = this.onError;
this.task = null;
this.domainUnload = null;
this.onError = null;
}
finally { Monitor.Exit(threadLock); }
while (!isStop)
{
if (domainUnload != null) fastCSharp.domainUnload.Add(domainUnload);
try
{
task();
}
catch (Exception error)
{
if (onError != null)
{
try
{
onError(error);
}
catch (Exception error1)
{
log.Default.Add(error1, null, false);
}
}
else log.Default.Add(error, null, false);
}
finally
{
if (domainUnload != null) fastCSharp.domainUnload.Remove(domainUnload, false);
}
threadPool.Push(this);
Monitor.Enter(threadLock);
try
{
if (this.task == null) Monitor.Wait(threadLock);
task = this.task;
domainUnload = this.domainUnload;
onError = this.onError;
this.task = null;
this.domainUnload = null;
this.onError = null;
}
finally { Monitor.Exit(threadLock); }
}
}
示例3: btnReset_Click
private void btnReset_Click(object sender, EventArgs e)
{
vAction = action.Insert;
txtID.Text = "-1";
txtName.Clear();
txtDesc.Clear();
ckbValid.Checked = true;
txtName.Focus();
}
示例4: Awake
// Use this for initialization
void Awake()
{
gameObject.SetActive( firstActionDialogue );
dialoguePanel = GameObject.Find( "Panel" );
dialogueScript = dialoguePanel.GetComponent<loadDialogue>();
GameObject actionObject = transform.Find( "Action" ).gameObject;
Action = actionObject.GetComponent<action>();
sceneSetUp = false;
}
示例5: ClearControl
void ClearControl()
{
foreach (Control control in grpControl.Controls)
{
if(control is Janus.Windows.GridEX.EditControls.EditBox)
{
((Janus.Windows.GridEX.EditControls.EditBox)(control)).Clear();
}
em_Action = action.Insert;
txtClinicCode.Focus();
}
}
示例6: btnReset_Click
private void btnReset_Click(object sender, EventArgs e)
{
vAction = action.Insert;
txtID.Text = "-1";
txtName.Clear();
txtAbbreviation.Clear();
txtPrice.Value = 0;
txtDesc.Clear();
txtSequence.Value = 0;
ckbPrintDetail.Checked = true;
txtSequence.Focus();
}
示例7: ClearControl
private void ClearControl()
{
m_enAct = action.Insert;
foreach (Control control in this.grpControl.Controls)
{
if (control is Janus.Windows.GridEX.EditControls.EditBox) control.Text = string.Empty;
}
txtMa.Enabled = true;
cboKhoaNoiTru.SelectedIndex = 0;
txtMa.Focus();
}
示例8: ActionDevice
private void ActionDevice(action vAction)
{
try
{
if (grdDevice.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return;
switch (vAction)
{
case action.Normal:
dtDevice =
new Select(DDeviceList.Schema.Name + ".*", TTestTypeList.Columns.TestTypeName,
LManufacture.Columns.SName)
.From(DDeviceList.Schema.Name).
LeftOuterJoin(TTestTypeList.TestTypeIdColumn, DDeviceList.TestTypeIdColumn).
LeftOuterJoin(LManufacture.IdColumn, DDeviceList.ManufactureIdColumn).
ExecuteDataSet().Tables[0];
grdDevice.DataSource = dtDevice;
break;
case action.Delete:
if (
DDataControl.CreateQuery().WHERE(DDataControl.Columns.DeviceId,Utility.Int32Dbnull(grdDevice.GetValue("Device_ID"))).
GetRecordCount() > 0)
{
Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa");
return;
}
if (Utility.AcceptQuestion("Thực hiện xóa " + grdDevice.GetValue("Device_Name"), "Thông báo",
true))
{
new Delete().From(DDeviceList.Schema.Name).Where(DDeviceList.Columns.DeviceId).IsEqualTo(
Utility.Int32Dbnull(grdDevice.GetValue("Device_ID"))).Execute();
grdDevice.CurrentRow.Delete();
grdDevice.UpdateData();
}
dtDevice.AcceptChanges();
break;
default:
var oForm = new frmDeviceList_AU();
oForm.vAction = vAction;
oForm.drList = Utility.GetDataRow(dtDevice, DDeviceList.Columns.DeviceId,
grdDevice.GetValue("Device_ID"));
oForm.dtList = dtDevice;
oForm.ShowDialog();
break;
}
}
catch (Exception ex)
{
Utility.ShowMsg(ex.Message);
}
}
示例9: ShowInfo
void ShowInfo()
{
Act = action.Insert;
if (_ACtrl != null)
{
Act = action.Update;
txtCode.Text = _ACtrl.Code;
txtVnName.Text = _ACtrl.Vn_Name;
txtEngName.Text = _ACtrl.En_Name;
txtSTT.Text = _ACtrl.STT.ToString();
txtCode.Enabled = false;
txtVnName.Focus();
}
}
示例10: WaitRunOnce
/// <summary>
/// 等待单次运行
/// </summary>
/// <param name="runState">执行状态,0表示未运行,1表示运行中,2表示已经运行</param>
/// <param name="run">执行委托</param>
public static void WaitRunOnce(ref int runState, action run)
{
int isRun = Interlocked.CompareExchange(ref runState, 1, 0);
if (isRun == 0)
{
try
{
run();
}
finally { runState = 2; }
}
else if (isRun == 1)
{
while (runState == 1) Thread.Sleep(1);
}
}
示例11: topSocket
/// <summary>
/// 初始化同步套接字
/// </summary>
/// <param name="socket">操作套接字</param>
/// <param name="data">数据缓存</param>
/// <param name="onClose">关闭套接字处理</param>
/// <param name="dataPoint">数据缓存起始位置</param>
protected topSocket(Socket socket, byte[] data, action<topSocket> onClose, byte* dataPoint = null)
{
if (socket == null) log.Default.Throw(null, "缺少套接字", true);
if (data == null) log.Default.Throw(null, "缺少数据缓存", true);
if (dataPoint != null)
{
fixed (byte* dataFixed = data)
{
if (dataFixed != dataPoint) log.Default.Throw(null, "数据缓存起始位置不正确", true);
}
this.dataPoint = dataPoint;
}
this.socket = socket;
this.data = data;
this.onClose = onClose;
}
示例12: btnReset_Click
private void btnReset_Click(object sender, EventArgs e)
{
vAction = action.Insert;
txtID.Enabled = true;
txtName.Clear();
txtMeasureUnit.Clear();
txtNormalLevel.Clear();
txtNormalLevelW.Clear();
txtDesc.Clear();
txtSequence.Value = 0;
txtDataPoint.Value = 0;
ckbDataPrint.Checked = true;
ckbDataView.Checked = true;
txtID.Focus();
txtID.Clear();
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text != "")
{
var get_money = from m in pay_doc.Element("payments").Elements("userdata").Elements("u_paid")
where (string)m.Attribute("idp").Value == user_id.ToString()
select m;
foreach (var m in get_money)
{
money = Convert.ToInt32(m.Value);
}
money++;
var inc = max_files + 5;
max_files += 5;
XElement ref_to_files = pay_doc.Element("payments").Elements("userdata").Elements("u_files")
.Where(id => (string)id.Attribute("idf").Value == user_id.ToString()).FirstOrDefault();
ref_to_files.SetValue(inc.ToString());
XElement ref_to_paid = pay_doc.Element("payments").Elements("userdata").Elements("u_paid")
.Where(id => (string)id.Attribute("idp").Value == user_id.ToString()).FirstOrDefault();
ref_to_paid.SetValue(money.ToString());
pay_doc.Save("Payments.xml");
file_dataclassesDataContext database = new file_dataclassesDataContext();
action pay_act = new action
{
u_id = user_id,
act_type = "PAY",
action_time = DateTime.Now
};
database.actions.InsertOnSubmit(pay_act);
database.SubmitChanges();
Close();
}
else
{
MessageBox.Show("Invalid code!", "Error");
return;
}
}
示例14: button1_Click
private void button1_Click(object sender, EventArgs e)
{
file_dataclassesDataContext database = new file_dataclassesDataContext();
/* var log_data = from u in database.users
where u.login == textBox1.Text && u.password == textBox2.Text
select new { u.u_id };*/
SqlConnection conn = new SqlConnection("Data Source=.\\SQLSRVR;AttachDbFilename=G:\\GitHub\\mmnote\\Data_base\\Data_base\\files_db.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
SqlDataReader log_data = null;
var ex = 0;
string quer = "select u_id from users where login = '"+textBox1.Text+"' and password = '"+textBox2.Text+"'";
try
{
conn.Open();
SqlCommand cmd = new SqlCommand(quer, conn);
log_data = cmd.ExecuteReader();
while(log_data.Read())
{
ex++;
uid = (int)log_data[0];
}
}
finally
{
if (conn != null) conn.Close();
}
if (ex == 0)
{
label3.Text = "Inncorect login or password!";
return;
}
action log_act = new action
{
u_id = uid,
act_type = "LOG",
action_time = DateTime.Now
};
database.actions.InsertOnSubmit(log_act);
database.SubmitChanges();
Close();
}
示例15: ActionDepartment
private void ActionDepartment(action vAction)
{
try
{
if (grdDepartment.CurrentRow == null && (vAction == action.Update || vAction == action.Delete)) return;
switch (vAction)
{
case action.Normal:
dtDepartment = new Select().From(LDepartment.Schema.Name).ExecuteDataSet().Tables[0];
grdDepartment.DataSource = dtDepartment;
break;
case action.Delete:
if (
LPatientInfo.CreateQuery().WHERE(LPatientInfo.Columns.DepartmentID,
Utility.Int32Dbnull(grdDepartment.GetValue("ID"))).
GetRecordCount() > 0)
{
Utility.ShowMsg("Danh mục đang được sử dụng. Không được xóa");
return;
}
if (Utility.AcceptQuestion("Thực hiện xóa " + grdDepartment.GetValue("sName"), "Thông báo", true))
{
new Delete().From(LDepartment.Schema.Name).Where(LDepartment.Columns.Id).IsEqualTo(
Utility.Int32Dbnull(grdDepartment.GetValue("ID"))).Execute();
grdDepartment.CurrentRow.Delete();
grdDepartment.UpdateData();
}
dtDepartment.AcceptChanges();
break;
default:
var oForm = new frmDepartmentList_AU();
oForm.vAction = vAction;
oForm.drList = Utility.GetDataRow(dtDepartment, LDepartment.Columns.Id,
grdDepartment.GetValue("ID"));
oForm.dtList = dtDepartment;
oForm.ShowDialog();
break;
}
}
catch (Exception ex)
{
Utility.ShowMsg(ex.Message);
}
}