Example #1
0
 /// <summary>
 /// returns the string representation of the statistics.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     lock (this)
     {
         System.Text.StringBuilder ret = new System.Text.StringBuilder();
         ret.Append("Cluster[" + base.ToString() + ", Nm:" + GroupName + ", ");
         ret.Append("S:" + ServerCount.ToString() + ", ");
         ret.Append("M:" + MemberCount.ToString() + ", ");
         ret.Append("O:" + OtherCount.ToString() + ", ");
         if (_localNode != null)
         {
             ret.Append("Local" + _localNode.ToString());
         }
         foreach (NodeInfo i in _nodeInfos)
         {
             ret.Append(", " + i.ToString());
         }
         ret.Append("]");
         return(ret.ToString());
     }
 }
Example #2
0
        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);
            }
        }
Example #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));
            }
        }