@@ -44,7 +44,7 @@ public MainForm()
4444 NetworkHelper . LoadAlterNativeSettings ( textBoxGw4 , textBoxGw6 , textBoxDns4 , textBoxDns6 , checkBoxGw4 , checkBoxGw6 , checkBoxDns4 , checkBoxDns6 ) ;
4545
4646 // Load native settings to UI
47- NetworkHelper . LoadNativeSettingsToUI ( textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 ) ;
47+ NetworkHelper . LoadNativeSettingsToUI ( textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 , checkBoxNativeGw4 , checkBoxNativeGw6 , checkBoxNativeDns4 , checkBoxNativeDns6 ) ;
4848
4949 // Initialize auto-refresh settings
5050 checkBoxAutoRefresh . Checked = Settings . Default . AutoRefreshEnabled ;
@@ -177,7 +177,7 @@ private void buttonSaveNative_Click(object sender, EventArgs e)
177177 {
178178 try
179179 {
180- NetworkHelper . SaveNativeSettingsFromUI ( textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 ) ;
180+ NetworkHelper . SaveNativeSettingsFromUI ( textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 , checkBoxNativeGw4 , checkBoxNativeGw6 , checkBoxNativeDns4 , checkBoxNativeDns6 ) ;
181181 MessageBox . Show ( "Native network settings saved successfully!" , "Settings Saved" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
182182 }
183183 catch ( Exception ex )
@@ -192,6 +192,13 @@ private void buttonLoadNative_Click(object sender, EventArgs e)
192192 {
193193 var currentInfo = NetworkHelper . GetCurrentNetworkInfo ( ) ;
194194 NetworkHelper . PopulateNetworkInfoTextBoxes ( currentInfo , textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 ) ;
195+
196+ // Enable checkboxes for valid network settings
197+ checkBoxNativeGw4 . Checked = currentInfo . Gateway4_enable ;
198+ checkBoxNativeGw6 . Checked = currentInfo . Gateway6_enable ;
199+ checkBoxNativeDns4 . Checked = currentInfo . Dns4_enable ;
200+ checkBoxNativeDns6 . Checked = currentInfo . Dns6_enable ;
201+
195202 MessageBox . Show ( "Current network settings loaded into Native settings!" , "Settings Loaded" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
196203 }
197204 catch ( Exception ex )
@@ -205,6 +212,8 @@ protected override void OnShown(EventArgs e)
205212 base . OnShown ( e ) ;
206213 // Update AlterNative settings display
207214 AlterCheckBoxes_ReEnable ( ) ;
215+ // Update Native settings display
216+ NativeCheckBoxes_ReEnable ( ) ;
208217 DisplayCurrentMode ( isSwitchedOn ) ;
209218 TrackBar_Set ( isSwitchedOn ) ;
210219
@@ -473,6 +482,7 @@ private void CheckBox_CheckedChanged(object sender, EventArgs e)
473482 if ( checkBox != null )
474483 {
475484 bool needSave = false ;
485+ bool needNativeSave = false ;
476486 switch ( checkBox . Name )
477487 {
478488 case "checkBoxGw4" :
@@ -484,6 +494,15 @@ private void CheckBox_CheckedChanged(object sender, EventArgs e)
484494 needSave = true ;
485495 break ;
486496 }
497+ case "checkBoxNativeGw4" :
498+ case "checkBoxNativeGw6" :
499+ case "checkBoxNativeDns4" :
500+ case "checkBoxNativeDns6" :
501+ {
502+ NativeCheckBoxes_ReEnable ( ) ;
503+ needNativeSave = true ;
504+ break ;
505+ }
487506 case "checkBoxAutoRefresh" :
488507 {
489508 if ( ! isLoadingSettings )
@@ -509,6 +528,10 @@ private void CheckBox_CheckedChanged(object sender, EventArgs e)
509528 {
510529 NetworkHelper . SaveAlterNativeSettings ( textBoxGw4 , textBoxGw6 , textBoxDns4 , textBoxDns6 , checkBoxGw4 , checkBoxGw6 , checkBoxDns4 , checkBoxDns6 ) ;
511530 }
531+ if ( needNativeSave )
532+ {
533+ NetworkHelper . SaveNativeSettingsFromUI ( textBoxNativeGw4 , textBoxNativeGw6 , textBoxNativeDns4 , textBoxNativeDns6 , checkBoxNativeGw4 , checkBoxNativeGw6 , checkBoxNativeDns4 , checkBoxNativeDns6 ) ;
534+ }
512535 }
513536 }
514537 }
@@ -545,6 +568,13 @@ private void AlterCheckBoxes_ReEnable()
545568 textBoxDns4 . Enabled = checkBoxDns4 . Checked ;
546569 textBoxDns6 . Enabled = checkBoxDns6 . Checked ;
547570 }
571+ private void NativeCheckBoxes_ReEnable ( )
572+ {
573+ textBoxNativeGw4 . Enabled = checkBoxNativeGw4 . Checked ;
574+ textBoxNativeGw6 . Enabled = checkBoxNativeGw6 . Checked ;
575+ textBoxNativeDns4 . Enabled = checkBoxNativeDns4 . Checked ;
576+ textBoxNativeDns6 . Enabled = checkBoxNativeDns6 . Checked ;
577+ }
548578 private void TrackBarToggle_ValueChanged ( object sender , EventArgs e )
549579 {
550580 if ( ! isLoadingSettings )
0 commit comments