📄 addstringentrycommand.cs
字号:
using System;
using System.Windows.Forms;
using ICSharpCode.Core.AddIns.Codons;
using ICSharpCode.SharpDevelop.Gui;
namespace ResourceEditor
{
class AddStringCommand : AbstractMenuCommand
{
public override void Run()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
ResourceEditorControl editor = (ResourceEditorControl)window.ViewContent.Control;
if(editor.ResourceList.WriteProtected) {
return;
}
int count = 1;
string newNameBase = " new string entry ";
string newName = newNameBase + count.ToString();
string type = "System.String";
while(editor.ResourceList.Resources.ContainsKey(newName)) {
count++;
newName = newNameBase + count.ToString();
}
ResourceItem item = new ResourceItem(newName, "");
editor.ResourceList.Resources.Add(newName, item);
ListViewItem lv = new ListViewItem(new string[] { newName, type, "" }, item.ImageIndex);
editor.ResourceList.Items.Add(lv);
editor.ResourceList.OnChanged();
lv.BeginEdit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -