protected override void OnClosed(EventArgs e) { _unsubscriber?.Dispose(); BrainDeviceManager.OnConnected -= OnReconnect; var cfglocal = ClientConfig.GetConfig(); cfglocal.Ip = IpTextBox.Text; cfglocal.Port = PortTextBox.Text.ToInt(); cfglocal.IsAutoStart = AutoStartCheckBox.IsChecked ?? cfglocal.IsAutoStart; ClientConfig.ChangeTimeout(EnableTimeoutCheckBox.IsChecked, TimeoutTextBox.Text); base.OnClosed(e); }