Permalink
Browse files

implement "premium" mode.

  • Loading branch information...
1 parent af72672 commit 955f13f354b9978a1acaf488dbc830848c05c5ef karno committed Mar 1, 2012
@@ -6,20 +6,36 @@
using Inscribe.Common;
using Livet;
using Livet.Commands;
+using Inscribe.Storage;
namespace Inscribe.ViewModels.Dialogs.Common
{
public class AboutViewModel : ViewModel
{
- private readonly ContributorViewModel[] contributors = new ContributorViewModel[]{
- new ContributorViewModel("そらん", "dasoran"),
+ public static readonly ContributorViewModel[] contributors = new ContributorViewModel[]{
+ new ContributorViewModel("かーの", "karno"), // test
new ContributorViewModel("佐々木@くっくっ。", "ssk_uo"),
- new ContributorViewModel("るみぃ", "lummy_ts"),
+ new ContributorViewModel("そらん", "dasoran"),
new ContributorViewModel("たけしけー", "takeshik"),
- new ContributorViewModel("凡骨A", "bonkotsua"),
new ContributorViewModel("ひかりさま", "miz_hi"),
+ new ContributorViewModel("凡骨A", "bonkotsua"),
+ new ContributorViewModel("るみぃ", "lummy_ts"),
};
+ public static bool IsPremiumStatic
+ {
+ get
+ {
+ return AccountStorage.Accounts
+ .Any(i => AboutViewModel.contributors.Select(c => c.ScreenName).Any(s => s == i.ScreenName));
+ }
+ }
+
+ public bool IsPremium
+ {
+ get { return IsPremiumStatic; }
+ }
+
public AboutViewModel()
{
Task.Factory.StartNew(() => CheckUpdate());
@@ -30,7 +46,9 @@ public IEnumerable<ContributorViewModel> Contributors
get
{
// 順番はランダム
- return contributors.Shuffle()
+ return contributors
+ .Skip(1) // 最初は僕なので飛ばす
+ .Shuffle()
.Concat(new[] { new ContributorViewModel("(順不同で掲載しています)") });
}
}
@@ -232,20 +250,20 @@ public void HideContributors()
public class ContributorViewModel
{
public string Name { get; private set; }
- private string screen;
+ public string ScreenName { get; private set; }
public ContributorViewModel(string name, string screen = null)
{
if (!String.IsNullOrEmpty(screen))
this.Name = name + "(" + screen + ")";
else
this.Name = name;
- this.screen = screen;
+ this.ScreenName = screen;
}
public bool IsLinkEnabled
{
- get { return !String.IsNullOrEmpty(screen); }
+ get { return !String.IsNullOrEmpty(ScreenName); }
}
#region OpenLinkCommand
@@ -267,7 +285,7 @@ public void OpenLink()
{
if (IsLinkEnabled)
{
- Browser.Start("http://twitter.com/" + screen);
+ Browser.Start("http://twitter.com/" + ScreenName);
}
}
@@ -15,6 +15,7 @@
using Livet.Commands;
using System.Windows.Media;
using System.Windows;
+using Inscribe.ViewModels.Dialogs.Common;
namespace Inscribe.ViewModels
{
@@ -59,7 +60,7 @@ public string Title
{
get
{
- return Define.ApplicationName + " " + Define.GetFormattedVersion();
+ return Define.ApplicationName + " " + Define.GetFormattedVersion() + (AboutViewModel.IsPremiumStatic ? " [premium]" : "");
}
}
@@ -133,9 +133,6 @@
</Hyperlink>
<Run Text="." />
<LineBreak />
- <Hyperlink Command="{Binding ShowContributorsCommand}">
- <Run FontWeight="Bold" Text="Show contributors" />
- </Hyperlink>
</TextBlock>
<TextBlock Margin="0,0,5,25"
HorizontalAlignment="Right"
@@ -147,13 +144,13 @@
</Hyperlink>
<Run Text="." />
</TextBlock>
- <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
- <StackPanel.Background>
+ <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Bottom">
+ <DockPanel.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="White" />
<GradientStop Offset="1" Color="#E0FFF9" />
</LinearGradientBrush>
- </StackPanel.Background>
+ </DockPanel.Background>
<StackPanel Orientation="Horizontal" Visibility="{Binding CheckState, ConverterParameter=Checking, Converter={StaticResource StringEqualVisibleConverter}}">
<my:Intermediate Margin="2" />
<TextBlock Margin="2" Text="Krileの更新を確認しています..." />
@@ -192,7 +189,28 @@
Source="{StaticResource Failed}" />
<TextBlock Margin="2" Text="更新の確認に失敗しました。しばらく間を置いて、再度お試しください。" />
</StackPanel>
- </StackPanel>
+ <Grid HorizontalAlignment="Right" VerticalAlignment="Center">
+ <TextBlock Margin="4,2"
+ FontWeight="Bold"
+ Visibility="{Binding IsPremium,
+ Converter={StaticResource BoolVisibleConverter}}">
+ <Hyperlink Command="{Binding ShowContributorsCommand}"
+ Foreground="OrangeRed">
+ <Run FontWeight="Bold"
+ Text="You are a Premium user!" />
+ </Hyperlink>
+ </TextBlock>
+ <TextBlock Margin="4,2"
+ FontWeight="Bold"
+ Visibility="{Binding IsPremium,
+ Converter={StaticResource BoolInvisibleConverter}}">
+ <Hyperlink Command="{Binding ShowContributorsCommand}">
+ <Run FontWeight="Bold"
+ Text="You are not a Premium user." />
+ </Hyperlink>
+ </TextBlock>
+ </Grid>
+ </DockPanel>
<ScrollViewer Background="#E0FFFFFF"
VerticalScrollBarVisibility="Auto"
Visibility="{Binding IsVisibleLicense,
@@ -237,7 +255,8 @@
<Run Text="以下の方々を含む多くの方の寄付により、Krileの開発が継続されています。" />
</TextBlock>
<DockPanel Background="#66ff9900" DockPanel.Dock="Bottom">
- <TextBlock DockPanel.Dock="Right"
+ <TextBlock VerticalAlignment="Center"
+ DockPanel.Dock="Right"
Padding="6,4"
TextWrapping="Wrap">
<Bold>
@@ -246,7 +265,8 @@
</Hyperlink>
</Bold>
</TextBlock>
- <TextBlock DockPanel.Dock="Bottom"
+ <TextBlock VerticalAlignment="Center"
+ DockPanel.Dock="Bottom"
Padding="6,4"
TextWrapping="Wrap">
<Bold>

0 comments on commit 955f13f

Please sign in to comment.