22using Flow . Launcher . Plugin . BrowserBookmark . Models ;
33using System . Windows . Input ;
44using System . ComponentModel ;
5- using System . Windows . Controls ;
5+ using System . Threading . Tasks ;
66
77namespace Flow . Launcher . Plugin . BrowserBookmark . Views
88{
99 public partial class SettingsControl : INotifyPropertyChanged
1010 {
1111 public Settings Settings { get ; }
12-
12+
1313 public CustomBrowser SelectedCustomBrowser { get ; set ; }
14-
14+
15+ public bool LoadChromeBookmark
16+ {
17+ get => Settings . LoadChromeBookmark ;
18+ set
19+ {
20+ Settings . LoadChromeBookmark = value ;
21+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
22+ }
23+ }
24+
25+ public bool LoadFirefoxBookmark
26+ {
27+ get => Settings . LoadFirefoxBookmark ;
28+ set
29+ {
30+ Settings . LoadFirefoxBookmark = value ;
31+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
32+ }
33+ }
34+
35+ public bool LoadEdgeBookmark
36+ {
37+ get => Settings . LoadEdgeBookmark ;
38+ set
39+ {
40+ Settings . LoadEdgeBookmark = value ;
41+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
42+ }
43+ }
44+
1545 public bool OpenInNewBrowserWindow
1646 {
1747 get => Settings . OpenInNewBrowserWindow ;
@@ -42,6 +72,7 @@ private void NewCustomBrowser(object sender, RoutedEventArgs e)
4272 } )
4373 {
4474 Settings . CustomChromiumBrowsers . Add ( newBrowser ) ;
75+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
4576 }
4677 }
4778
@@ -50,16 +81,15 @@ private void DeleteCustomBrowser(object sender, RoutedEventArgs e)
5081 if ( CustomBrowsers . SelectedItem is CustomBrowser selectedCustomBrowser )
5182 {
5283 Settings . CustomChromiumBrowsers . Remove ( selectedCustomBrowser ) ;
84+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
5385 }
5486 }
87+
5588 private void MouseDoubleClickOnSelectedCustomBrowser ( object sender , MouseButtonEventArgs e )
5689 {
57- if ( SelectedCustomBrowser is null )
58- return ;
59-
60- var window = new CustomBrowserSettingWindow ( SelectedCustomBrowser ) ;
61- window . ShowDialog ( ) ;
90+ EditSelectedCustomBrowser ( ) ;
6291 }
92+
6393 private void Others_Click ( object sender , RoutedEventArgs e )
6494 {
6595
@@ -72,12 +102,21 @@ private void Others_Click(object sender, RoutedEventArgs e)
72102 }
73103
74104 private void EditCustomBrowser ( object sender , RoutedEventArgs e )
105+ {
106+ EditSelectedCustomBrowser ( ) ;
107+ }
108+
109+ private void EditSelectedCustomBrowser ( )
75110 {
76111 if ( SelectedCustomBrowser is null )
77112 return ;
78113
79114 var window = new CustomBrowserSettingWindow ( SelectedCustomBrowser ) ;
80- window . ShowDialog ( ) ;
115+ var result = window . ShowDialog ( ) ?? false ;
116+ if ( result )
117+ {
118+ _ = Task . Run ( ( ) => Main . ReloadAllBookmarks ( ) ) ;
119+ }
81120 }
82121 }
83122}
0 commit comments