コード例 #1
0
 /// <summary>
 /// 添加拖拽的文件路径到行
 /// </summary>
 /// <param name="filePaths"></param>
 public void AddDragFilesToRow(string[] filePaths)
 {
     foreach (string filePath in filePaths)
     {
         DataRow row = ShortNameAndCommandsTable.NewRow();
         row[RealCommandName] = filePath;
         SetDefaultShortNameForDragFile(filePath, row);
         ShortNameAndCommandsTable.Rows.Add(row);
     }
 }
コード例 #2
0
 private void ReplaceDataTable()
 {
     ShortNameAndCommandsTable.Rows.Clear();
     foreach (var shortNameAndExePath in ShortNameAndCommands)
     {
         DataRow row = ShortNameAndCommandsTable.NewRow();
         row[RealCommandName] = shortNameAndExePath.Value;
         row[ShortName]       = shortNameAndExePath.Key;
         ShortNameAndCommandsTable.Rows.Add(row);
     }
 }
コード例 #3
0
        /// <summary>
        /// 合并重复项和唯一项表格
        /// </summary>
        /// <returns></returns>
        public DataTable MergeRepeatedAndDistinctTable()
        {
            if (distinctCommandTable == null)
            {
                return(ShortNameAndCommandsTable);
            }

            //重复项为空
            if (repeatedCommandTable.Rows.Count == 0)
            {
                ShortNameAndCommandsTable = distinctCommandTable;
                return(ShortNameAndCommandsTable);
            }

            ShortNameAndCommandsTable = distinctCommandTable.Copy();
            ShortNameAndCommandsTable.Merge(repeatedCommandTable);
            return(ShortNameAndCommandsTable);
        }
コード例 #4
0
        /// <summary>
        /// 计算只包含重复命令的表格
        /// </summary>
        /// <returns></returns>
        public DataTable ComputeOnlyIncludeRepeatedCommandsTable()
        {
            repeatedCommandTable = ShortNameAndCommandsTable.Clone();
            distinctCommandTable = ShortNameAndCommandsTable.Clone();
            Dictionary <string, int> commandAndCount = GetCommandAndCount();

            foreach (DataRow dataRow in ShortNameAndCommandsTable.Rows)
            {
                string command = dataRow[RealCommandName].ToString();
                if (commandAndCount[command] > 1)
                {
                    repeatedCommandTable.ImportRow(dataRow);
                }
                else
                {
                    distinctCommandTable.ImportRow(dataRow);
                }
            }

            return(repeatedCommandTable);
        }