本文整理汇总了C#中Commands.Execute方法的典型用法代码示例。如果您正苦于以下问题:C# Commands.Execute方法的具体用法?C# Commands.Execute怎么用?C# Commands.Execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Commands
的用法示例。
在下文中一共展示了Commands.Execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: save_edit
public void save_edit()
{
// Setup
new MockRepository(); // Initialize subscriptions
var content = new Content() { Id = SOME_INTEGER_ID, Value = SOME_OTHER_TEXT };
var viewModel = new ViewModel() { Content = content };
viewModel.PreviousContent = SOME_TEXT;
var save = new Commands().Save;
// Test
save.Execute(viewModel.Content);
// Verify
var changesMade = viewModel.Content.Value == SOME_OTHER_TEXT;
Assert.IsTrue(changesMade);
}
示例2: ExecuteFunction
protected override bool ExecuteFunction(out object result, Commands.ExecuteFunctionCommand command)
{
return command.Execute(out result);
}
示例3: OnCommand
/// <summary>
/// Ejecuta, si su categoria lo indica, el comando. Además reenvía el comando a sus hijos
/// </summary>
/// <param name="command">Comando a a ejecutar</param>
/// <param name="dt">Incremento de tiempo desde la última actualización</param>
public void OnCommand(Commands.Command command, SFML.System.Time dt)
{
// comparación binaria
if ((command.Category & Category) == Category)
{
command.Execute(this, dt);
}
//foreach (SceneNode sc in _children)
//{
// sc.OnCommand(command, dt);
//}
// no se implementa con foreach para evitar problemas de mantenimiento al borrar elementos internos
for (int n = 0; n < _children.Count; n++)
{
_children[n].OnCommand(command,dt);
}
}
示例4: Do
bool Do()
{
string last_cmd = null;
string cmd;
int id;
PrintList ();
cmds = new Commands ()
{
{ "h|help|?", "Show this help message", delegate (string v)
{
cmds.Help ();
}
},
{ "e|edit", "Open file in editor", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
Execute ("gedit", selected.QuotedFileName);
}
},
{ "gedit", "Open the file in gedit", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
Execute ("gedit", selected.QuotedFileName, false, false, false);
}
},
{ "geditall", "Open the files in gedit", delegate (string v)
{
Execute ("gedit", string.Join (" ", entries.Where ((w) => !w.untracked).Select ((w) => w.QuotedFileName).ToArray ()), false, false, false);
}
},
{ "nano", "Open file in nano", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
Execute ("nano", "-c " + selected.QuotedFileName, false);
}
},
{ "c|changelog", "Edit ChangeLog for the selected file", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
EditChangeLog (selected);
list_dirty = true;
PrintList ();
}
},
{ "a|add", "Add file to index", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
list_dirty = true;
Execute ("git", (selected.deleted ? "rm -- " : "add ") + selected.QuotedFileName);
PrintList ();
}
},
{ "add+next|an", "Add file to index and go to next file", delegate (string v)
{
if (selected == null)
throw new DiffException ("You need to select a file first.");
list_dirty = true;
Execute ("git", (selected.deleted ? "rm -- " : "add ") + selected.QuotedFileName);
if (selected == null)
throw new DiffException ("You need to select a file first.");
int idx = entries.IndexOf (selected);
if (idx + 1 == entries.Count) {
idx = 0;
} else {
idx++;
}
selected = entries [idx];
ShowDiff (null);
}
},
{ "addall|add -u", "Add all changed files to the index", delegate (string v)
{
list_dirty = true;
foreach (var entry in entries) {
if (!entry.untracked) {
Execute ("git", "add " + entry.QuotedFileName);
Console.WriteLine ("Added " + entry.filename);
}
}
PrintList ();
}
},
{ "addalluntracked", "Add all untracked files to the index", delegate (string v)
{
list_dirty = true;
foreach (var entry in entries) {
if (entry.untracked) {
Execute ("git", "add " + entry.QuotedFileName);
Console.WriteLine ("Added " + entry.filename);
}
}
PrintList ();
}
//.........这里部分代码省略.........