Add open pluign directory link in plugin setting page.

This commit is contained in:
qianlifeng 2014-07-14 23:18:57 +08:00
parent 15e27e7e1d
commit e7f000147b
2 changed files with 32 additions and 8 deletions

View File

@ -117,12 +117,13 @@
<TextBlock Opacity="0.5" VerticalAlignment="Bottom" HorizontalAlignment="Right" x:Name="pluginAuthor" Text="Author"></TextBlock> <TextBlock Opacity="0.5" VerticalAlignment="Bottom" HorizontalAlignment="Right" x:Name="pluginAuthor" Text="Author"></TextBlock>
</DockPanel> </DockPanel>
<TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5" ToolTip="{Binding Source=pluginSubTitle, Path=Text}" Visibility="{Binding Source=pluginSubTitle, Path=Text, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" ></TextBlock> <TextBlock Grid.Row="1" x:Name="pluginSubTitle" Opacity="0.5" ToolTip="{Binding Source=pluginSubTitle, Path=Text}" Visibility="{Binding Source=pluginSubTitle, Path=Text, Converter={converters:StringNullOrEmptyToVisibilityConverter}}" ></TextBlock>
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 8 0 0"> <DockPanel Grid.Row="2" Margin="0 8 0 0">
<CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick"></CheckBox> <CheckBox x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick"></CheckBox>
<TextBlock x:Name="pluginDisableTitle" Margin="5 -2 0 0">Disable</TextBlock> <TextBlock x:Name="pluginDisableTitle" Margin="5 -2 0 0">Disable</TextBlock>
<TextBlock x:Name="pluginActionKeywordTitle" Margin="50 -2 0 0">ActionKeyword:</TextBlock> <TextBlock x:Name="pluginActionKeywordTitle" Margin="50 -2 0 0">ActionKeyword:</TextBlock>
<TextBlock Margin="5 -2 0 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeyword_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeyword"></TextBlock> <TextBlock Margin="5 -2 0 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeyword_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeyword"></TextBlock>
</StackPanel> <TextBlock HorizontalAlignment="Right" Cursor="Hand" MouseUp="tbOpenPluginDirecoty_MouseUp" Foreground="Blue" Text="Plugin Directory" x:Name="tbOpenPluginDirecoty"></TextBlock>
</DockPanel>
</Grid> </Grid>
</Grid> </Grid>
</ContentControl> </ContentControl>

View File

@ -321,7 +321,7 @@ namespace Wox
private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e) private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
if (!settingsLoaded) return; if (!settingsLoaded) return;
FamilyTypeface typeface = (FamilyTypeface) cbQueryBoxFontFaces.SelectedItem; FamilyTypeface typeface = (FamilyTypeface)cbQueryBoxFontFaces.SelectedItem;
if (typeface == null) if (typeface == null)
{ {
if (cbQueryBoxFontFaces.Items.Count > 0) if (cbQueryBoxFontFaces.Items.Count > 0)
@ -387,7 +387,7 @@ namespace Wox
private void CbOpacityMode_OnSelectionChanged(object sender, SelectionChangedEventArgs e) private void CbOpacityMode_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{ {
UserSettingStorage.Instance.OpacityMode = (OpacityMode) CbOpacityMode.SelectedItem; UserSettingStorage.Instance.OpacityMode = (OpacityMode)CbOpacityMode.SelectedItem;
UserSettingStorage.Instance.Save(); UserSettingStorage.Instance.Save();
slOpacity.IsEnabled = UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow; slOpacity.IsEnabled = UserSettingStorage.Instance.OpacityMode == OpacityMode.LayeredWindow;
@ -411,6 +411,7 @@ namespace Wox
pluginAuthor.Visibility = Visibility.Visible; pluginAuthor.Visibility = Visibility.Visible;
pluginActionKeyword.Visibility = Visibility.Visible; pluginActionKeyword.Visibility = Visibility.Visible;
pluginActionKeywordTitle.Visibility = Visibility.Visible; pluginActionKeywordTitle.Visibility = Visibility.Visible;
tbOpenPluginDirecoty.Visibility = Visibility.Visible;
pluginTitle.Text = pair.Metadata.Name; pluginTitle.Text = pair.Metadata.Name;
pluginTitle.Cursor = Cursors.Hand; pluginTitle.Cursor = Cursors.Hand;
pluginActionKeyword.Text = pair.Metadata.ActionKeyword; pluginActionKeyword.Text = pair.Metadata.ActionKeyword;
@ -439,15 +440,16 @@ namespace Wox
pluginSubTitle.Text = sys.Description; pluginSubTitle.Text = sys.Description;
pluginAuthor.Visibility = Visibility.Collapsed; pluginAuthor.Visibility = Visibility.Collapsed;
pluginActionKeyword.Visibility = Visibility.Collapsed; pluginActionKeyword.Visibility = Visibility.Collapsed;
tbOpenPluginDirecoty.Visibility = Visibility.Collapsed;
pluginActionKeywordTitle.Visibility = Visibility.Collapsed; pluginActionKeywordTitle.Visibility = Visibility.Collapsed;
pluginTitle.Cursor = Cursors.Arrow; pluginTitle.Cursor = Cursors.Arrow;
SyntaxSugars.CallOrRescueDefault( SyntaxSugars.CallOrRescueDefault(
() => () =>
pluginIcon.Source = (ImageSource) new ImagePathConverter().Convert( new object[] pluginIcon.Source = (ImageSource)new ImagePathConverter().Convert(new object[]
{ {
sys.IcoPath, sys.IcoPath,
sys.PluginDirectory sys.PluginDirectory
}, null, null,null)); }, null, null, null));
} }
} }
@ -532,7 +534,7 @@ namespace Wox
private void PluginTitle_OnMouseUp(object sender, MouseButtonEventArgs e) private void PluginTitle_OnMouseUp(object sender, MouseButtonEventArgs e)
{ {
if (e.ChangedButton == MouseButton.Left) if (e.ChangedButton == MouseButton.Left)
{ {
var pair = lbPlugins.SelectedItem as PluginPair; var pair = lbPlugins.SelectedItem as PluginPair;
if (pair != null) if (pair != null)
@ -550,5 +552,26 @@ namespace Wox
} }
} }
} }
private void tbOpenPluginDirecoty_MouseUp(object sender, MouseButtonEventArgs e)
{
if (e.ChangedButton == MouseButton.Left)
{
var pair = lbPlugins.SelectedItem as PluginPair;
if (pair != null)
{
//third-party plugin
if (!string.IsNullOrEmpty(pair.Metadata.Website))
{
try
{
Process.Start(pair.Metadata.PluginDirecotry);
}
catch
{ }
}
}
}
}
} }
} }