wanted to know if there is a method like Unity's void Update(). This
is so I can update UI elements, not just on an event like a button
press.
There are lots of ways you can update UI. You can update UI at the lifecycle methods of Page
such as page.onappearing and page.ondisappearing, or at the lifecycle methods of App and etc. Tell us your requirement and we can give you more specific information.
Also I would like to change the value of a variable after a specific
time
You can use a Timer in Xamarin.forms:
Device.StartTimer (new TimeSpan (0, 0, 60), () =>
{
// do something every 60 seconds
Device.BeginInvokeOnMainThread (() =>
{
// interact with UI elements
});
return true; // runs again, or false to stop
});
do you guys have a list of topics I should know as a beginner Xamarin
Forms developer.do you guys have a list of topics I should know as a
beginner Xamarin Forms developer.
Here is the document about Xamarin.forms
and you can read section by section to learn Xamarin
.
Update, response to this video:
public MainPage()
{
InitializeComponent();
//If you don't want to trigger the event by click button, you can call the method here
//the method will be called after the page's initialization
TimerButton_Clicked(this,new EventArgs());
}
protected override void OnAppearing()
{
base.OnAppearing();
//also you can call it here
//the method will be called after the page appeared
//TimerButton_Clicked(this, new EventArgs());
}
private void TimerButton_Clicked(object sender, EventArgs e)
{
//use this variable to count the second
int time = 0;
Device.StartTimer(new TimeSpan(0, 0, 0,0,200), () =>
{
time += 200;
// do something every 200 milliseconds
Device.BeginInvokeOnMainThread(() =>
{
// interact with UI elements
TimerLabel.Text = time.ToString() + "milliseconds";
});
if (time >= 3000)
{
return false;
}
return true; // runs again, or false to stop
});
}
}
The best way to achieve your requirement is use a Timer, I wrote a sample project for you and you can check it here.