private void ImportMenus(ScreenMenu screenMenu) { var fileName = string.Format("{0}/Imports/menu{1}.txt", LocalSettings.AppPath, "_" + LocalSettings.CurrentLanguage); if (!File.Exists(fileName)) fileName = string.Format("{0}/Imports/menu.txt", LocalSettings.AppPath); if (!File.Exists(fileName)) return; var lines = File.ReadAllLines(fileName, Encoding.UTF8); var items = BatchCreateMenuItems(lines, _workspace); _workspace.CommitChanges(); var groupCodes = items.Select(x => x.GroupCode).Distinct().Where(x => !string.IsNullOrEmpty(x)); foreach (var groupCode in groupCodes) { var code = groupCode; screenMenu.AddCategory(code); screenMenu.AddItemsToCategory(groupCode, items.Where(x => x.GroupCode == code).ToList()); } }