Skip to content

Commit

Permalink
Initial checkin
Browse files Browse the repository at this point in the history
  • Loading branch information
splintor committed Aug 12, 2013
0 parents commit 70c5a58
Show file tree
Hide file tree
Showing 17 changed files with 1,375 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Directories #
###############
Generated/
obj/
bin/
ClientBin/
x64/
ipch/
[Rr]elease*/
[Dd]ebug*/
[Tt]est[Rr]esult*
_ReSharper*
*.bak
*.user
*.opensdf
*.sdf
*.suo
*.sublime-project
*.log
*.sqlite
*.vsmdi
*.tmp_proj

NDependOut/
6 changes: 6 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
8 changes: 8 additions & 0 deletions App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Application x:Class="SubtitlesRunner.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace SubtitlesRunner
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
91 changes: 91 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<Window x:Class="SubtitlesRunner.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:subtitlesRunner="clr-namespace:SubtitlesRunner"
Title="MainWindow"
WindowStyle="None"
WindowState="Maximized"
AllowsTransparency="True"
Background="Transparent"
Topmost="True"
x:Name="Root"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance subtitlesRunner:MainWindowModel}">
<Grid>
<Grid.Margin>
<MultiBinding Converter="{subtitlesRunner:WindowTopConverter}">
<Binding Path="WindowTop" />
<Binding Path="ActualHeight" ElementName="Root" />
<Binding Path="ActualHeight" ElementName="ButtonsGrid" />
<Binding Path="ActualHeight" ElementName="TitlesGrid" />
</MultiBinding>
</Grid.Margin>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
x:Name="MoveGrip" />
<Grid Grid.Column="1"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0"
x:Name="ButtonsGrid">
<Grid.Resources>
<Style TargetType="{x:Type Button}">
<Setter Property="Height" Value="30" />
<Setter Property="Margin" Value="10 0" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"
Orientation="Horizontal"
HorizontalAlignment="Stretch">
<Button Content="Open..." />
<Button Content="Play" />
<Button Content="Stop" />
</StackPanel>
<Slider Grid.Column="1"
HorizontalAlignment="Stretch" />
<StackPanel Orientation="Horizontal"
Grid.Column="2">
<Button Content="Restore" HorizontalAlignment="Right" />
<Button Content="Close"
HorizontalAlignment="Stretch"
IsCancel="True"
Click="OnCancel" />
</StackPanel>
</Grid>
<Grid MinHeight="100"
x:Name="TitlesGrid"
Grid.Row="1"
HorizontalAlignment="Stretch">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Setter Property="Background" Value="#01010101" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightCyan" />
</Trigger>
</Style.Triggers>
</Style>
</Grid.Style>
<TextBlock VerticalAlignment="Center"
HorizontalAlignment="Stretch"
TextAlignment="Center"
FontSize="60"
Foreground="Blue"
Text="{Binding CurrentSubtitle}" />
</Grid>
</Grid>
</Grid>
</Window>
18 changes: 18 additions & 0 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Windows;

namespace SubtitlesRunner
{
public partial class MainWindow
{
public MainWindow()
{
InitializeComponent();
DataContext = new MainWindowModel(Height);
}

private void OnCancel(object sender, RoutedEventArgs e)
{
Close();
}
}
}
50 changes: 50 additions & 0 deletions MainWindowModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
using SubtitlesRunner.Annotations;

namespace SubtitlesRunner
{
public class MainWindowModel : INotifyPropertyChanged
{
public MainWindowModel(double windowHeight)
{
CurrentSubtitle = "This is...\n...just a test";
WindowTop = windowHeight - 100;
}

private string _currentSubtitle;

public string CurrentSubtitle
{
get { return _currentSubtitle; }
set
{
if (value == _currentSubtitle) return;
_currentSubtitle = value;
OnPropertyChanged();
}
}

private double _windowTop;

public double WindowTop
{
get { return _windowTop; }
set
{
if (value.Equals(_windowTop)) return;
_windowTop = value;
OnPropertyChanged();
}
}

public event PropertyChangedEventHandler PropertyChanged;

[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Loading

0 comments on commit 70c5a58

Please sign in to comment.