Ejemplo n.º 1
0
        /// <summary>
        /// Raises MirametrixSettingDialog to change the settings
        /// for this interface.
        /// </summary>
        public override void ChangeSettings()
        {
            var dlg = new MirametrixSettingsDialog {
                MirametrixSetting = this.memSettings
            };
            string prevAdd  = this.memSettings.ServerAddress;
            int    prevPort = this.memSettings.ServerPort;

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                // If settings has changed, and we where connected, we need to disconnect
                if (!prevAdd.Equals(this.memSettings.ServerAddress) ||
                    !prevPort.Equals(this.memSettings.ServerPort))
                {
                    this.CleanUp();
                    this.memNetworkManager.ChangePort(this.memConnectionsIds[0], dlg.MirametrixSetting.ServerPort);
                    this.memNetworkManager.ChangeAddress(this.memConnectionsIds[0], dlg.MirametrixSetting.ServerAddress);
                }

                this.memSettings = dlg.MirametrixSetting;
                this.SerializeSettings(this.Settings, this.SettingsFile);
            }
        }
Ejemplo n.º 2
0
    /// <summary>
    /// Raises MirametrixSettingDialog to change the settings
    /// for this interface.
    /// </summary>
    public override void ChangeSettings()
    {
      var dlg = new MirametrixSettingsDialog { MirametrixSetting = this.memSettings };
      string prevAdd = this.memSettings.ServerAddress;
      int prevPort = this.memSettings.ServerPort;
      if (dlg.ShowDialog() == DialogResult.OK)
      {
        // If settings has changed, and we where connected, we need to disconnect
        if (!prevAdd.Equals(this.memSettings.ServerAddress) ||
            !prevPort.Equals(this.memSettings.ServerPort))
        {
          this.CleanUp();
          this.memNetworkManager.ChangePort(this.memConnectionsIds[0], dlg.MirametrixSetting.ServerPort);
          this.memNetworkManager.ChangeAddress(this.memConnectionsIds[0], dlg.MirametrixSetting.ServerAddress);
        }

        this.memSettings = dlg.MirametrixSetting;
        this.SerializeSettings(this.Settings, this.SettingsFile);
      }
    }