有没有办法将此函数封装在静态类中?
private void btnAddWorker_ItemClick(object sender, ItemClickEventArgs e)
{
bool isOpen = false;
foreach (Form _f in Application.OpenForms)
{
if (_f is frmAddWorker)
{
isOpen = true;
_f.Focus();
break;
}
}
if (isOpen == false)
{
frmAddWorker AddWorker = new frmAddWorker() { MdiParent = this };
AddWorker.Show();
}
}
类似的东西:
public class Forms(){public void openForm(form _f){...}}
我想阻止在打开的所有表单按钮中写入原始代码。
答案 0 :(得分:0)
StaticClass.Focus<frmAddWorker>(this);
这样称呼:
import csv
from circuits.web import Server, Controller
def Do_something(row):
return row
class Root(Controller):
def send_data(self, filename):
self.response.stream = True
with open(filename, "rb") as csvfile:
datareader = csv.reader(csvfile)
for row in datareader:
preprocessed = Do_something(row)
yield preprocessed
app = Server(("0.0.0.0", 8000))
Root().register(app)
app.run()