当前位置: 首页>>代码示例>>C#>>正文


C# Commands.Execute方法代码示例

本文整理汇总了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);
        }
开发者ID:bizmonger,项目名称:ClipPaste,代码行数:17,代码来源:EditContentTest.cs

示例2: ExecuteFunction

 protected override bool ExecuteFunction(out object result, Commands.ExecuteFunctionCommand command)
 {
     return command.Execute(out result);
 }
开发者ID:remcok,项目名称:Simple.Data,代码行数:4,代码来源:Database.cs

示例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);
            }
        }
开发者ID:aoltra,项目名称:Galaga-SFML.Net,代码行数:24,代码来源:SceneNode.cs

示例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 ();
                }
//.........这里部分代码省略.........
开发者ID:rolfbjarne,项目名称:gui-diff,代码行数:101,代码来源:terminal.cs


注:本文中的Commands.Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。