コード例 #1
0
ファイル: ContentPage.xaml.cs プロジェクト: pusta/WinPiStats
        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
ファイル: MainPage.xaml.cs プロジェクト: pusta/WinPiStats
        private void Render_Menu()
        {
            mainNav.MenuItems.Add(new Microsoft.UI.Xaml.Controls.NavigationViewItemSeparator());
            var serverCount = new ServerCount();
            var numServers  = Convert.ToInt32(serverCount.NumberOfServers);
            var uriImage    = "ms-appx:///Assets/pilogo.png";
            var uri         = new Uri(uriImage);
            var piIcon      = new BitmapIcon();

            piIcon.UriSource = uri;

            for (var i = 1; i <= numServers; i++)
            {
                Microsoft.UI.Xaml.Controls.NavigationViewItem newMenu = new Microsoft.UI.Xaml.Controls.NavigationViewItem();
                var piholesettingsstore = new PiHoleSettingsStore(i.ToString());
                var piholeinfo          = piholesettingsstore.Retrive_Settings();
                newMenu.Content = piholeinfo.PiHoleServerName;
                newMenu.Tag     = i.ToString();
                newMenu.Icon    = piIcon;

                mainNav.MenuItems.Add(newMenu);
            }
        }
コード例 #4
0
ファイル: FirstRun.xaml.cs プロジェクト: pusta/WinPiStats
        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));
            }
        }