diff --git a/Wox.Infrastructure/StringEmptyConverter.cs b/Wox.Infrastructure/StringEmptyConverter.cs
new file mode 100644
index 0000000000..f553695737
--- /dev/null
+++ b/Wox.Infrastructure/StringEmptyConverter.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Wox.Infrastructure
+{
+ public class StringEmptyConverter : MarkupExtension, IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ return string.IsNullOrEmpty((string)value) ? parameter : value;
+ }
+
+ public object ConvertBack(
+ object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotSupportedException();
+ }
+
+
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+ }
+}
diff --git a/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs b/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs
new file mode 100644
index 0000000000..841b446a51
--- /dev/null
+++ b/Wox.Infrastructure/StringNullOrEmptyToVisibilityConverter.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Globalization;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Wox.Infrastructure
+{
+ public class StringNullOrEmptyToVisibilityConverter : MarkupExtension, IValueConverter
+ {
+ public override object ProvideValue(IServiceProvider serviceProvider)
+ {
+ return this;
+ }
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return string.IsNullOrEmpty(value as string) ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Wox.Infrastructure/Wox.Infrastructure.csproj b/Wox.Infrastructure/Wox.Infrastructure.csproj
index 435388f399..33d9868d26 100644
--- a/Wox.Infrastructure/Wox.Infrastructure.csproj
+++ b/Wox.Infrastructure/Wox.Infrastructure.csproj
@@ -37,6 +37,7 @@
..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll
+
@@ -60,6 +61,8 @@
+
+
diff --git a/Wox.Plugin.System/ProgramSetting.xaml b/Wox.Plugin.System/ProgramSetting.xaml
new file mode 100644
index 0000000000..ffb082efa3
--- /dev/null
+++ b/Wox.Plugin.System/ProgramSetting.xaml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Wox.Plugin.System/ProgramSetting.xaml.cs b/Wox.Plugin.System/ProgramSetting.xaml.cs
new file mode 100644
index 0000000000..1f3c51f731
--- /dev/null
+++ b/Wox.Plugin.System/ProgramSetting.xaml.cs
@@ -0,0 +1,78 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Wox.Infrastructure.Storage.UserSettings;
+
+namespace Wox.Plugin.System
+{
+ ///
+ /// Interaction logic for ProgramSetting.xaml
+ ///
+ public partial class ProgramSetting : UserControl
+ {
+ public ProgramSetting()
+ {
+ InitializeComponent();
+ Loaded += Setting_Loaded;
+ }
+
+ private void Setting_Loaded(object sender, RoutedEventArgs e)
+ {
+ programSourceView.ItemsSource = UserSettingStorage.Instance.ProgramSources;
+ }
+
+ public void ReloadProgramSourceView()
+ {
+ programSourceView.Items.Refresh();
+ }
+
+
+ private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
+ {
+ ProgramSourceSetting programSource = new ProgramSourceSetting(this);
+ programSource.ShowDialog();
+ }
+
+ private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
+ {
+ ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
+ if (seletedProgramSource != null &&
+ MessageBox.Show("Are your sure to delete " + seletedProgramSource.ToString(), "Delete ProgramSource",
+ MessageBoxButton.YesNo) == MessageBoxResult.Yes)
+ {
+ UserSettingStorage.Instance.ProgramSources.Remove(seletedProgramSource);
+ programSourceView.Items.Refresh();
+ }
+ else
+ {
+ MessageBox.Show("Please select a program source");
+ }
+ }
+
+ private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
+ {
+ ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
+ if (seletedProgramSource != null)
+ {
+ ProgramSourceSetting programSource = new ProgramSourceSetting(this);
+ programSource.UpdateItem(seletedProgramSource);
+ programSource.ShowDialog();
+ }
+ else
+ {
+ MessageBox.Show("Please select a program source");
+ }
+ }
+
+ }
+}
diff --git a/Wox/ProgramSourceSetting.xaml b/Wox.Plugin.System/ProgramSourceSetting.xaml
similarity index 97%
rename from Wox/ProgramSourceSetting.xaml
rename to Wox.Plugin.System/ProgramSourceSetting.xaml
index 114e54a092..3d41c837ac 100644
--- a/Wox/ProgramSourceSetting.xaml
+++ b/Wox.Plugin.System/ProgramSourceSetting.xaml
@@ -1,4 +1,4 @@
- 0 && (attrs[0] as System.ComponentModel.BrowsableAttribute).Browsable == false)
+ var attrs = type.GetCustomAttributes(typeof(BrowsableAttribute), false);
+ if (attrs.Length > 0 && (attrs[0] as BrowsableAttribute).Browsable == false)
{
this.tbLocation.IsEnabled = false;
return;
diff --git a/Wox.Plugin.System/Wox.Plugin.System.csproj b/Wox.Plugin.System/Wox.Plugin.System.csproj
index 0554e5f733..b2600d2b89 100644
--- a/Wox.Plugin.System/Wox.Plugin.System.csproj
+++ b/Wox.Plugin.System/Wox.Plugin.System.csproj
@@ -38,6 +38,9 @@
..\packages\Newtonsoft.Json.5.0.8\lib\net35\Newtonsoft.Json.dll
+
+
+
..\packages\YAMP.1.3.0\lib\net35\YAMP.dll
@@ -52,6 +55,12 @@
+
+ ProgramSetting.xaml
+
+
+ ProgramSourceSetting.xaml
+
@@ -85,6 +94,16 @@
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml
index 1958140505..d256edebd1 100644
--- a/Wox/SettingWindow.xaml
+++ b/Wox/SettingWindow.xaml
@@ -76,56 +76,7 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs
index 6d044071ac..97cf015c38 100644
--- a/Wox/SettingWindow.xaml.cs
+++ b/Wox/SettingWindow.xaml.cs
@@ -153,7 +153,6 @@ namespace Wox
themeComboBox.SelectedItem = UserSettingStorage.Instance.Theme;
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
webSearchView.ItemsSource = UserSettingStorage.Instance.WebSearches;
- programSourceView.ItemsSource = UserSettingStorage.Instance.ProgramSources;
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins;
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
@@ -202,10 +201,6 @@ namespace Wox
webSearchView.Items.Refresh();
}
- public void ReloadProgramSourceView()
- {
- programSourceView.Items.Refresh();
- }
private List LoadAvailableThemes()
{
@@ -252,43 +247,6 @@ namespace Wox
}
}
- private void btnAddProgramSource_OnClick(object sender, RoutedEventArgs e)
- {
- ProgramSourceSetting programSource = new ProgramSourceSetting(this);
- programSource.ShowDialog();
- }
-
- private void btnDeleteProgramSource_OnClick(object sender, RoutedEventArgs e)
- {
- ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
- if (seletedProgramSource != null &&
- MessageBox.Show("Are your sure to delete " + seletedProgramSource.ToString(), "Delete ProgramSource",
- MessageBoxButton.YesNo) == MessageBoxResult.Yes)
- {
- UserSettingStorage.Instance.ProgramSources.Remove(seletedProgramSource);
- programSourceView.Items.Refresh();
- }
- else
- {
- MessageBox.Show("Please select a program source");
- }
- }
-
- private void btnEditProgramSource_OnClick(object sender, RoutedEventArgs e)
- {
- ProgramSource seletedProgramSource = programSourceView.SelectedItem as ProgramSource;
- if (seletedProgramSource != null)
- {
- ProgramSourceSetting programSource = new ProgramSourceSetting(this);
- programSource.UpdateItem(seletedProgramSource);
- programSource.ShowDialog();
- }
- else
- {
- MessageBox.Show("Please select a program source");
- }
- }
-
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
{
CreateStartupFolderShortcut();
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index 8d3192af5e..4e41cee63c 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -120,9 +120,6 @@
-
- ProgramSourceSetting.xaml
-
CustomPluginHotkeySetting.xaml
@@ -160,10 +157,6 @@
Designer
MSBuild:Compile
-
- MSBuild:Compile
- Designer
-
Designer
MSBuild:Compile