Ejemplo n.º 1
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     dialog.RestoreDirectory = true;
     dialog.Filter = "Server Details (*.xml)|*.xml";
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         if (shard != null)
         {
             shard.Stop();
             shard.LogOccurred -= new LogEventHandler(shard_LogOccurred);
         }
         shard = new ServerShard();
         shard.LogOccurred += new LogEventHandler(shard_LogOccurred);
         shard.LoadFromSettings(dialog.FileName);
         shard.Start();
     }
 }
Ejemplo n.º 2
0
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ServerTypeForm form = new ServerTypeForm();
     form.PortNumber = 1331;
     if (form.ShowDialog() == DialogResult.OK)
     {
         SaveFileDialog dialog = new SaveFileDialog();
         dialog.RestoreDirectory = true;
         dialog.Filter = "Server Details (*.xml)|*.xml";
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             if (shard != null)
             {
                 shard.Stop();
                 shard.LogOccurred -= new LogEventHandler(shard_LogOccurred);
             }
             shard = new ServerShard();
             shard.LogOccurred += new LogEventHandler(shard_LogOccurred);
             shard.PortNumber = form.PortNumber;
             shard.StorageFile = dialog.FileName;
             shard.Start();
         }
     }
 }