old_flsystem/FLSystem/Forms/notice_robotapi_control.cs

78 lines
2.1 KiB
C#
Raw Permalink Normal View History

2022-09-20 03:10:29 +00:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Api.Framework;
using UI.Framework.Forms;
using Api.Framework.Model;
namespace FLSystem.Forms
{
public partial class notice_robotapi_control : UserControl
{
public notice_robotapi_control()
{
InitializeComponent();
}
private void simpleButton1_Click(object sender, EventArgs e)
{
var f = new notice_robotapi_editform();
f.ShowDialog();
if (f.IsUpdate) simpleButton2_Click(null, null);
}
private void Loading(bool f=false)
{
try
{
this.gridControl1.DataSource = null;
var session = ApiClient.GetSession();
var list = session.FindNoticeapiRobots(f);
this.gridControl1.DataSource = list;
}
catch (Exception ex)
{
BaseForm.ShowError(ex);
}
}
private void simpleButton2_Click(object sender, EventArgs e)
{
Loading(true);
}
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
{
var r = this.gridView1.GetSelectedRows();
if (r.Length == 0) e.Cancel = true;
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
var r = this.gridView1.GetSelectedRows();
if (r.Length == 0) return;
var row = this.gridView1.GetRow(r[0]) as fl_noticeapi_info;
var f = new notice_robotapi_editform(row);
f.ShowDialog();
if (f.IsUpdate) simpleButton2_Click(null, null);
}
catch (Exception)
{
}
}
private void notice_robotapi_control_Load(object sender, EventArgs e)
{
Loading(true);
}
}
}