Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                AppDomain.CurrentDomain.AssemblyResolve += onResolve;
                AppDomain.CurrentDomain.AssemblyLoad    += onLoad;
                trySetIcon();
                String dir = Assembly.GetExecutingAssembly().Location;

                StringDict dirs = new StringDict();
                dir = IOUtils.FindDirectoryToRoot(Path.GetDirectoryName(dir), "ImportDirs");
                if (dir != null)
                {
                    dirs.Add(dir, null);
                }

                StringDict files = new StringDict();
                foreach (var f in History.LoadHistory(HISTORY_KEY))
                {
                    files[f] = null;
                    dir      = Path.GetDirectoryName(Path.GetDirectoryName(f));
                    if (!String.IsNullOrEmpty(dir))
                    {
                        dirs[dir] = null;
                    }
                }

                foreach (var kvp in dirs)
                {
                    FileTree tree = new FileTree();
                    tree.AddFileFilter(@"\\import\.xml$", true);
                    tree.ReadFiles(kvp.Key);
                    if (tree.Files.Count != 0)
                    {
                        tree.Files.Sort();
                        foreach (var relfile in tree.Files)
                        {
                            files[tree.GetFullName(relfile)] = null;
                        }
                    }
                }

                ac = new DirectoryAutocompleter(comboBox1, files.Select(kvp => kvp.Key).ToList());
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                Logs.ErrorLog.Log(ex);
                throw;
            }
        }
 public SubclassHook(AutoCompleter parent)
 {
     this.parent = parent;
     this.AssignHandle(parent.cb.Handle);
 }