1
0
mirror of https://github.com/chylex/Backup-Essentials.git synced 2025-07-25 04:59:03 +02:00

Added basic Backup Location page

This commit is contained in:
chylex 2015-04-04 00:20:58 +02:00
parent 52e4358179
commit 4af0622d22
6 changed files with 138 additions and 2 deletions

View File

@ -1,7 +1,8 @@
<Application x:Class="BackupEssentials.App"
<Application
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="BackupEssentials.App"
Startup="StartApp"
DispatcherUnhandledException="HandleException">
<Application.Resources>
@ -12,6 +13,33 @@
<sys:Double x:Key="PageWidth">796</sys:Double>
<sys:Double x:Key="PageHeight">482</sys:Double>
<ControlTemplate x:Key="ButtonStyleDefault" TargetType="{x:Type ButtonBase}">
<Border BorderThickness="2" HorizontalAlignment="Stretch" Height="Auto" VerticalAlignment="Stretch" Width="Auto">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF1F1F1F" Offset="0"/>
<GradientStop Color="#FF151515" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
<Border.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FF474747" Offset="0"/>
<GradientStop Color="#FF343434" Offset="1"/>
</LinearGradientBrush>
</Border.Background>
<Label Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="16" TextOptions.TextRenderingMode="ClearType">
<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0" RecognizesAccessKey="True" SnapsToDevicePixels="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Label>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsKeyboardFocused" Value="True"/>
<Trigger Property="ToggleButton.IsChecked" Value="True"/>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFADADAD"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ResourceDictionary>
</Application.Resources>
</Application>

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BackupEssentials.Backup{
public class BackupLocation{
public string Name { get; set; }
public string Directory { get; set; }
}
}

View File

@ -82,6 +82,9 @@
<DependentUpon>About.xaml</DependentUpon>
</Compile>
<Compile Include="Controls\ButtonMainMenu.cs" />
<Compile Include="Pages\BackupLocations.xaml.cs">
<DependentUpon>BackupLocations.xaml</DependentUpon>
</Compile>
<Compile Include="TestingWindow.xaml.cs">
<DependentUpon>TestingWindow.xaml</DependentUpon>
</Compile>
@ -103,6 +106,10 @@
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="Pages\BackupLocations.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Simple Styles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>

View File

@ -164,6 +164,8 @@
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="SnapsToDevicePixels" Value="True"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ButtonBase}">
@ -237,7 +239,7 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<custom:ButtonMainMenu Content="Home" Click="ButtonMainMenuClick" Style="{DynamicResource ButtonStyleMainMenu}"/>
<custom:ButtonMainMenu Content="Backup" Click="ButtonMainMenuClick" Grid.Column="2" Style="{DynamicResource ButtonStyleMainMenu}"/>
<custom:ButtonMainMenu Content="Backup" ClickPage="Pages.BackupLocations" Click="ButtonMainMenuClick" Grid.Column="2" Style="{DynamicResource ButtonStyleMainMenu}"/>
<custom:ButtonMainMenu Content="History" Click="ButtonMainMenuClick" Grid.Column="4" Style="{DynamicResource ButtonStyleMainMenu}"/>
<custom:ButtonMainMenu Content="Settings" Click="ButtonMainMenuClick" Grid.Column="6" Style="{DynamicResource ButtonStyleMainMenu}"/>
<custom:ButtonMainMenu Content="About" ClickPage="Pages.About" Click="ButtonMainMenuClick" Grid.Column="8" Style="{DynamicResource ButtonStyleMainMenu}"/>

View File

@ -0,0 +1,65 @@
<Page x:Class="BackupEssentials.Pages.BackupLocations"
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:backup="clr-namespace:BackupEssentials.Backup"
mc:Ignorable="d"
d:DesignWidth="{StaticResource PageWidth}" d:DesignHeight="{StaticResource PageHeight}"
Title="Backup Locations">
<Grid Background="#FF2E2E2E">
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.Resources>
<Style TargetType="ListView">
<Setter Property="Margin" Value="8"/>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="#FF252525"/>
<Setter Property="Background" Value="#FF444444"/>
</Style>
<Style TargetType="ListViewItem">
<Setter Property="Padding" Value="8,4"/>
</Style>
</Grid.Resources>
<StackPanel Orientation="Horizontal">
<StackPanel.Resources>
<Style TargetType="Button">
<Setter Property="Margin" Value="8,8,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Template" Value="{StaticResource ButtonStyleDefault}"/>
</Style>
</StackPanel.Resources>
<Button Content="Add Location"/>
<Button Content="Edit"/>
<Button Content="Remove"/>
</StackPanel>
<ListView Name="LocationsListView" Grid.Row="1">
<ListView.ItemTemplate>
<DataTemplate>
<DockPanel Height="46" HorizontalAlignment="Stretch" SnapsToDevicePixels="True">
<TextBlock Foreground="White" Text="{Binding Name}" DockPanel.Dock="Top" VerticalAlignment="Top" FontSize="20"/>
<TextBlock Foreground="White" Text="{Binding Directory}" DockPanel.Dock="Bottom" VerticalAlignment="Bottom" FontSize="16"/>
</DockPanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.Items>
<backup:BackupLocation Name="Test1" Directory="C:\Abc"/>
<backup:BackupLocation Name="Test2" Directory="C:\Abcd"/>
<backup:BackupLocation Name="Test1" Directory="C:\Abc"/>
<backup:BackupLocation Name="Test2" Directory="C:\Abcd"/>
<backup:BackupLocation Name="Test1" Directory="C:\Abc"/>
<backup:BackupLocation Name="Test2" Directory="C:\Abcd"/>
<backup:BackupLocation Name="Test1" Directory="C:\Abc"/>
<backup:BackupLocation Name="Test2" Directory="C:\Abcd"/>
</ListView.Items>
</ListView>
</Grid>
</Page>

View File

@ -0,0 +1,21 @@
using BackupEssentials.Backup;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows.Controls;
namespace BackupEssentials.Pages{
public partial class BackupLocations : Page{
public readonly ObservableCollection<BackupLocation> BackupLocationsList = new ObservableCollection<BackupLocation>();
public BackupLocations(){
InitializeComponent();
// TODO uncomment once done testing
/*
BackupLocationsList.Add(new BackupLocation(){ Name = "Test1", Directory = @"C:\Folder\" });
BackupLocationsList.Add(new BackupLocation(){ Name = "Test2", Directory = @"C:\Folder\" });
LocationsListView.ItemsSource = BackupLocationsList;*/
}
}
}