Skip to content

Commit

Permalink
Change the notification to match the sims's popup box
Browse files Browse the repository at this point in the history
  • Loading branch information
FaithBeam committed Nov 11, 2023
1 parent b1c6016 commit 2b6ce25
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public interface INotificationViewModel
ReactiveCommand<Unit, Unit> WikiCommand { get; }
bool IsVisible { get; set; }
bool HasBeenShown { get; set; }
ReactiveCommand<Unit, Unit> OkCommand { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ public class NotificationViewModel : ViewModelBase, INotificationViewModel
{
private bool _isVisible;
private bool _hasBeenShown;

public NotificationViewModel()
{
WikiCommand = ReactiveCommand.Create(() =>
OpenUrl("https://github.com/FaithBeam/Sims-1-Complete-Collection-Widescreen-Patcher/wiki/Extras"));
OkCommand = ReactiveCommand.Create(() => { IsVisible = false; });
}

public ReactiveCommand<Unit, Unit> OkCommand { get; }
public ReactiveCommand<Unit, Unit> WikiCommand { get; }

public bool IsVisible
Expand All @@ -29,7 +31,7 @@ public bool HasBeenShown
get => _hasBeenShown;
set => this.RaiseAndSetIfChanged(ref _hasBeenShown, value);
}

// https://stackoverflow.com/a/43232486
private void OpenUrl(string url)
{
Expand Down
77 changes: 59 additions & 18 deletions Sims1WidescreenPatcher.UI/UserControls/Notification.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,74 @@
Height="72"
Classes.Hidden="{Binding !IsVisible}"
Classes.Visible="{Binding IsVisible}">
<Border BorderBrush="White"
BorderThickness="1"
CornerRadius="20">
<Rectangle x:Name="Rectangle"
Width="180"
Height="70"
Fill="LightBlue"
Opacity="0.4"
RadiusX="20"
RadiusY="20" />
</Border>
<DockPanel Width="{Binding Width, ElementName=Canvas}"
Height="{Binding Height, ElementName=Canvas}">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center">
<Rectangle x:Name="Rectangle"
Width="180"
Height="70"
Fill="#000052"
RadiusX="1"
RadiusY="1"/>
<Grid Width="{Binding Width, ElementName=Canvas}"
Height="{Binding Height, ElementName=Canvas}"
RowDefinitions="*,*,*">
<Label Grid.Row="0"
Content="Did You Know?"
FontFamily="Comic Sans MS"
Foreground="#8e94c2"
Padding="0"
HorizontalAlignment="Center" />
<StackPanel Grid.Row="1"
Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Top">
<Label Padding="0"
Content="More info in the "
FontFamily="Comic Sans MS"
FontSize="12"
Foreground="#8e94c2"
VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Button Padding="0"
Foreground="Blue"
Background="Transparent"
Content="Wiki"
DockPanel.Dock="Right"
FontFamily="Comic Sans MS"
FontSize="12"
Command="{Binding WikiCommand}" />
</StackPanel>
</DockPanel>

<Button Grid.Row="2"
Foreground="#8e94c2"
Background="#00528d"
CornerRadius="7"
HorizontalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
VerticalAlignment="Top"
Padding="0"
Width="70"
Height="20"
BorderBrush="#01345e"
BorderThickness="1"
FontFamily="Comic Sans MS"
Command="{Binding OkCommand}">
<Button.RenderTransform>
<SkewTransform AngleX="-15" />
</Button.RenderTransform>
<Button.Styles>
<Style Selector="Button:pointerover /template/ ContentPresenter">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="#00528d" />
</Style>
<Style Selector="Button:pressed /template/ ContentPresenter">
<Setter Property="RenderTransform" Value="scale(0.90)" />
<Setter Property="Foreground" Value="#01ffff" />
</Style>
</Button.Styles>
<TextBlock Text="OK">
<TextBlock.RenderTransform>
<SkewTransform AngleX="15" />
</TextBlock.RenderTransform>
</TextBlock>
</Button>
</Grid>
</Canvas>
</UserControl>

0 comments on commit 2b6ce25

Please sign in to comment.