示例#1
0
        /// <summary>
        /// Initialisation with os dependent parameter inputs. Start listening for a login return
        /// </summary>
        /// <param name="databaseLocation"></param>
        /// <param name="tileLocation"></param>
        public App(string databaseLocation, string tileLocation)
        {
            InitializeComponent();
            Device.SetFlags(new string[] { "RadioButton_Experimental", "Shapes_Experimental", "Expander_Experimental" });

            RecordLists = new RecordListModel();
            CurrentUser = User.RetrieveUser();
            BioDivPrefs = new BioDivPreferences();
            Preferences.Set("databaseLocation", databaseLocation);
            TileLocation     = tileLocation;
            CurrentProjectId = Preferences.Get("currentProject", "");
            RecordLists.CreateRecordLists();
            Busy = false;
            CheckConnection();

            VersionTracking.Track();

            MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "LoginSuccessful", (sender) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    BioDivCollectorXamarin.Models.LoginModel.Login.GetUserDetails();

                    MainPage = new AppShell();
                    if (CurrentRoute != null && CurrentRoute != String.Empty)
                    {
                        try { AppShell.Current.GoToAsync(CurrentRoute); }
                        catch (Exception e)
                        {
                            Console.WriteLine("Didn't manage to go to route, " + e);
                        }
                    }
                });
            });

            MessagingCenter.Subscribe <Xamarin.Forms.Application>(Xamarin.Forms.Application.Current, "LoginUnsuccessful", (sender) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    MainPage = Login.GetPageToView();
                });
            });
        }
示例#2
0
 public void Setup()
 {
     BioDivPrefs = new BioDivPreferences();
     CreateProject();
 }