async protected override void OnAppearing()
        {
            Console.WriteLine("Connected Client APPEARING");

            // Restore values.  Ensures config != null.
            if (!PersistenceSerializer.TryFetchConfig(out config))
            {
                config = new PiHoleConfig();
            }

            // Hide Radio Buttons if there is no backup server set
            if (config.BackupUri == "")
            {
                radioButtons.IsVisible = false;
            }
            else
            {
                radioButtons.IsVisible = true;
            }

            // Auto Refresh if we have a primary URL
            if ((isBackupSelected && config.BackupApiKey != "") || config.PrimaryApiKey != "")
            {
                await DoRefresh(showError : false);
            }
        }
        async protected override void OnAppearing()
        {
            base.OnAppearing();
            Console.WriteLine("DASHBOARD APPEARING!");

            // Restore values. Ensures config != null
            if (!PersistenceSerializer.TryFetchConfig(out config))
            {
                config = new PiHoleConfig();
            }

            DisplayRightCachedValue();

            // Refresh
            OnPropertyChanged(nameof(config));

            // Hide Radio Buttons if there is no backup server set
            if (config.BackupUri == "")
            {
                radioButtons.IsVisible = false;
            }
            else
            {
                radioButtons.IsVisible = true;
            }

            if ((isBackupSelected && config.BackupUri != "") || config.PrimaryUri != "")
            {
                await DoRefresh(showError : false);
            }
        }
Example #3
0
        async void Save_Clicked(object sender, EventArgs e)
        {
            // Validate
            if (UriBinding != "" && !UriBinding.ToLower().Contains("http"))
            {
                var txt = "Please specify a protocol (HTTP/HTTPS) in your URI!";
                await ErrorAlert(txt);

                return;
            }

            DisplayValues();

            // Save
            PersistenceSerializer.SerializeAndSaveConfig(config);

            // Pop this model.
            await Shell.Current.GoToAsync("///browse");
        }
Example #4
0
        protected override void OnAppearing()
        {
            Console.WriteLine("Settings APPEARING");

            // Restore values. Ensures non null.
            if (!PersistenceSerializer.TryFetchConfig(out config))
            {
                config = new PiHoleConfig();
            }

            // Hide Radio Buttons if there is no backup server set
            if (config.BackupUri == "")
            {
                radioButtons.IsVisible = false;
            }
            else
            {
                radioButtons.IsVisible = true;
            }
        }
Example #5
0
        public NewItemPage()
        {
            InitializeComponent();
            BindingContext = this;

            // Restore values
            if (!PersistenceSerializer.TryFetchConfig(out config))
            {
                config = new PiHoleConfig();
            }

            UriLabel.Text    = config.PrimaryUri;
            ApiKeyLabel.Text = config.PrimaryApiKey;

            // Refresh Button
            var refresh = new TapGestureRecognizer();

            refresh.Tapped += async(s, e) => await Github_Clicked();

            github.GestureRecognizers.Add(refresh);
        }