Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();
            DestinationPathTextBox.Text = DestinationFolderPath;

            if (StaticVariables.SelectedFiles.Length > 0)
            {
                DefaultSourcePath = Path.GetDirectoryName(StaticVariables.SelectedFiles[0]);
            }

            var projects = new List <TemplateProject>();
            //var sourcePath = Environment.GetCommandLineArgs()[1];
            var sourcePath = DefaultSourcePath;
            var folders    = Directory.GetDirectories(sourcePath);
            var files      = Directory.GetFiles(sourcePath);

            var selectedfiles   = new List <TemplateProject>();
            var selectedfolders = new List <TemplateProject>();

            foreach (var relativepathtempl in folders)
            {
                var proj = new TemplateProject(
                    Path.GetFileName(relativepathtempl),
                    Path.GetFullPath(relativepathtempl),
                    FileOrFolder.Folder);
                projects.Add(proj);
                if (StaticVariables.SelectedFiles.Contains(relativepathtempl))
                {
                    selectedfolders.Add(proj);
                }
            }

            foreach (var relativepathtempl in files)
            {
                if (relativepathtempl.EndsWith(".gitingnore"))
                {
                    continue;
                }

                var proj = new TemplateProject(
                    Path.GetFileName(relativepathtempl),
                    Path.GetFullPath(relativepathtempl),
                    FileOrFolder.File);
                projects.Add(proj);

                if (StaticVariables.SelectedFiles.Contains(relativepathtempl))
                {
                    selectedfiles.Add(proj);
                }
            }

            ListBoxTest.ItemsSource = projects;
            foreach (var selecteditem in selectedfiles.Concat(selectedfolders))
            {
                ListBoxTest.SelectedItems.Add(selecteditem);
            }

            ListBoxTest.Focus();
        }
Beispiel #2
0
        public void Deny_Unrestricted()
        {
            ListBoxTest unit = new ListBoxTest();

            unit.Defaults();
            unit.SetProps();
            unit.ViewState();
            unit.Render1();
            unit.DoubleDataBind();
            unit.RowsTooHigh();
        }
Beispiel #3
0
    static void Main()
    {
        // create a new ListBox and initialize
        ListBoxTest lbt = new ListBoxTest("Hello", "World");

        // add a few strings
        lbt.Add("Proust");
        lbt.Add("Faulkner");
        lbt.Add("Mann");
        lbt.Add("Hugo");

        // test the access by modifying the second value
        string subst = "Universe";

        lbt[1]     = subst;
        lbt["Hel"] = "GoodBye";      // string segment as the index instead of an int
        // lbt["xyz"] = "oops";          // this would return index -1, causing exception

        // access all the strings
        for (int i = 0; i < lbt.GetNumEntries(); i++)
        {
            Console.WriteLine("lbt[{0}]: {1}", i, lbt[i]);
        }
    }