我不知道如何使用计时器或if语句。如何触发呢?然后让其他标签显示出来?
ten.biggest <- function(path) {
Robject <- read.file(path)
property_of_interest(x) %in% tail(sort(eval.parent(parse(text = values))), 10)
}
答案 0 :(得分:1)
在您的TButton_Clicked
内:
async void TButton_Clicked(object sender, System.EventArgs e)
{
await Task.Delay(15000); // 15000ms == 15s
T1Text.IsVisible = false;
}
我建议您阅读有关异步编程的更多信息。
答案 1 :(得分:0)
您可以选择许多方法,例如:
1.System.Timers.Timer
private void TButton_Clicked(object sender, EventArgs e)
{
System.Timers.Timer t = new System.Timers.Timer(15000); // intial class Timer,set internal 15000ms;
t.Elapsed += new System.Timers.ElapsedEventHandler(doSometing2); //Execute events at time of arrival;
t.AutoReset = false; //Set to execute (false) once and execute (true) all the time
t.Enabled = true;
}
方法doSometing2
private void doSometing2(object sender, ElapsedEventArgs e)
{
Device.BeginInvokeOnMainThread(() =>
{
mLabel.IsVisible = false;
});
}
2。 Device.StartTimer
private void TButton_Clicked(object sender, EventArgs e)
{
Device.StartTimer(TimeSpan.FromSeconds(15), doSometing);
}
方法doSometing
private bool doSometing()
{
Device.BeginInvokeOnMainThread(() =>
{
mLabel.IsVisible = false;
});
return true;
}
3。 Thread.Sleep
private void TButton_Clicked(object sender, EventArgs e)
{
Thread.Sleep(15000);
mLabel.IsVisible = false;
}
4。 Task.Delay
private async void TButton_Clicked(object sender, EventArgs e)
{
await Task.Delay(15000); // 15000ms == 15s
mLabel.IsVisible = false;
}
答案 2 :(得分:0)
我这样做的方法,只需在该方法中添加StartTimer,它将在15秒后得到调用:
Device.StartTimer(TimeSpan.FromSeconds(15), () =>
{
T1Text.IsVisible = false;
return false;
});
如果只希望发生一次(如JS的SetTimeout),则返回false;否则,如果希望每15秒发生一次,则返回true(如JS的SetInterval)。
答案 3 :(得分:0)
public class StateToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (value is State)
{
State state = (State)value;
switch (state)
{
case State.Away:
case State.Gone:
return Visibility.Visible;
default:
return Visibility.Collapsed;
}
}
}
enter code here
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
return State.None; // your default state
}
}