我有两个文本框用于用户的名字和第二个名字,我创建了一个转换器,当文本等于特定字符串时,它会更改文本框的背景颜色.我遇到的问题是文本框只会在运行时更新,并且在我更改文本时不会更新文本框.
XAML:
<TextBox x:Name="forenameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="1"
Background="{Binding Staff,Converter ={StaticResource StaffNameToBackgroundColourConverter1}}"
Text="{Binding Staff.Forename, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
<Label Content="Surname:" Grid.Column="0" HorizontalAlignment="Left" Margin="3" Grid.Row="2" VerticalAlignment="Center"/>
<TextBox x:Name="surnameTextBox" Grid.Column="1" HorizontalAlignment="Left" Height="23" Margin="3" Grid.Row="2"
Background="{Binding Staff,Converter={StaticResource StaffNameToBackgroundColourConverter1}}"
Text="{Binding Staff.Surname, Mode=TwoWay, NotifyOnValidationError=true, ValidatesOnExceptions=true}" VerticalAlignment="Center" Width="120"/>
Run Code Online (Sandbox Code Playgroud)
转换器代码:
public class StaffNameToBackgroundColourConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var staff = (Staff) value;
if (staff.Forename == "Donald" && staff.Surname == "Duck")
{
return "Yellow";
}
else …Run Code Online (Sandbox Code Playgroud) 我正在尝试在c#中创建一个程序,允许我连接到我的TFS以创建新的工作项.
NetworkCredential netCred = new NetworkCredential(
"username",
"password");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("https://example.visualstudio.com/DefaultCollection"),tfsCred);
tpc.Authenticate();
Run Code Online (Sandbox Code Playgroud)
在我尝试连接到TFS的那一刻,我正在使用我自己的Live用户名和密码,它给出了错误消息"TF30063:您未经授权".我不确定与TFS建立连接的不同方法.
我相信正确的方法是使用服务凭据,但目前我无法锻炼如何找到服务凭据我不知道如何在TFS中找到我的服务凭据.
我有以下控制台应用程序,它将从超过 7 天的存储帐户容器中删除 blob。
我试图通过调用 WriteNumberFilesProcessed() 在控制台屏幕上创建一个反馈循环,一旦 blob 被删除,它就会增加成员变量 _counter,然后写入控制台。
问题是当最后一个任务在 TPL foreach 循环中完成而不是 _counter 成员变量从 29999 到 30000 时,它将是更远的东西,即 29995。
我不确定我需要做什么来确保 TPL foreach 循环获得最新的成员变量?
class Program
{
static int _counter = 0;
static int _numBlobsToDelete = 30000;
static int _blobCount = 0;
static void Main(string[] args)
{
GetOldBlobs();
Console.ReadLine();
}
static async void GetOldBlobs()
{
try
{
Stopwatch stopWatch = new Stopwatch();
CloudStorageAccount acc = CloudStorageAccount.Parse("");
var client = acc.CreateCloudBlobClient();
var container = client.GetContainerReference("");
var rollingTotal = 0;
while …Run Code Online (Sandbox Code Playgroud)