We are developing a cross platform app on a PCL, but for the time being we are only using android devices for testing.
Our concern is that its taking about 6 to 8 seconds (d
I found solution for this. For example we have 5 tabs. And we have 5 viewmodel or 5 codebehind. Every tabs viewmodels constructors we defined start timer method. And first tab constructor initialize 700ms after timer start. And second tab is starting 1 seconds after. Lets code for this:
First tab Home and home viewmodel is HomeViewModel.
public void HomeTimer()
{
timer.Interval = 700;
timer.Elapsed += (sender, e) => OnTimedEvent(sender, e);
timer.AutoReset = false;
timer.Enabled = true;
}
private void OnTimedEvent(object sender, ElapsedEventArgs e)
{
timer.Enabled = false;
Yap(); // yap command all the page listview and get api.
}
System.Timers.Timer timer = new System.Timers.Timer();
public HomeViewModel()
{
HomeTimer(); // hometimer starting
}
And second tab is MyPage and viewmodel is MyPageViewModel and constructor is the same:
public void MyPageTimer()
{
timer.Interval = 1000; //look. home page starting 0.7 seconds after and mypage starting 1 seconds after.
timer.Elapsed += (sender, e) => OnTimedEvent(sender, e);
timer.AutoReset = false;
timer.Enabled = true;
}
private void OnTimedEvent(object sender, ElapsedEventArgs e)
{
timer.Enabled = false;
GetMypage(); // and getmypage method all the initialize the page and listview and webapi works.
}
System.Timers.Timer timer = new System.Timers.Timer();
public MyPageViewModel()
{
MyPageTimer();
}
And this operation i delete 1 second from startup. Before this operation my app starting 3.2 second and now starting 2.2 second.