private void button1_Click(object sender, RoutedEventArgs e)
        {
            ServerInfo info = new ServerInfo();

            try
            {
                info.Host = "localhost";
                info.File = txtFile.Text;
                info.Port = Convert.ToInt32(txtPort.Text);
                info.User = txtUser.Text;
                if (txtPass.Password == "")
                {
                    info.Pass = "******";
                }
                else
                {
                    info.Pass = txtPass.Password;
                }
                info.createServerInfoXML();
                MessageBox.Show("Just created a new ServerInfo.xml settings file");
                HomePage home = new HomePage();
                this.NavigationService.Navigate(home);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);

            }
        }
        public void StartServert()
        {
            System.Threading.Thread.Sleep(10000);

            ServerInfo info = new ServerInfo();

                try
                {
                    string filepath =
                        Path.GetDirectoryName(
                     Assembly.GetAssembly(typeof(Scrambler)).CodeBase)
                         + "\\" + info.File;

                    string test = filepath.Remove(0,6);

                    IServerConfiguration config = Db4oClientServer.NewServerConfiguration();
                    IObjectServer db4oServer = Db4oClientServer.OpenServer(config, test, info.Port);
                    db4oServer.GrantAccess(info.User, info.Pass);
                    EventLog.WriteEntry("Db4o", "Starting the Db4o server with this file:" + filepath, EventLogEntryType.Information);

                }
                catch (Exception ex)
                {
                    EventLog.WriteEntry("Db4o", "Failed to start the Db4o server." + info.File + ". Reason: " + ex.Message, EventLogEntryType.Error);
                    this.Stop();
                }
        }
 public ConfigPage()
 {
     InitializeComponent();
     ServerInfo info = new ServerInfo();
     txtFile.Text = info.File;
     txtPort.Text = info.Port.ToString();
     txtUser.Text = info.User;
     txtPass.Password = info.Pass;
 }
        public StatusPage()
        {
            InitializeComponent();

            try
            {
                ServerInfo info = new ServerInfo();
                string status;

                status = "Configuation: \r\n";
                status = status + "\r\n";
                status = status + "Host: " + info.Host + "\r\n";
                status = status + "With file: " + info.File + "\r\n";
                status = status + "On port: " + info.Port.ToString() + "\r\n";
                status = status + "With user: "******"\r\n";

                status = status + "\r\n";
                status = status + "\r\n";

                ServiceController byServiceName = new ServiceController();
                byServiceName.ServiceName = "Db4o";

                if (byServiceName.Status == ServiceControllerStatus.Running)
                    status = status + "The service is currently running.";

                if (byServiceName.Status == ServiceControllerStatus.Stopped)
                    status = status + "The service is currently stopped.";

                if (byServiceName.Status == ServiceControllerStatus.StopPending)
                    status = status + "The service is currently pending to stop.";

                textStatus.Text = status;
            } catch (Exception ex) {

                textStatus.Text = ex.Message;
            }
        }