Ejemplo n.º 1
0
        /// <summary>
        /// Pins the jump lists.
        /// </summary>
        private void PinJumpLists()
        {
            // this is init section
            JumpList jumpList1 = JumpList.GetJumpList(App.Current);

            jumpList1.JumpItems.Clear();

            // get the config section from app.config file
            var csvConfigSection = ConfigurationManager.GetSection(StringSplitConfigDataSection.SectionName) as StringSplitConfigDataSection;

            if (csvConfigSection != null && csvConfigSection.CsvConfigCollection.Count > 0)
            {
                foreach (var item in csvConfigSection.CsvConfigCollection)
                {
                    CSVConfigItem configItem = item as CSVConfigItem;
                    string        name       = configItem.Name;

                    string fieldArgument = this.GetConcatenatedString(configItem);
                    this.AddJumpListTask(configItem.Name, string.Empty, fieldArgument);
                }
            }

            JumpList jumpList2 = JumpList.GetJumpList(App.Current);

            jumpList2.Apply();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        public App()
        {
            CSVConfigItem item = new CSVConfigItem();

            item.SplitChar             = @"\r\n";
            item.FieldDelimiter        = ",";
            item.EncloseCharacter      = "'";
            item.MaxItemsPerLine       = -1;
            item.RemoveBlankItems      = true;
            this.commaSeperatorDefault = this.GetConcatenatedString(item);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets various fields of the config item which a custom delimiter
        /// </summary>
        /// <param name="configItem">The configuration item.</param>
        /// <returns>Returns a concatenated string</returns>
        private string GetConcatenatedString(CSVConfigItem configItem)
        {
            string outPut = @"""" +
                            this.GetUnescapedCharacter(configItem.SplitChar) + ParameterDelimiter
                            + this.GetUnescapedCharacter(configItem.FieldDelimiter) + ParameterDelimiter
                            + this.GetUnescapedCharacter(configItem.EncloseCharacter) + ParameterDelimiter
                            + this.GetUnescapedCharacter(configItem.MaxItemsPerLine.ToString()) + ParameterDelimiter
                            + this.GetUnescapedCharacter(configItem.RemoveBlankItems.ToString()) + ParameterDelimiter
                            + @"""";

            return(outPut);
        }