B Oprit

B Oprit

  • 1.3k
  • 429
  • 4k

Show document depending on month of the year

Nov 18 2019 7:55 AM
Hello ,
 
I am new at Xamarin Forms and this is what i am trying to do.
 
Based on the month i want to show a document from Google docs in a Webview
 
I know how to show the document but not the if statement.
 
Trying to put a label with the month showing in a stacklayout with the webview , so far so good.
 
The label is showing 11
 
But how do i make it work that when the month is changing it is going to another document.
 
This month is
 
Webview.Source = "https://docs.google.com/spreadsheets/d/1h2wQMlPpvnajq_Dg-Yx6Gwh4wzy7ZPd3Kp5gnDnEszY/edit?usp=sharing";
 
and this for December
https://docs.google.com/spreadsheets/d/1BEryoKhaTP6tx2VsYibYXE5kJoEBKqGFNrhov1W_b7s/edit?usp=sharing
 
The mainpage
 
Text="{Binding Source={x:Static sys:DateTime.Now}, StringFormat='{0:MM}'}" />
HorizontalOptions="FillAndExpand"
x:Name="progress"
ProgressColor="Maroon"
IsVisible="True"/>
HeightRequest="1000"
WidthRequest="1000"
Navigating="OnNavigating"
Navigated="OnNavigated"
VerticalOptions="FillAndExpand"/>
 
And the Main.xaml.cs
  1. public partial class MainPage : ContentPage  
  2. {  
  3. public MainPage()  
  4. {  
  5. InitializeComponent();  
  6. Webview.Source = "https://docs.google.com/spreadsheets/d/1h2wQMlPpvnajq_Dg-Yx6Gwh4wzy7ZPd3Kp5gnDnEszY/edit?usp=sharing";  
  7. }  
  8. protected async override void OnAppearing()  
  9. {  
  10. base.OnAppearing();  
  11. await progress.ProgressTo(0.9, 900, Easing.SpringIn);  
  12. }  
  13. protected void OnNavigating(object sender, WebNavigatingEventArgs e)  
  14. {  
  15. // SfBusyIndicator busyIndicator = new SfBusyIndicator();  
  16. progress.IsVisible = true;  
  17. // busyindicator.IsVisible = true;  
  18. }  
  19. protected void OnNavigated(object sender, WebNavigatedEventArgs e)  
  20. {  
  21. // SfBusyIndicator busyIndicator = new SfBusyIndicator();  
  22. progress.IsVisible = false;  
  23. // busyindicator.IsVisible = false;  
  24. }  
  25. }  
  26. }  

Answers (5)