コード例 #1
0
        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");
                }
            });
        }
コード例 #2
0
 public ProjectCompileResult()
 {
     //Errors = new List<CompileMessage>();
     //Warnings = new List<CompileMessage>();
     Errors        = new KeyValuesDictionary <ZCompileFileInfo, CompileMessage>();
     Warnings      = new KeyValuesDictionary <ZCompileFileInfo, CompileMessage>();
     CompiledTypes = new List <IZDescType>();
 }
コード例 #3
0
 private void OnDeleteKeyValuePairExecute()
 {
     if (!KeyValuesDictionary.Contains(SelectedKeyValuePair))
     {
         return;
     }
     KeyValuesDictionary.Remove(SelectedKeyValuePair);
     SelectedKeyValuePair = null;
     FireErrorsChanged(nameof(KeyValuesDictionary));
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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\**");
            }
        }