@@ -456,11 +456,23 @@ INT_PTR ApplicationsPropertySheetPage::dialogProc(
456
456
break ;
457
457
case WM_COMMAND:
458
458
switch (LOWORD (wparam)) {
459
+ case 1200 : // _enableRouting
460
+ _config.enableApplicationRouting =
461
+ Button_GetCheck (_enableRouting) == BST_CHECKED;
462
+ refreshControls ();
463
+ changed ();
464
+ break ;
459
465
case 1203 : // _addButton
460
466
if (HIWORD (wparam) == BN_CLICKED) {
461
467
onAddApplication ();
462
468
}
463
469
470
+ break ;
471
+ case 1204 : // _removeButton
472
+ if (HIWORD (wparam) == BN_CLICKED) {
473
+ onRemoveApplication ();
474
+ }
475
+
464
476
break ;
465
477
}
466
478
@@ -503,10 +515,16 @@ void ApplicationsPropertySheetPage::initControls()
503
515
ListView_InsertColumn (_listView, 2 , &col);
504
516
ListView_SetExtendedListViewStyle (_listView, LVS_EX_FULLROWSELECT);
505
517
506
- refreshApplicationList ();
518
+ refreshControls ();
507
519
updateEnabled ();
508
520
}
509
521
522
+ void ApplicationsPropertySheetPage::refreshControls ()
523
+ {
524
+ Button_SetCheck (_enableRouting, _config.enableApplicationRouting );
525
+ refreshApplicationList ();
526
+ }
527
+
510
528
void ApplicationsPropertySheetPage::refreshApplicationList ()
511
529
{
512
530
ListView_DeleteAllItems (_listView);
@@ -536,15 +554,18 @@ void ApplicationsPropertySheetPage::refreshApplicationList()
536
554
537
555
void ApplicationsPropertySheetPage::updateEnabled ()
538
556
{
557
+ EnableWindow (_listView, _config.enableApplicationRouting );
558
+ Button_Enable (_addButton, _config.enableApplicationRouting );
539
559
Button_Enable (_removeButton,
560
+ _config.enableApplicationRouting &&
540
561
ListView_GetSelectedCount (_listView) > 0 );
541
562
}
542
563
543
564
void ApplicationsPropertySheetPage::onOpenApplication ()
544
565
{
545
566
auto index = ListView_GetNextItem (_listView, -1 , LVNI_SELECTED);
546
567
547
- if (index < 0 || index >= _config.applications .size ()) {
568
+ if (index < 0 || index >= ( int ) _config.applications .size ()) {
548
569
return ;
549
570
}
550
571
@@ -558,6 +579,20 @@ void ApplicationsPropertySheetPage::onOpenApplication()
558
579
}
559
580
}
560
581
582
+ void ApplicationsPropertySheetPage::onRemoveApplication ()
583
+ {
584
+ auto index = ListView_GetNextItem (_listView, -1 , LVNI_SELECTED);
585
+
586
+ if (index < 0 || index >= (int )_config.endpoints .size ()) {
587
+ return ;
588
+ }
589
+
590
+ _config.applications .erase (_config.applications .begin () + index );
591
+ refreshApplicationList ();
592
+ updateEnabled ();
593
+ changed ();
594
+ }
595
+
561
596
void ApplicationsPropertySheetPage::onAddApplication ()
562
597
{
563
598
ApplicationConfigDialog dlg (_config, ApplicationConfig ());
0 commit comments