Work on UI, added splash screen

This commit is contained in:
Tiberiu Chibici 2014-07-24 23:41:17 +03:00
parent 4e2eb5dd3f
commit 00f5ddf673
10 changed files with 108 additions and 6 deletions

View File

@ -4,6 +4,10 @@
StartupUri="UI/MainWindow.xaml" StartupUri="UI/MainWindow.xaml"
Startup="Application_Startup"> Startup="Application_Startup">
<Application.Resources> <Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="UI/Styles/Common.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources> </Application.Resources>
</Application> </Application>

View File

@ -134,6 +134,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
</Page> </Page>
<Page Include="UI\Styles\ButtonStyle.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Styles\Common.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -172,6 +180,9 @@
<ItemGroup> <ItemGroup>
<Resource Include="Resources\Icons\text-x-generic-32.png" /> <Resource Include="Resources\Icons\text-x-generic-32.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<SplashScreen Include="Resources\splash.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

View File

@ -6,6 +6,7 @@ using RainmeterEditor.Business;
using RainmeterEditor.UI.Dialogs; using RainmeterEditor.UI.Dialogs;
using RainmeterEditor.Model.Events; using RainmeterEditor.Model.Events;
using RainmeterEditor.Model; using RainmeterEditor.Model;
using System.Windows;
namespace RainmeterEditor.UI.Controller namespace RainmeterEditor.UI.Controller
{ {
@ -29,10 +30,15 @@ namespace RainmeterEditor.UI.Controller
{ {
} }
public void Create() public void Create(Window parent = null, DocumentFormat defaultFormat = null, string defaultPath = "")
{ {
// Show dialog // Show dialog
var dialog = new CreateDocumentDialog(); var dialog = new CreateDocumentDialog()
{
Owner = parent,
SelectedFormat = defaultFormat,
SelectedPath = defaultPath
};
bool? res = dialog.ShowDialog(); bool? res = dialog.ShowDialog();
if (!res.HasValue || !res.Value) if (!res.HasValue || !res.Value)
@ -44,5 +50,11 @@ namespace RainmeterEditor.UI.Controller
// Call manager // Call manager
DocumentManager.Instance.Create(format, path); DocumentManager.Instance.Create(format, path);
} }
public void Create(DocumentFormat format, string path)
{
// Call manager
DocumentManager.Instance.Create(format, path);
}
} }
} }

View File

@ -1,7 +1,10 @@
<Window x:Class="RainmeterEditor.UI.Dialogs.CreateDocumentDialog" <Window x:Class="RainmeterEditor.UI.Dialogs.CreateDocumentDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="CreateDocumentDialog" Height="250" Width="400"> Title="Create..." Height="250" Width="400"
WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow" ShowInTaskbar="False">
<Grid Background="WhiteSmoke"> <Grid Background="WhiteSmoke">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />

View File

@ -59,6 +59,7 @@ namespace RainmeterEditor.UI.Dialogs
InitializeComponent(); InitializeComponent();
PopulateFormats(); PopulateFormats();
Validate();
} }
private void PopulateFormats() private void PopulateFormats()
@ -79,5 +80,14 @@ namespace RainmeterEditor.UI.Dialogs
DialogResult = false; DialogResult = false;
Close(); Close();
} }
private void Validate()
{
bool res = true;
res &= !String.IsNullOrWhiteSpace(textPath.Text);
res &= (listFormats.SelectedItem != null);
buttonCreate.IsEnabled = res;
}
} }
} }

View File

@ -4,7 +4,8 @@
xmlns:ui="clr-namespace:RainmeterEditor.UI" xmlns:ui="clr-namespace:RainmeterEditor.UI"
xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock" xmlns:ad="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock" xmlns:adlayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
Title="Rainmeter Studio" Height="350" Width="525"> Title="Rainmeter Studio" Height="350" Width="525"
ResizeMode="CanResizeWithGrip" >
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />

View File

@ -61,7 +61,7 @@ namespace RainmeterEditor
private void File_New_Click(object sender, RoutedEventArgs e) private void File_New_Click(object sender, RoutedEventArgs e)
{ {
documentController.Create(); documentController.Create(this);
} }
} }
} }

View File

@ -0,0 +1,55 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="Button">
<Setter Property="Margin" Value="1" />
<Setter Property="Padding" Value="6,1,6,1" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="_border"
BorderBrush="Gray"
BorderThickness="1"
CornerRadius="2"
Padding="{TemplateBinding Padding}">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#eeee" Offset="0" />
<GradientStop Color="#cccc" Offset="1" />
</LinearGradientBrush>
</Border.Background>
<ContentPresenter Name="_content" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="_border" Property="Background" >
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#eeee" Offset="0" />
<GradientStop Color="#dddd" Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="_border" Property="Background" >
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="#dddd" Offset="0" />
<GradientStop Color="#bbbb" Offset="1" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="_content" Property="Opacity" Value=".5" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,6 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ButtonStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>