Skip to content

Commit

Permalink
Fixes #560: Dopamine crashes directly after startup on some computers
Browse files Browse the repository at this point in the history
  • Loading branch information
raphgodart committed Nov 20, 2017
1 parent 4be79ff commit 9ea2b46
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 38 deletions.
14 changes: 4 additions & 10 deletions Dopamine.Common/Controls/DopamineWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Digimezzo.WPFControls;
using Dopamine.Common.Base;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

Expand Down Expand Up @@ -97,9 +98,7 @@ public void ForceActivate()

this.Activate();
this.Topmost = true;

System.Threading.Thread t = new System.Threading.Thread(Deactivate);
t.Start();
this.Deactivate();
}

public void SetWindowBorder(bool hasBorder)
Expand All @@ -118,15 +117,10 @@ private void SetBorderThickness(Thickness borderThickness)
this.previousBorderThickness = borderThickness;
}

private void Deactivate()
private async void Deactivate()
{
System.Threading.Thread.Sleep(500);
await Task.Delay(500);
Application.Current.Dispatcher.Invoke(() => this.Topmost = this.oldTopMost);

if (System.Threading.Thread.CurrentThread.IsAlive)
{
System.Threading.Thread.CurrentThread.Abort();
}
}
}
}
2 changes: 0 additions & 2 deletions Dopamine.Common/Resources/Styles/PivotItemStyle.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<Setter Property="HeaderFontWeight" Value="Normal"/>
<Setter Property="SelectedHeaderFontWeight" Value="Bold"/>
<Setter Property="HeaderFontSize" Value="12"/>
<Setter Property="HeaderTextCase" Value="UpperCase"/>
<Setter Property="HeaderForeground" Value="{DynamicResource RG_InactiveForegroundBrush}"/>
<Setter Property="SelectedHeaderForeground" Value="{DynamicResource RG_ForegroundBrush}"/>
</Style>
Expand All @@ -17,7 +16,6 @@
<Setter Property="HeaderFontWeight" Value="Light"/>
<Setter Property="SelectedHeaderFontWeight" Value="Light"/>
<Setter Property="HeaderFontSize" Value="24"/>
<Setter Property="HeaderTextCase" Value="LowerCase"/>
<Setter Property="HeaderForeground" Value="{DynamicResource RG_InactiveForegroundBrush}"/>
<Setter Property="SelectedHeaderForeground" Value="{DynamicResource RG_ForegroundBrush}"/>
</Style>
Expand Down
8 changes: 8 additions & 0 deletions Dopamine/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
2017-11-21: Dopamine 1.5.2
--------------------------

- [Changed] Updated the Korean translation
- [Fixed] Crash on startup when using a non-English language
- [Fixed] Menu texts not updated when switching language


2017-11-20: Dopamine 1.5.1
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion Dopamine/Dopamine.wxs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?define Version="1.5.1.0" ?>
<?define Version="1.5.2.0" ?>
<?define Manufacturer="Digimezzo" ?>
<?define Product="Dopamine" ?>
<?define ProductCab="Dopamine.cab" ?>
Expand Down
Binary file modified Dopamine/Libraries/Digimezzo.WPFControls.dll
Binary file not shown.
6 changes: 3 additions & 3 deletions Dopamine/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

[assembly: AssemblyCompany("Digimezzo")]
[assembly: AssemblyCopyright("Copyright Digimezzo © 2014 - 2017")]
[assembly: AssemblyVersion("1.5.1.0")]
[assembly: AssemblyFileVersion("1.5.1.0")]
[assembly: AssemblyInformationalVersion("1.5.1.0")]
[assembly: AssemblyVersion("1.5.2.0")]
[assembly: AssemblyFileVersion("1.5.2.0")]
[assembly: AssemblyInformationalVersion("1.5.2.0")]
18 changes: 12 additions & 6 deletions Dopamine/Views/FullPlayer/Collection/CollectionMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,20 @@
</i:Interaction.Triggers>

<Grid>
<TextBlock x:Name="ArtistsProxy" Text="{DynamicResource Language_Artists}" Visibility="Collapsed"/>
<TextBlock x:Name="GenresProxy" Text="{DynamicResource Language_Genres}" Visibility="Collapsed"/>
<TextBlock x:Name="AlbumsProxy" Text="{DynamicResource Language_Albums}" Visibility="Collapsed"/>
<TextBlock x:Name="SongsProxy" Text="{DynamicResource Language_Songs}" Visibility="Collapsed"/>
<TextBlock x:Name="PlaylistsProxy" Text="{DynamicResource Language_Playlists}" Visibility="Collapsed"/>
<TextBlock x:Name="FrequentProxy" Text="{DynamicResource Language_Frequent}" Visibility="Collapsed"/>
<commonviews:SearchControl Margin="0,0,15,0" Width="200" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="{Binding DataContext.CanSearch, ElementName=This,Converter={StaticResource BooleanToVisibilityConverter}}"/>
<dc:Pivot DockPanel.Dock="Top" Margin="85,0,215,0" SelectedIndex="{Binding SelectedPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:CollectionPage}}">
<dc:PivotItem Header="{DynamicResource Language_Artists}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Genres}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Albums}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Songs}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Playlists}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Frequent}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=ArtistsProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=GenresProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=AlbumsProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=SongsProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=PlaylistsProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=FrequentProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
</dc:Pivot>
</Grid>
</UserControl>
9 changes: 6 additions & 3 deletions Dopamine/Views/FullPlayer/FullPlayer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
</i:Interaction.Triggers>

<Grid>
<TextBlock x:Name="CollectionProxy" Text="{DynamicResource Language_Collection}" Visibility="Collapsed"/>
<TextBlock x:Name="SettingsProxy" Text="{DynamicResource Language_Settings}" Visibility="Collapsed"/>
<TextBlock x:Name="InformationProxy" Text="{DynamicResource Language_Information}" Visibility="Collapsed"/>
<controls:Logo Accent="{DynamicResource RG_AccentBrush}" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="15,15,0,0"/>
<DockPanel>
<dc:Pivot DockPanel.Dock="Top" Margin="85,20,0,0"
SelectedIndex="{Binding SelectedFullPlayerPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:FullPlayerPage}}">
<dc:PivotItem Header="{DynamicResource Language_Collection}" Style="{StaticResource MainMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Settings}" Style="{StaticResource MainMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Information}" Style="{StaticResource MainMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=CollectionProxy,Converter={StaticResource StringToUpperConverter}}" Style="{StaticResource MainMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=SettingsProxy,Converter={StaticResource StringToUpperConverter}}" Style="{StaticResource MainMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=InformationProxy,Converter={StaticResource StringToUpperConverter}}" Style="{StaticResource MainMenuPivotItemStyle}"/>
</dc:Pivot>
<controls:TransitioningContentControl DockPanel.Dock="Top" Margin="85,0,0,0" FadeIn="True" FadeInTimeout="0.75" SlideIn="True"
SlideInTimeout="0.75" SlideInFrom="{Binding SlideInFrom}" SlideInTo="0" Name="FullPlayerMenuRegion"
Expand Down
12 changes: 8 additions & 4 deletions Dopamine/Views/FullPlayer/Information/InformationMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
</i:EventTrigger>
</i:Interaction.Triggers>

<dc:Pivot DockPanel.Dock="Top" Margin="85,0,0,0" SelectedIndex="{Binding SelectedPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:InformationPage}}">
<dc:PivotItem Header="{DynamicResource Language_Help}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_About}" Style="{StaticResource SubMenuPivotItemStyle}"/>
</dc:Pivot>
<Grid>
<TextBlock x:Name="HelpProxy" Text="{DynamicResource Language_Help}" Visibility="Collapsed"/>
<TextBlock x:Name="AboutProxy" Text="{DynamicResource Language_About}" Visibility="Collapsed"/>
<dc:Pivot DockPanel.Dock="Top" Margin="85,0,0,0" SelectedIndex="{Binding SelectedPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:InformationPage}}">
<dc:PivotItem Header="{Binding Text,ElementName=HelpProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=AboutProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
</dc:Pivot>
</Grid>
</UserControl>
24 changes: 16 additions & 8 deletions Dopamine/Views/FullPlayer/Settings/SettingsMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,20 @@
</i:EventTrigger>
</i:Interaction.Triggers>

<dc:Pivot DockPanel.Dock="Top" Margin="85,0,0,0" SelectedIndex="{Binding SelectedPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:SettingsPage}}">
<dc:PivotItem Header="{DynamicResource Language_Collection}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Appearance}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Behaviour}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Playback}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Startup}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{DynamicResource Language_Online}" Style="{StaticResource SubMenuPivotItemStyle}"/>
</dc:Pivot>
<Grid>
<TextBlock x:Name="CollectionProxy" Text="{DynamicResource Language_Collection}" Visibility="Collapsed"/>
<TextBlock x:Name="AppearanceProxy" Text="{DynamicResource Language_Appearance}" Visibility="Collapsed"/>
<TextBlock x:Name="BehaviourProxy" Text="{DynamicResource Language_Behaviour}" Visibility="Collapsed"/>
<TextBlock x:Name="PlaybackProxy" Text="{DynamicResource Language_Playback}" Visibility="Collapsed"/>
<TextBlock x:Name="StartupProxy" Text="{DynamicResource Language_Startup}" Visibility="Collapsed"/>
<TextBlock x:Name="OnlineProxy" Text="{DynamicResource Language_Online}" Visibility="Collapsed"/>
<dc:Pivot DockPanel.Dock="Top" Margin="85,0,0,0" SelectedIndex="{Binding SelectedPage,Converter={StaticResource EnumConverter},ConverterParameter={x:Type commonenums:SettingsPage}}">
<dc:PivotItem Header="{Binding Text,ElementName=CollectionProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=AppearanceProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=BehaviourProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=PlaybackProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=StartupProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
<dc:PivotItem Header="{Binding Text,ElementName=OnlineProxy,Converter={StaticResource StringToLowerConverter}}" Style="{StaticResource SubMenuPivotItemStyle}"/>
</dc:Pivot>
</Grid>
</UserControl>
5 changes: 4 additions & 1 deletion Dopamine/Views/Shell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,10 @@ private void ShellWindow_Restored(object sender, System.EventArgs e)
private void ShellWindow_CloseToolTipChanged(object sender, System.EventArgs e)
{
// Workaround to make sure the PART_MiniPlayerButton ToolTip also gets updated on a language change
this.PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Mini_Player");
if(this.PART_MiniPlayerButton != null)
{
this.PART_MiniPlayerButton.ToolTip = ResourceUtils.GetString("Language_Mini_Player");
}
}

private void ShellWindow_LocationChanged(object sender, System.EventArgs e)
Expand Down

0 comments on commit 9ea2b46

Please sign in to comment.