private void OnImportFromExcel() { var dictionaryRes = StaticContainer.Container.Resolve <IExcelImporter>().ImportFromExcel(worksheet => { if (string.IsNullOrWhiteSpace(worksheet.GetCellValue(1, 3).Item)) { return; } try { var dictionary = new Dictionary <ushort, string>(); int counter = 2; while (worksheet.GetCellValue(counter, 1).Item != null && !string.IsNullOrWhiteSpace(worksheet.GetCellValue(counter, 1).Item.ToString())) { dictionary[ushort.Parse(worksheet.GetCellValue(counter, 2).Item.ToString())] = worksheet.GetCellValue(counter, 3).Item.ToString(); counter++; } KeyValuesDictionary.Clear(); foreach (KeyValuePair <ushort, string> kvp in dictionary) { KeyValuesDictionary.Add(new BindableKeyValuePair <ushort, string>(kvp.Key, kvp.Value)); } } catch { MessageBox.Show(StaticContainer.Container.Resolve <ILocalizerService>().GetLocalizedString( ApplicationGlobalNames.StatusMessages .FORMAT_ERROR), "Excel"); } }); }
public ProjectCompileResult() { //Errors = new List<CompileMessage>(); //Warnings = new List<CompileMessage>(); Errors = new KeyValuesDictionary <ZCompileFileInfo, CompileMessage>(); Warnings = new KeyValuesDictionary <ZCompileFileInfo, CompileMessage>(); CompiledTypes = new List <IZDescType>(); }
private void OnDeleteKeyValuePairExecute() { if (!KeyValuesDictionary.Contains(SelectedKeyValuePair)) { return; } KeyValuesDictionary.Remove(SelectedKeyValuePair); SelectedKeyValuePair = null; FireErrorsChanged(nameof(KeyValuesDictionary)); }
private void AddNewKeyPair() { if (KeyValuesDictionary.Count == 0) { KeyValuesDictionary.Add(new BindableKeyValuePair <ushort, string>()); return; } ushort maxKey = KeyValuesDictionary.Select(pair => pair.Key).Max(); BindableKeyValuePair <ushort, string> keyPair = new BindableKeyValuePair <ushort, string> { Key = (ushort)(maxKey + 1), Value = string.Empty }; KeyValuesDictionary.Add(keyPair); }
private void AddDefaultExcludes(FileSet fs) { KeyValuesDictionary fileOptions = options.GetKeys("Files"); foreach (string defaultExclude in fileOptions.GetValues("DefaultExcludes")) { string pattern = @"**" + Path.DirectorySeparatorChar + defaultExclude; if (defaultExclude.IndexOf("*") != -1) { AddExclude(fs, pattern); } else { AddExclude(fs, pattern + Path.DirectorySeparatorChar + "**"); } } if (fs.Excludes.Count == 0) { fs.Excludes.Add(@"**\.svn\**"); } }