在下面的代码中,只有 <TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test textview can be disabled at load"
style="@style/EntryTextStyle"
local:MvxBind=" Enabled RouteMarker.ArrivalNotice" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test textview with no click command, can be disabled at load"
style="@style/EntryTextStyle"
local:MvxBind=" Enabled RouteMarker.ArrivalNotice;
Clickable RouteMarker.ArrivalNotice" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test textview with click command cannot be disabled at load"
style="@style/EntryTextStyle"
local:MvxBind=" Enabled RouteMarker.ArrivalNotice;
Clickable RouteMarker.ArrivalNotice;
Click DoSomethingCommand" />
private IMvxAsyncCommand _doSomethingCommand;
public IMvxAsyncCommand DoSomethingCommand
{
get
{
_doSomethingCommand = _doSomethingCommand ?? new MvxAsyncCommand(async () =>
{
await Task.Delay(10);
});
return _doSomethingCommand;
}
}
部分被执行。我该怎么做才能执行else
部分?
if
答案 0 :(得分:2)
问题是您要检查StartTime
是否大于 CurrentTime
,这显然不是{\ n} 。您只需要使用 小于 运算符替换第一个运算符:
if (StartTime < CurrentTime && CurrentTime < Stoptime)
{
//CODE
}
else
{
//CODE
}
答案 1 :(得分:0)
public static Boolean IsTimeBetween(DateTime refer, DateTime begin, DateTime end, Boolean inclusive = true)
{
DateTime from = new DateTime(refer.Year, refer.Month, refer.Day, begin.Hour, begin.Minute, begin.Second, begin.Millisecond);
DateTime to = new DateTime(refer.Year, refer.Month, refer.Day, end.Hour, end.Minute, end.Second, end.Millisecond);
if (inclusive)
return ((from <= refer) && (to >= refer));
return ((from < refer) && (to > refer));
}
这绝不会让你错:
Boolean between = IsTimeBetween(CurrentTime, StartTime, StopTime);