小编Joh*_*hen的帖子

如何在新标签中打开新创建的图像?

下面的代码在同一页面的底部创建图像.如何将该图像显示到新的选项卡/窗口而不是显示在同一页面中?

success: function (data) {
            var image = new Image();
            image.src = "data:image/jpg;base64," + data.d;
            document.body.appendChild(image);
        }
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery dom

20
推荐指数
3
解决办法
3万
查看次数

如何在特定选定项目内的TFS源代码管理中搜索特定文件?

码:

string spName = "usp_Test_Procedure.sql";
var tfsPp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
tfsPp.ShowDialog();
_tfs = tfsPp.SelectedTeamProjectCollection;
if (tfsPp.SelectedProjects.Any())
{
     _selectedTeamProject = tfsPp.SelectedProjects[0];
}
string selectedProjectName = _selectedTeamProject.Name;
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_tfs.Uri);
var vsStore = tfs.GetService<VersionControlServer>();
var project = "project";
var branchVersion = "1.0.0";
var folders = vsStore.GetItems("$/" + selectedProjectName + "/*", RecursionType.Full);
Run Code Online (Sandbox Code Playgroud)

如何在特定选定项目中搜索TFS源代码控件中的特定文件,以及用户从c#UI winforms应用程序中选择下拉菜单中的branchversion

我需要搜索的文件usp_Test_Procedure.sql位于以下路径中

$/selectedProjectName/project/1.0.0/UI/Scripts/usp_Test_Procedure.sql
Run Code Online (Sandbox Code Playgroud)

实际上我从愚蠢的代码中获得了上述路径:

folders.Items[29956].ServerItem
Run Code Online (Sandbox Code Playgroud)

但我需要知道如何在特定选定项目内的TFS源控件中搜索特定文件,还选择branchversion?谢谢.

.net c# tfs full-text-search tfs2012

16
推荐指数
2
解决办法
2万
查看次数

如何将WorkItemCollection转换为List

我想转换WorkItemCollection为a List<WorkItem>,以便我可以将其进一步转换为a dictionary.这是迄今为止的代码:

var testItemCollectionList = new List<WorkItem>();
WorkItemCollection testItemCollection;
Query query = new Query(project.Store, "Select [Title] From WorkItems", testResults.Select(item => item.TargetId).ToArray());
var car = query.BeginQuery();
testItemCollection = query.EndQuery(car);
testItemCollectionList = ???;
var testItemMapQuery = testItemCollectionList.ToDictionary(w => w, createItemFromQuery);
Run Code Online (Sandbox Code Playgroud)

c# linq collections tfs list

8
推荐指数
2
解决办法
4730
查看次数

如何在mvc4的cshtml视图页面中的html.textboxfor中设置数字范围验证?

码:

@Html.TextBoxFor(x => x.PercentNos, new {@class = "percentage-numbers"})
Run Code Online (Sandbox Code Playgroud)

如何@html.textboxfor在mvc4的cshtml视图页面中设置数字限制0到100 ?

asp.net-mvc razor asp.net-mvc-4

5
推荐指数
1
解决办法
2408
查看次数

如何比较两个富文本框内容并突出显示更改的字符?

我用来读取2个richtextbox内容的代码如下:

richTextBox1.Text = File.ReadAllText(tfsVersionFilePath);
richTextBox2.Text = File.ReadAllText(dbVersionFilePath);
Run Code Online (Sandbox Code Playgroud)

现在,我需要比较两个富文本框内容,并突出显示两个richtextbox中更改的字符.目的是as in TFS通过c#应用程序获得差异并突出显示字符(比较文件).谢谢.

编辑:

int length = (richTextBox1.Text.Length > richTextBox2.Text.Length) ? richTextBox1.Text.Length : richTextBox2.Text.Length;
for (int i = 0; i < length; i++)
{ 
   if (richTextBox1.Text[i] != richTextBox2.Text[i])
   {
      /* and then start your highlight selection here, 
      this is where some difference between the two rich 
      text boxes begins */

      richTextBox1.Select(i, 1); 
      richTextBox1.SelectionColor = System.Drawing.Color.Yellow; 
      richTextBox1.SelectionBackColor = System.Drawing.Color.Red;
   }
}
Run Code Online (Sandbox Code Playgroud)

我从调试中理解的是,在执行特定行之后,指向文本光标的richTextBox1 SelectSelectionColorSelectionBackColor方法增加到7个位置.如何保持 richTextBox1 …

.net c# richtextbox winforms

4
推荐指数
1
解决办法
1万
查看次数

如何在ICollection中的特定索引中添加项目?

码:

TestItem TI = new TestItem();
ITestItem IC = TI;
controls.TestItems.Add(IC); //This adds the item into the last column, but I need to add this in a particular index

TestItem is a Class  
ITestItem is an Interface 
controls is a local variable
TestItems is a ICollection<ITestItem>
Run Code Online (Sandbox Code Playgroud)

如何在ICollection中的特定索引中添加项目?

.net collections wpf list c#-4.0

2
推荐指数
1
解决办法
1765
查看次数

如何在javascript中用以下行中的"i"替换for循环?

如何在javascript中用以下行中的"i"替换for循环?

码:

for (var i = 0, n = checkboxes.length; i < n; i++) {
    e.form.NameLists_0__IsDeleted.checked = false;
}
Run Code Online (Sandbox Code Playgroud)

javascript

1
推荐指数
1
解决办法
51
查看次数

如何将以下foreach嵌套循环转换为LINQ?

码:

foreach (var item in items.Children)
{
    RadTreeViewItem parent1 = new RadTreeViewItem();
    parent1.Header = NodeHeader(item.Path, item.Name, SelectedPath, ProjectData);
    parent1.Tag = item;
    foreach (var child in item.Children)
    {
        RadTreeViewItem children = new RadTreeViewItem();
        children.Header = NodeHeader(child.Path, child.Name, SelectedPath, ProjectData);
        children.Tag = child;
        parent1.Items.Add(children);
    }
    Parent.Items.Add(parent1);
}
Run Code Online (Sandbox Code Playgroud)

items.Children和item.Children是 ObservableCollection<>

parent1.Header和children.Header是 HeaderedItemsControl.Header

parent1.Tag和children.Tag是 FrameworkElement.Tag

如何将上面的foreach嵌套循环转换为LINQ?

c# linq wpf performance foreach

0
推荐指数
1
解决办法
150
查看次数

如何应用字符串值?

码:

$(".drpdwn")[0].options.value = "1"
Run Code Online (Sandbox Code Playgroud)

我需要将此值更改为 "string"

所以,我编码为,

$(".drpdwn")[0].options.value = "string"
Run Code Online (Sandbox Code Playgroud)

但是,价值就像""快速观察一样.

如何应用字符串值?

jquery

-2
推荐指数
1
解决办法
91
查看次数

完整的HTML Strip功能

我有一个像这样的HTML字符串:

<p>First Sentence is this.&#160;Second sentence is this.</p>
Run Code Online (Sandbox Code Playgroud)

我可以<p>使用regex函数从上面的字符串中删除标签.

但是,如何从上面的字符串中删除&#160;- 编码字符winforms

我不想&#160;出现在输出中.

.net html c# regex winforms

-3
推荐指数
1
解决办法
322
查看次数