示例#1
0
        private void LoadFiles()
        {
            var list = CrossIO.GetListFiles(currentDir);

            AddItemToPanel(_folder, "...", null, OnClickBack);
            if (CrossIO.IsUserDir(currentDir))
            {
                AddItemToPanel(_new, Localization.GetLocalName("Create New"), null, OnClickNew);
                AddItemToPanel(_new, Localization.GetLocalName("Edit"), currentDir, OnClickEditor);
            }
            foreach (var fileName in list)
            {
                Cross cross;
                try
                {
                    cross = CrossIO.Import(currentDir, fileName);
                }
                catch (Exception)
                {
                    //TODO log here
                    continue;
                }
                string label = $"{cross.TopSize} x {cross.LeftSize}";
                AddItemToPanel(CrossMakeIcon(cross), label, fileName, OnClickFile);
            }
        }
示例#2
0
        public static string SelectName(string dir, string name)
        {
            var form = new SelectNameForm
            {
                crossNames  = CrossIO.GetListFiles(dir).ToList(),
                name        = name,
                controlName = { Text = name }
            };
            var res = form.ShowDialog();

            if (res != DialogResult.OK)
            {
                return(null);
            }
            return(form.controlName.Text.Trim());
        }