Пример #1
0
        private object BackEndInsert(String name, RightClickShellType type, String Target, String Source)
        {
            RightClickShell added;
            RightClickShell parent = (DirectoryShell)treeView1.SelectedNode.Tag;

            switch (type)
            {
            case RightClickShellType.DirectoryShell:
                added = new DirectoryShell()
                {
                    Name = name
                };
                insert_deleted.Add(ref parent, ref added);
                break;

            case RightClickShellType.ExecutableShell:
                added = new ExecutableShell()
                {
                    Name = name, Command = ExecutableShell.CreateCommandFromSorceAndTarget(target: txtTarget.Text, source: txtSource.Text), HaveIcon = txtSource.Text + "\\" + txtTarget.Text
                };
                insert_deleted.Add(ref parent, ref added);
                break;

            default:
                added = new DirectoryShell()
                {
                    Name = name
                };
                throw new Exception("not a intended rightclickshelltype");
            }
            return(added);
        }
Пример #2
0
        private static void Insert()
        {
            Console.Write("Name:");
            String name = Console.ReadLine();

            Console.Write("Type:");
            RightClickShellType type = (RightClickShellType)int.Parse(Console.ReadLine());
            RightClickShell     added;

            switch (type)
            {
            case RightClickShellType.DirectoryShell:
                added = new DirectoryShell()
                {
                    Name = name
                };
                insert_deleted.Add(ref cursor, ref added);
                break;

            case RightClickShellType.ExecutableShell:
                added = new ExecutableShell()
                {
                    Name = name, Command = "MyCommand"
                };
                insert_deleted.Add(ref cursor, ref added);
                break;
            }
        }