Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #22 from adrianmteo/develop
Browse files Browse the repository at this point in the history
Version 1.1.3
  • Loading branch information
adrianmteo authored Mar 21, 2020
2 parents d8671f4 + 5f391f1 commit 336cd0a
Show file tree
Hide file tree
Showing 46 changed files with 5,893 additions and 3,206 deletions.
Binary file modified .repo/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .repo/screenshot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .repo/screenshot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .repo/screenshot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .repo/screenshot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .repo/theme.png
Binary file not shown.
Binary file added .repo/theme1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .repo/theme2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions Luna/App.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Application x:Class="Luna.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Windows/SettingsWindow.xaml">
StartupUri="Windows/SettingsWindow.xaml"
Startup="Application_Startup">

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Theme/MetroDark.MSControls.Core.Implicit.xaml" />
<ResourceDictionary Source="Theme/Metro/Metro.MSControls.Core.Implicit.xaml" />
<ResourceDictionary Source="Theme/Styles.Extended.Wpf.Toolkit.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
Expand Down
17 changes: 17 additions & 0 deletions Luna/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,29 @@ public static void Main(string[] args)
}
}



private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is Exception ex)
{
Logger.Exception(ex);
}
}

private void Application_Startup(object sender, StartupEventArgs e)
{
RegistryHandler.WatchAppTheme(theme =>
{
if (theme == WindowsTheme.Light)
{
Resources.MergedDictionaries[0].Source = new Uri("Theme/Metro/Metro.MSControls.Core.Implicit.xaml", UriKind.Relative);
}
else
{
Resources.MergedDictionaries[0].Source = new Uri("Theme/MetroDark/MetroDark.MSControls.Core.Implicit.xaml", UriKind.Relative);
}
});
}
}
}
59 changes: 10 additions & 49 deletions Luna/Controls/WindowHeader.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,24 @@
xmlns:local="clr-namespace:Luna.Controls"
mc:Ignorable="d"
d:DesignWidth="400" d:DesignHeight="48"
Loaded="WindowHeader_Loaded">
SnapsToDevicePixels="True" Loaded="WindowHeader_Loaded">

<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>

<Grid>
<Grid Height="30" VerticalAlignment="Top">
<Label Margin="14 0 0 0" Content="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}, FallbackValue=Window}" Padding="0" FontSize="14" VerticalAlignment="Center" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Focusable="False"
Click="ButtonUpdate_Click"
Visibility="{Binding HasUpdate, RelativeSource={RelativeSource AncestorType={x:Type local:WindowHeader}}, Converter={StaticResource BooleanToVisibilityConverter}}"
WindowChrome.IsHitTestVisibleInChrome="True" BorderThickness="0" Content="UPDATE AVAILABLE" FontSize="13" Padding="12 0" />
<Button Width="48" Click="ButtonMinimize_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding ShowInTaskbar, RelativeSource={RelativeSource AncestorType=Window}}" Value="False">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<Rectangle Margin="0 9 0 0" Width="10" Height="1" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}}" />
</Button>
<Button Width="48" Click="ButtonMaximize_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True">
<Button.Style>
<Style TargetType="Button" BasedOn="{StaticResource ButtonStyle}">
<Style.Triggers>
<DataTrigger Binding="{Binding ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="CanMinimize">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding ResizeMode, RelativeSource={RelativeSource AncestorType=Window}}" Value="NoResize">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Button.Style>
<Rectangle Width="11" Height="11" Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}}" StrokeThickness="1" />
</Button>
<Button Width="48" Click="ButtonClose_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True">
<Label Margin="14 0 0 0" Content="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}, FallbackValue=Window}" FontSize="14" VerticalAlignment="Center" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Focusable="False" WindowChrome.IsHitTestVisibleInChrome="True" BorderThickness="0" Content="ABOUT" FontSize="13" Padding="12 0" Click="ButtonAbout_Click"
Visibility="{Binding ShowAbout, RelativeSource={RelativeSource AncestorType={x:Type local:WindowHeader}}, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Button Name="ButtonMinimize" Content="&#xE921;" FontFamily="/Luna;component/Resources/#Segoe MDL2 Assets" FontSize="10" Width="48" Click="ButtonMinimize_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True" />
<Button Name="ButtonMaximize" Content="&#xE922;" FontFamily="/Luna;component/Resources/#Segoe MDL2 Assets" FontSize="10" Width="48" Click="ButtonMaximize_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True" />
<Button Name="ButtonClose" Content="&#xE8BB;" FontFamily="/Luna;component/Resources/#Segoe MDL2 Assets" FontSize="10" Width="48" Click="ButtonClose_Click" Focusable="False" BorderThickness="0" Padding="0" WindowChrome.IsHitTestVisibleInChrome="True">
<Button.Background>
<SolidColorBrush Color="{StaticResource Color_028}" />
<SolidColorBrush Color="{DynamicResource Color_028}" />
</Button.Background>
<Grid>
<Rectangle Width="15" Height="1" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}}" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<RotateTransform Angle="-45" />
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle Width="15" Height="1" Fill="{Binding Foreground, RelativeSource={RelativeSource AncestorType=ContentControl}}" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<RotateTransform Angle="45" />
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Button>
</StackPanel>
</Grid>
Expand Down
26 changes: 16 additions & 10 deletions Luna/Controls/WindowHeader.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ namespace Luna.Controls
{
public partial class WindowHeader : UserControl
{
private static readonly DependencyProperty HasUpdateProperty = DependencyProperty.Register("HasUpdate", typeof(bool), typeof(WindowHeader), new PropertyMetadata(false));
public bool HasUpdate
private static readonly DependencyProperty ShowAboutProperty = DependencyProperty.Register("ShowAbout", typeof(bool), typeof(WindowHeader), new PropertyMetadata(false));
public bool ShowAbout
{
get { return (bool)GetValue(HasUpdateProperty); }
set { SetValue(HasUpdateProperty, value); }
get { return (bool)GetValue(ShowAboutProperty); }
set { SetValue(ShowAboutProperty, value); }
}

private static readonly RoutedEvent OnClickUpdateEvent = EventManager.RegisterRoutedEvent("OnClickUpdate", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(WindowHeader));
private static readonly RoutedEvent OnClickAboutEvent = EventManager.RegisterRoutedEvent("OnClickAbout", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(WindowHeader));

public event RoutedEventHandler OnClickUpdate
public event RoutedEventHandler OnClickAbout
{
add { AddHandler(OnClickUpdateEvent, value); }
remove { RemoveHandler(OnClickUpdateEvent, value); }
add { AddHandler(OnClickAboutEvent, value); }
remove { RemoveHandler(OnClickAboutEvent, value); }
}

private Window _window;
Expand All @@ -32,6 +32,12 @@ private void WindowHeader_Loaded(object sender, RoutedEventArgs e)
if (sender is DependencyObject dependencyObject)
{
_window = Window.GetWindow(dependencyObject);

if (_window != null)
{
ButtonMinimize.Visibility = !_window.ShowInTaskbar || _window.ResizeMode == ResizeMode.NoResize ? Visibility.Collapsed : Visibility.Visible;
ButtonMaximize.Visibility = _window.ResizeMode == ResizeMode.CanMinimize || _window.ResizeMode == ResizeMode.NoResize ? Visibility.Collapsed : Visibility.Visible;
}
}
}

Expand Down Expand Up @@ -59,9 +65,9 @@ private void ButtonClose_Click(object sender, RoutedEventArgs e)
}
}

private void ButtonUpdate_Click(object sender, RoutedEventArgs e)
private void ButtonAbout_Click(object sender, RoutedEventArgs e)
{
RaiseEvent(new RoutedEventArgs(OnClickUpdateEvent));
RaiseEvent(new RoutedEventArgs(OnClickAboutEvent));
}
}
}
41 changes: 33 additions & 8 deletions Luna/Luna.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Management" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -88,6 +89,9 @@
<ItemGroup>
<Compile Include="Utils\Handlers\ThemeHandler.cs" />
<Compile Include="Utils\Handlers\AppearanceHandler.cs" />
<Compile Include="Windows\AboutWindow.xaml.cs">
<DependentUpon>AboutWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Windows\MessageWindow.xaml.cs">
<DependentUpon>MessageWindow.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -125,33 +129,53 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Theme\Styles.Extended.Wpf.Toolkit.xaml">
<Page Include="Theme\MetroDark\MetroDark.MSControls.Core.Implicit.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\MetroDark\Styles.Shared.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Windows\MessageWindow.xaml">
<Page Include="Theme\MetroDark\Styles.WPF.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\MetroDark\Theme.Colors.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Windows\SettingsWindow.xaml">
<Page Include="Theme\Metro\Metro.MSControls.Core.Implicit.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\Metro\Styles.Shared.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\MetroDark.MSControls.Core.Implicit.xaml">
<Page Include="Theme\Metro\Styles.WPF.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\Styles.Shared.xaml">
<Page Include="Theme\Metro\Theme.Colors.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Theme\Styles.WPF.xaml">
<Page Include="Theme\Styles.Extended.Wpf.Toolkit.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\AboutWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Theme\Theme.Colors.xaml">
<Page Include="Windows\MessageWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\SettingsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Windows\UpdateWindow.xaml">
<SubType>Designer</SubType>
Expand Down Expand Up @@ -186,6 +210,7 @@
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Resource Include="Resources\SegMDL2.ttf" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand All @@ -194,7 +219,7 @@
<None Include="Resources\Icon.ico" />
</ItemGroup>
<ItemGroup>
<Content Include="Resources\ThemeTool.exe">
<Content Include="ThemeTool.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions Luna/Models/UpdateModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UpdateModel : NotifyPropertyChanged
{
private UpdateStatus _status = UpdateStatus.None;

[XmlAttribute("Status")]
[XmlIgnore]
public UpdateStatus Status
{
get
Expand Down Expand Up @@ -52,7 +52,7 @@ public double Progress

private string _version;

[XmlAttribute("Version")]
[XmlIgnore]
public string Version
{
get
Expand All @@ -68,7 +68,7 @@ public string Version

private string _downloadUrl;

[XmlAttribute("DownloadUrl")]
[XmlIgnore]
public string DownloadUrl
{
get
Expand All @@ -84,7 +84,7 @@ public string DownloadUrl

private string _downloadPath;

[XmlAttribute("DownloadPath")]
[XmlIgnore]
public string DownloadPath
{
get
Expand All @@ -100,7 +100,7 @@ public string DownloadPath

private string _downloadName;

[XmlAttribute("DownloadName")]
[XmlIgnore]
public string DownloadName
{
get
Expand Down
4 changes: 2 additions & 2 deletions Luna/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.2.0")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyVersion("1.1.3.0")]
[assembly: AssemblyFileVersion("1.1.3.0")]
[assembly: Guid("7FDBD0F5-0E11-4048-8C62-A5F64BB878AF")]
Loading

0 comments on commit 336cd0a

Please sign in to comment.