예제 #1
0
        private void Page_Loading(FrameworkElement sender, object args)
        {
            piholesettingsstore = new PiHoleSettingsStore(piholeServerNumber);
            piholeserverinfo    = piholesettingsstore.Retrive_Settings();
            UpdatePiInfo();

            PiholeStateCheck();
        }
예제 #2
0
 public NavViewModel()
 {
     for (var i = 1; i <= Convert.ToInt32(new ServerCount().NumberOfServers); i++)
     {
         var piholesettingsstore = new PiHoleSettingsStore(i.ToString());
         var piholeserverinfo    = new PiHoleServerInfo();
         piholeserverinfo = piholesettingsstore.Retrive_Settings();
         this.serverlist.Add(new PiHoleServerInfo()
         {
             PiHoleServerName = piholeserverinfo.PiHoleServerName, PiHoleServerAddress = piholeserverinfo.PiHoleServerAddress, PiHoleServerAuthKey = piholeserverinfo.PiHoleServerAuthKey
         });
     }
 }
예제 #3
0
        private void saveSettings_Click(object sender, RoutedEventArgs e)
        {
            errorTextBlock.Visibility = Visibility.Collapsed;

            if (String.IsNullOrWhiteSpace(serverNameTextBox.Text) || String.IsNullOrWhiteSpace(serverIPTextBox.Text) || String.IsNullOrWhiteSpace(apiKeyTextBox.Text))
            {
                errorTextBlock.Text = "All fields above are required.";

                errorTextBlock.Visibility = Visibility.Visible;
            }

            else
            {
                var piholesettings = new PiHoleSettingsStore("1");
                var piholeinfo     = new PiHoleServerInfo();
                var servercount    = new ServerCount();
                var firstrun       = new AppFirstRun();
                piholeinfo.PiHoleServerName    = serverNameTextBox.Text;
                piholeinfo.PiHoleServerAuthKey = apiKeyTextBox.Text;
                piholeinfo.PiHoleServerAddress = serverIPTextBox.Text;

                piholesettings.Save_Settings(piholeinfo);
                servercount.Increase_Servers();
                firstrun.FirstRun = false;


                // var settingsStore = new SettingsStore("1");

                // settingsStore.Store_Settings(serverNameTextBox.Text, apiKeyTextBox.Text, serverIPTextBox.Text);


                //settingsStore.First_Run(false);

                this.Frame.Navigate(typeof(MainPage.MainPage));
            }
        }