Some plugin style changes.

This commit is contained in:
qianlifeng 2014-07-04 15:12:22 +08:00
parent 95613a1881
commit 0c75cf6055
2 changed files with 286 additions and 266 deletions

View File

@ -118,21 +118,18 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition> <RowDefinition></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock x:Name="pluginTitle" ToolTip="{Binding Source=pluginTitle, Path=Text}" FontSize="24"></TextBlock> <DockPanel Grid.Row="0">
<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 x:Name="pluginTitle" Text="Plugin Title" Cursor="Hand" MouseUp="PluginTitle_OnMouseUp" ToolTip="{Binding Source=pluginTitle, Path=Text}" FontSize="24"></TextBlock>
<StackPanel Grid.Row="2" Orientation="Horizontal"> <TextBlock Opacity="0.5" VerticalAlignment="Bottom" HorizontalAlignment="Right" x:Name="pluginAuthor" Text="Author"></TextBlock>
<TextBlock>ActionKeyword: </TextBlock>
<TextBlock Cursor="Hand" MouseUp="PluginActionKeyword_OnMouseUp" Foreground="Blue" x:Name="pluginActionKeyword"></TextBlock>
</StackPanel>
<DockPanel Grid.Row="3">
<TextBlock Opacity="0.5" x:Name="pluginAuthor"></TextBlock>
<TextBlock Opacity="0.5" x:Name="pluginWebsite" HorizontalAlignment="Right"></TextBlock>
</DockPanel> </DockPanel>
<CheckBox Grid.Row="4" x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">Disable</CheckBox> <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">
<CheckBox Margin="0 0 50 0" x:Name="cbDisablePlugin" Click="CbDisablePlugin_OnClick">Disable</CheckBox>
<TextBlock x:Name="pluginActionKeywordTitle" Margin="0 0 10 0">ActionKeyword:</TextBlock>
<TextBlock Margin="0 0 10 0" ToolTip="Change Action Keyword" Cursor="Hand" MouseUp="PluginActionKeyword_OnMouseUp" Foreground="Blue" Text="key" x:Name="pluginActionKeyword"></TextBlock>
</StackPanel>
</Grid> </Grid>
</Grid> </Grid>
</ContentControl> </ContentControl>

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
@ -432,11 +433,11 @@ namespace Wox
provider = pair.Plugin as ISettingProvider; provider = pair.Plugin as ISettingProvider;
pluginAuthor.Visibility = Visibility.Visible; pluginAuthor.Visibility = Visibility.Visible;
pluginActionKeyword.Visibility = Visibility.Visible; pluginActionKeyword.Visibility = Visibility.Visible;
pluginWebsite.Visibility = Visibility.Visible; pluginActionKeywordTitle.Visibility = Visibility.Visible;
pluginTitle.Text = pair.Metadata.Name; pluginTitle.Text = pair.Metadata.Name;
pluginTitle.Cursor = Cursors.Hand;
pluginActionKeyword.Text = pair.Metadata.ActionKeyword; pluginActionKeyword.Text = pair.Metadata.ActionKeyword;
pluginAuthor.Text = "Author: " + pair.Metadata.Author; pluginAuthor.Text = "By: " + pair.Metadata.Author;
pluginWebsite.Text = "Website: " + pair.Metadata.Website;
pluginSubTitle.Text = pair.Metadata.Description; pluginSubTitle.Text = pair.Metadata.Description;
pluginId = pair.Metadata.ID; pluginId = pair.Metadata.ID;
SyntaxSugars.CallOrRescueDefault( SyntaxSugars.CallOrRescueDefault(
@ -461,7 +462,8 @@ 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;
pluginWebsite.Visibility = Visibility.Collapsed; pluginActionKeywordTitle.Visibility = Visibility.Collapsed;
pluginTitle.Cursor = Cursors.Arrow;
SyntaxSugars.CallOrRescueDefault( SyntaxSugars.CallOrRescueDefault(
() => () =>
pluginIcon.Source = (ImageSource) new ImagePathConverter().Convert( new object[] pluginIcon.Source = (ImageSource) new ImagePathConverter().Convert( new object[]
@ -550,5 +552,26 @@ namespace Wox
} }
} }
} }
private void PluginTitle_OnMouseUp(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.Website);
}
catch
{ }
}
}
}
}
} }
} }