Ejemplo n.º 1
0
 private void btnServerRun_Click(object sender, RoutedEventArgs e)
 {
     serverCounter++;
     try {
         if (serverCounter % 2 != 0)
         {
             server = new Server((int)Properties.Settings.Default["ServerPortSetting"], IPAddress.Parse((string)Properties.Settings.Default["ServerIPSetting"]));
             server.Start();
             server.ProcessConnection();
         }
         else
         {
             server.Stop();
         }
         CheckServerButton(server);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Coś poszło nie tak.");
     }
     try
     {
         ServerDataBase database = new ServerDataBase();
         database.DBPath = Properties.Settings.Default["DataBasePathSetting"].ToString();
         database.Name   = Properties.Settings.Default["DataBaseNameSetting"].ToString();
         if (!database.Exists)
         {
             database.GenerateServerDataBaseForFirstTime();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
Ejemplo n.º 2
0
 public UserRepository(ServerDataBase context)
 {
     this.context = context;
 }