diff --git a/XCoder/Data/FrmSync.cs b/XCoder/Data/FrmSync.cs
index 4f95b8a..fddf6c8 100644
--- a/XCoder/Data/FrmSync.cs
+++ b/XCoder/Data/FrmSync.cs
@@ -25,7 +25,7 @@ namespace CrazyCoder.Data
{
cbConn.DataSource = DAL.ConnStrs.Keys.ToArray();
- Task.Run(() => DbHelper.AutoDetectDatabase(() => this.Invoke(SetDatabaseList, DAL.ConnStrs.Keys.OrderBy(e => e).ToList())));
+ Task.Run(() => DbHelper.AutoDetectDatabase(() => Invoke(SetDatabaseList, DAL.ConnStrs.Keys.OrderBy(e => e).ToList())));
}
void SetDatabaseList(ICollection<String> list)
diff --git a/XCoder/FileEncoding/FrmMain.cs b/XCoder/FileEncoding/FrmMain.cs
index 431d436..333ba3b 100644
--- a/XCoder/FileEncoding/FrmMain.cs
+++ b/XCoder/FileEncoding/FrmMain.cs
@@ -81,7 +81,7 @@ namespace XCoder.FileEncoding
}
}
- MessageBox.Show("转换{0}个文件完成".F(count));
+ MessageBox.Show($"转换{count}个文件完成");
gv_data.Rows.Clear();
}
diff --git a/XCoder/FolderInfo/FrmMain.cs b/XCoder/FolderInfo/FrmMain.cs
index 6156e57..ed9e9c5 100644
--- a/XCoder/FolderInfo/FrmMain.cs
+++ b/XCoder/FolderInfo/FrmMain.cs
@@ -164,7 +164,7 @@ namespace XCoder.FolderInfo
var size = FolderSize(node.Tag as DirectoryInfo);
var str = node.Text.Substring(0, node.Text.Length - 10) + String.Format("{0,10}", FormatSize(size));
//SetNodeText(node, str, GetColor(size));
- this.Invoke(() =>
+ Invoke(() =>
{
node.Text = str;
node.BackColor = GetColor(size);
diff --git a/XCoder/FrmMDI.cs b/XCoder/FrmMDI.cs
index cda0a9d..88f6d49 100644
--- a/XCoder/FrmMDI.cs
+++ b/XCoder/FrmMDI.cs
@@ -53,7 +53,7 @@ namespace XCoder
{
if (item.FullName.EqualIgnoreCase(name))
{
- this.Invoke(() => CreateForm(item.CreateInstance() as Form));
+ Invoke(() => CreateForm(item.CreateInstance() as Form));
break;
}
@@ -61,7 +61,7 @@ namespace XCoder
ts = ts.OrderBy(t => t.FullName).ToArray();
- this.Invoke(() =>
+ Invoke(() =>
{
var ms = new Dictionary<String, ToolStripMenuItem>();
foreach (ToolStripMenuItem item in menuStrip.Items)
diff --git a/XCoder/Tools/FrmGPS.cs b/XCoder/Tools/FrmGPS.cs
index 93582a1..841c749 100644
--- a/XCoder/Tools/FrmGPS.cs
+++ b/XCoder/Tools/FrmGPS.cs
@@ -44,7 +44,7 @@ namespace XCoder.Tools
txt_lat.Text = v_lat + "";
txt_long.Text = v_long + "";
- txt_latlong.Text = "{0},{1}".F(v_lat, v_long);
+ txt_latlong.Text = $"{v_lat},{v_long}";
}
}
}
diff --git a/XCoder/Windows/FrmMain.cs b/XCoder/Windows/FrmMain.cs
index 36d62b0..9e13ded 100644
--- a/XCoder/Windows/FrmMain.cs
+++ b/XCoder/Windows/FrmMain.cs
@@ -68,7 +68,7 @@ namespace XCoder
//LoadConfig();
- Task.Run(() => DbHelper.AutoDetectDatabase(() => this.Invoke(SetDatabaseList, DAL.ConnStrs.Keys.OrderBy(e => e).ToList())));
+ Task.Run(() => DbHelper.AutoDetectDatabase(() => Invoke(SetDatabaseList, DAL.ConnStrs.Keys.OrderBy(e => e).ToList())));
//Task.Run(async () =>
//{
// await DbHelper.AutoDetectDatabase();
@@ -169,7 +169,7 @@ namespace XCoder
return;
}
- this.Invoke(() =>
+ Invoke(() =>
{
//SetTables(null);
SetTables(Tables); //修复数据建模界面连接数据库不显示数据表问题
diff --git a/XCoder/Windows/FrmQuery.cs b/XCoder/Windows/FrmQuery.cs
index 8a5de01..75f483b 100644
--- a/XCoder/Windows/FrmQuery.cs
+++ b/XCoder/Windows/FrmQuery.cs
@@ -70,8 +70,8 @@ namespace XCoder
msg += String.Format(" 耗时{0}", sw.Elapsed);
}
- this.Invoke(() => lbStatus.Text = msg);
- if (dt != null) this.Invoke(() => gv.DataSource = dt);
+ Invoke(() => lbStatus.Text = msg);
+ if (dt != null) Invoke(() => gv.DataSource = dt);
});
}
@@ -102,7 +102,7 @@ namespace XCoder
msg += String.Format(" 耗时{0}", sw.Elapsed);
}
- this.Invoke(() => lbStatus.Text = msg);
+ Invoke(() => lbStatus.Text = msg);
});
}
}
diff --git a/XCoder/Windows/FrmSchema.cs b/XCoder/Windows/FrmSchema.cs
index 85b12a3..9fb4b21 100644
--- a/XCoder/Windows/FrmSchema.cs
+++ b/XCoder/Windows/FrmSchema.cs
@@ -45,12 +45,12 @@ namespace XCoder
ThreadPoolX.QueueUserWorkItem(() =>
{
var tables = Db.CreateMetaData().GetTables();
- this.Invoke(SetList, cbTables, tables);
+ Invoke(SetList, cbTables, tables);
});
ThreadPoolX.QueueUserWorkItem(() =>
{
var list = Db.CreateMetaData().MetaDataCollections;
- this.Invoke(SetList, cbSchemas, list);
+ Invoke(SetList, cbSchemas, list);
});
}
#endregion
diff --git a/XCoder/XApi/FrmMain.cs b/XCoder/XApi/FrmMain.cs
index 0c3ac0a..f70a96b 100644
--- a/XCoder/XApi/FrmMain.cs
+++ b/XCoder/XApi/FrmMain.cs
@@ -76,10 +76,10 @@ namespace XApi
var sp = SpeechRecognition.Current;
if (!sp.Enable) return;
- sp.Register("打开", () => this.Invoke(Connect))
- .Register("关闭", () => this.Invoke(Disconnect))
+ sp.Register("打开", () => Invoke(Connect))
+ .Register("关闭", () => Invoke(Disconnect))
.Register("退出", () => Application.Exit())
- .Register("发送", () => this.Invoke(() => btnSend_Click(null, null)));
+ .Register("发送", () => Invoke(() => btnSend_Click(null, null)));
BizLog.Info("语音识别前缀:{0} 可用命令:{1}", sp.Name, sp.GetAllKeys().Join());
});
@@ -164,7 +164,7 @@ namespace XApi
svr.Register<MyApiController>();
svr.Start();
- "正在监听{0}".F(port).SpeechTip();
+ $"正在监听{port}".SpeechTip();
_Server = svr;
break;
@@ -215,7 +215,7 @@ namespace XApi
async void GetApiAll()
{
var apis = await _Client.InvokeAsync<String[]>("Api/All");
- if (apis != null) this.Invoke(() =>
+ if (apis != null) Invoke(() =>
{
cbAction.Items.Clear();
foreach (var item in apis)
diff --git a/XCoder/XCom/FrmMain.cs b/XCoder/XCom/FrmMain.cs
index 5f6f7c1..6b00356 100644
--- a/XCoder/XCom/FrmMain.cs
+++ b/XCoder/XCom/FrmMain.cs
@@ -71,7 +71,7 @@ namespace XCom
if (st == null) return;
// 需要考虑UI线程
- st.Disconnected += (s, e) => this.Invoke(Disconnect);
+ st.Disconnected += (s, e) => Invoke(Disconnect);
// 发现USB2401端口,自动发送设置命令
if (st.Description.Contains("USB2401") || st.Description.Contains("USBSER"))
@@ -82,7 +82,7 @@ namespace XCom
//TextControlLog.WriteLog(txtReceive, cmd);
}
- "连接串口{0}".F(st.PortName).SpeechTip();
+ $"连接串口{st.PortName}".SpeechTip();
btnConnect.Text = "关闭";
@@ -100,7 +100,7 @@ namespace XCom
if (btnConnect.Text == "打开") return;
var st = spList.Port;
- if (st != null) st.Disconnected -= (s, e) => this.Invoke(Disconnect);
+ if (st != null) st.Disconnected -= (s, e) => Invoke(Disconnect);
spList.Disconnect();
"串口已断开".SpeechTip();
diff --git a/XCoder/XCom/SerialPortList.cs b/XCoder/XCom/SerialPortList.cs
index 7a4e5ff..b0326cb 100644
--- a/XCoder/XCom/SerialPortList.cs
+++ b/XCoder/XCom/SerialPortList.cs
@@ -87,7 +87,7 @@ namespace NewLife.Windows
//cbEncoding.DataSource = new String[] { Encoding.UTF8.WebName, Encoding.ASCII.WebName, Encoding.UTF8.WebName };
// 添加编码子菜单
- var encs = new Encoding[] { Encoding.UTF8, Encoding.ASCII, Encoding.UTF7, Encoding.Unicode, Encoding.BigEndianUnicode, Encoding.UTF32,Encoding.GetEncoding("GB2312") };
+ var encs = new Encoding[] { Encoding.UTF8, Encoding.ASCII, Encoding.UTF7, Encoding.Unicode, Encoding.BigEndianUnicode, Encoding.UTF32, Encoding.GetEncoding("GB2312") };
var list = new List<Encoding>(encs);
// 暂时不用这么多编码
//list.AddRange(Encoding.GetEncodings().Select(e => e.GetEncoding()).Where(e => !encs.Contains(e)));
@@ -161,7 +161,7 @@ namespace NewLife.Windows
_ports = str;
- this.Invoke(() =>
+ Invoke(() =>
{
var old = cbName.SelectedItem + "";
cbName.DataSource = ps;
@@ -474,9 +474,9 @@ namespace NewLife.Windows
if (cfg.HexShow)
{
if (data.Length > 32)
- line = "[{0}]=\r\n{1}".F(data.Length, data.ToHex("-", 32));
+ line = $"[{data.Length}]=\r\n{data.ToHex("-", 32)}";
else
- line = "[{0}]={1}".F(data.Length, data.ToHex("-", 32));
+ line = $"[{data.Length}]={data.ToHex("-", 32)}";
if (cfg.HexNewLine) line += Environment.NewLine;
}
else
diff --git a/XCoder/XCom/SerialTransport.cs b/XCoder/XCom/SerialTransport.cs
index c3d432a..a37f8ab 100644
--- a/XCoder/XCom/SerialTransport.cs
+++ b/XCoder/XCom/SerialTransport.cs
@@ -399,9 +399,9 @@ namespace NewLife.Net
//if (sub.GetValue("Class") + "" == "Ports")
{
var FriendlyName = sub.GetValue("FriendlyName") + "";
- if (FriendlyName.Contains("({0})".F(name)))
+ if (FriendlyName.Contains($"({name})"))
{
- des = FriendlyName.TrimEnd("({0})".F(name)).Trim();
+ des = FriendlyName.TrimEnd($"({name})").Trim();
break;
}
}
diff --git a/XCoder/XNet/FrmApiDiscover.cs b/XCoder/XNet/FrmApiDiscover.cs
index 4036747..ad43ba4 100644
--- a/XCoder/XNet/FrmApiDiscover.cs
+++ b/XCoder/XNet/FrmApiDiscover.cs
@@ -93,7 +93,7 @@ namespace XNet
var result = enc.DecodeResult(action, data, msg);
var ai = enc.Convert(result, typeof(ApiItem)) as ApiItem;
- if (ai != null) this.Invoke(() => ShowItem(ai));
+ if (ai != null) Invoke(() => ShowItem(ai));
//XTrace.WriteLine("{0}", result);
}
}
diff --git a/XCoder/XNet/FrmMain.cs b/XCoder/XNet/FrmMain.cs
index f52f0a3..7b1d642 100644
--- a/XCoder/XNet/FrmMain.cs
+++ b/XCoder/XNet/FrmMain.cs
@@ -70,7 +70,7 @@ namespace XNet
{
list.Add(item.Key);
}
- this.Invoke(() =>
+ Invoke(() =>
{
cbMode.DataSource = list;
@@ -93,10 +93,10 @@ namespace XNet
var sp = SpeechRecognition.Current;
if (!sp.Enable) return;
- sp.Register("打开", () => this.Invoke(Connect))
- .Register("关闭", () => this.Invoke(Disconnect))
+ sp.Register("打开", () => Invoke(Connect))
+ .Register("关闭", () => Invoke(Disconnect))
.Register("退出", () => Application.Exit())
- .Register("发送", () => this.Invoke(() => btnSend_Click(null, null)));
+ .Register("发送", () => Invoke(() => btnSend_Click(null, null)));
BizLog.Info("语音识别前缀:{0} 可用命令:{1}", sp.Name, sp.GetAllKeys().Join());
});
@@ -238,7 +238,7 @@ namespace XNet
_Server.Start();
- "正在监听{0}".F(port).SpeechTip();
+ $"正在监听{port}".SpeechTip();
}
pnlSetting.Enabled = false;
@@ -260,7 +260,7 @@ namespace XNet
}
if (_Server != null)
{
- "停止监听{0}".F(_Server.Port).SpeechTip();
+ $"停止监听{_Server.Port}".SpeechTip();
_Server.Dispose();
_Server = null;
}
diff --git a/XCoder/XNet/FrmModbusSlave.cs b/XCoder/XNet/FrmModbusSlave.cs
index 9a2c0cd..56a0de2 100644
--- a/XCoder/XNet/FrmModbusSlave.cs
+++ b/XCoder/XNet/FrmModbusSlave.cs
@@ -188,7 +188,7 @@ namespace XNet
}
//dataGridView1.DataSource = _data;
//dgv.Refresh();
- this.Invoke(() => { dgv.Refresh(); });
+ Invoke(() => { dgv.Refresh(); });
}
private void OnReceived(Object sender, ReceivedEventArgs e)
diff --git a/XCoder/Yun/FrmMap.cs b/XCoder/Yun/FrmMap.cs
index 1f08467..9811d74 100644
--- a/XCoder/Yun/FrmMap.cs
+++ b/XCoder/Yun/FrmMap.cs
@@ -184,7 +184,7 @@ namespace XCoder.Yun
return;
}
- this.Invoke(() =>
+ Invoke(() =>
{
pgResult.SelectedObject = result;
diff --git a/XCoderLinux/XApi/FrmMain.cs b/XCoderLinux/XApi/FrmMain.cs
index 216c548..86cd467 100644
--- a/XCoderLinux/XApi/FrmMain.cs
+++ b/XCoderLinux/XApi/FrmMain.cs
@@ -166,7 +166,7 @@ namespace XApi
svr.Register<MyApiController>();
svr.Start();
- "正在监听{0}".F(port).SpeechTip();
+ $"正在监听{port}".SpeechTip();
_Server = svr;
break;
diff --git a/XCoderLinux/XCom/SerialPortList.cs b/XCoderLinux/XCom/SerialPortList.cs
index c24b074..8413054 100644
--- a/XCoderLinux/XCom/SerialPortList.cs
+++ b/XCoderLinux/XCom/SerialPortList.cs
@@ -476,9 +476,9 @@ namespace NewLife.Windows
if (cfg.HexShow)
{
if (data.Length > 32)
- line = "[{0}]=\r\n{1}".F(data.Length, data.ToHex("-", 32));
+ line = $"[{data.Length}]=\r\n{data.ToHex("-", 32)}";
else
- line = "[{0}]={1}".F(data.Length, data.ToHex("-", 32));
+ line = $"[{data.Length}]={data.ToHex("-", 32)}";
if (cfg.HexNewLine) line += Environment.NewLine;
}
else