Skip to content

Commit

Permalink
First Upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy16823 committed May 7, 2024
1 parent 9c063a1 commit 5036a57
Show file tree
Hide file tree
Showing 1,272 changed files with 42,751 additions and 0 deletions.
Binary file not shown.
Binary file not shown.
Binary file added Source/.vs/SBWPF/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added Source/.vs/SBWPF/v17/.futdcache.v2
Binary file not shown.
Binary file added Source/.vs/SBWPF/v17/.suo
Binary file not shown.
25 changes: 25 additions & 0 deletions Source/SBWPF.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34525.116
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SBWPF", "SBWPF\SBWPF.csproj", "{7E20945D-1C3F-4C6B-9A96-F27DF1D7E86E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7E20945D-1C3F-4C6B-9A96-F27DF1D7E86E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E20945D-1C3F-4C6B-9A96-F27DF1D7E86E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E20945D-1C3F-4C6B-9A96-F27DF1D7E86E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E20945D-1C3F-4C6B-9A96-F27DF1D7E86E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0046E2B5-B339-4CC9-9CAA-B3546D1DD0AC}
EndGlobalSection
EndGlobal
25 changes: 25 additions & 0 deletions Source/SBWPF/AboutDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Window x:Class="SBWPF.AboutDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SBWPF"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="AboutDialog" Height="300" Width="600" Style="{DynamicResource CustomWindowStyle}" hc:Theme.Skin="Dark">
<Grid>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Stretch" Orientation="Vertical">
<TextBlock FontSize="18" HorizontalAlignment="Center" >Smartli Backup 2.0</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center" x:Name="versionLabel">Version: 2.0.0.0</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">Licensed under the MIT licence</TextBlock>
<Separator hc:Theme.Skin="Dark" Margin="0 15"></Separator>
<TextBlock FontSize="14" HorizontalAlignment="Center">Thanks To:</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">HandyControl (MIT Licence)</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">Newtonsoft.Json (MIT Licence)</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">SharpVectors / SharpVectors.wpf (BSD-3 Licence)</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">SVGImage (MIT Licence)</TextBlock>
<TextBlock FontSize="12" HorizontalAlignment="Center">Bootstrap Icons (MIT Licence)</TextBlock>
<Button Style="{StaticResource ButtonPrimary}" Click="Button_Click" Margin="15" Content="Licence Files" hc:BorderElement.CornerRadius="15"></Button>
</StackPanel>
</Grid>
</Window>
40 changes: 40 additions & 0 deletions Source/SBWPF/AboutDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SBWPF
{
/// <summary>
/// Interaktionslogik für AboutDialog.xaml
/// </summary>
public partial class AboutDialog : Window
{
public AboutDialog()
{
InitializeComponent();
Version version = Assembly.GetExecutingAssembly().GetName().Version;
versionLabel.Text = "Version " + version.ToString();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
var appPath = new FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName;
var licencePath = System.IO.Path.Combine(appPath, "Legal");

Process.Start("explorer.exe", licencePath);
}
}
}
23 changes: 23 additions & 0 deletions Source/SBWPF/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Application x:Class="SBWPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SBWPF"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- Contains all of the colours and brushes for a theme -->
<ResourceDictionary Source="Themes/ColourDictionaries/SoftDark.xaml"/>
<!-- Contains most of the control-specific brushes which reference -->
<!-- the above theme. I aim for this to contain ALL brushes, not most -->
<ResourceDictionary Source="Themes/ControlColours.xaml"/>
<!-- Contains all of the control styles (Button, ListBox, etc) -->
<ResourceDictionary Source="Themes/Controls.xaml"/>
<ResourceDictionary Source="Styles/CustomStyles.xaml" />
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
14 changes: 14 additions & 0 deletions Source/SBWPF/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;

namespace SBWPF
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

}
10 changes: 10 additions & 0 deletions Source/SBWPF/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
52 changes: 52 additions & 0 deletions Source/SBWPF/BackupPlanWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Window x:Class="SBWPF.BackupPlanWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SBWPF"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Title="Backup Plan" Height="450" Width="600" Style="{DynamicResource CustomWindowStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Margin="5" Text="Backup Name" VerticalAlignment="Center"></TextBlock>
<TextBox x:Name="backupNameTextbox" hc:Theme.Skin="Dark" Grid.Column="1" Margin="5"></TextBox>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Margin="5" Text="Schedule" VerticalAlignment="Center"></TextBlock>
<hc:ComboBox x:Name="ScheduleCombobox" hc:Theme.Skin="Dark" Margin="5" Grid.Column="1"></hc:ComboBox>
</Grid>
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
<Button x:Name="addFolderButton" Click="addFolderButton_Click" MinWidth="120" Content="Add Directory" Margin="5" Style="{StaticResource ButtonPrimary}" hc:BorderElement.CornerRadius="5" />
<Button x:Name="addFileButton" Click="addFileButton_Click" MinWidth="120" Content="Add File" Margin="5" Style="{StaticResource ButtonPrimary}" hc:BorderElement.CornerRadius="5" />
<Button x:Name="removeSelection" Click="removeSelection_Click" MinWidth="120" Content="Remove Selection" Margin="5" Style="{StaticResource ButtonDanger}" hc:BorderElement.CornerRadius="5" />
</StackPanel>
<ListView x:Name="backupSources" Grid.Row="3" Margin="5" hc:Theme.Skin="Dark">
<ListView.View>
<GridView>
<GridViewColumn Width="auto" Header="Name" DisplayMemberBinding="{Binding Name}" ></GridViewColumn>
<GridViewColumn Width="auto" Header="Path" DisplayMemberBinding="{Binding Path}"></GridViewColumn>
<GridViewColumn Width="auto" Header="Type" DisplayMemberBinding="{Binding Type}"></GridViewColumn>
</GridView>
</ListView.View>
</ListView>
<StackPanel Orientation="Horizontal" Grid.Row="4" HorizontalAlignment="Right">
<Button x:Name="createPlanButton" Click="createPlanButton_Click" Content="Save Backup Plan" Margin="5" Style="{StaticResource ButtonPrimary}" hc:BorderElement.CornerRadius="15" />
</StackPanel>
</Grid>
</Window>
104 changes: 104 additions & 0 deletions Source/SBWPF/BackupPlanWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using Backuper;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace SBWPF
{
/// <summary>
/// Interaktionslogik für NewPlanDialog.xaml
/// </summary>
public partial class BackupPlanWindow : Window
{
public Backuper.BackupPlan BackupPlan { get; set; }

private ObservableCollection<Backuper.BackupSource> m_backupSources;
private MainWindow m_mainWindow;


public BackupPlanWindow(BackupPlan plan, MainWindow mainWindow)
{
BackupPlan = plan;
m_mainWindow = mainWindow;

InitializeComponent();

m_backupSources = new ObservableCollection<BackupSource>(plan.Sources);
backupSources.ItemsSource = m_backupSources;

var nameBinding = new Binding("Name");
nameBinding.Source = BackupPlan;
nameBinding.Mode = BindingMode.TwoWay;
backupNameTextbox.SetBinding(TextBox.TextProperty, nameBinding);

ScheduleCombobox.ItemsSource = Enum.GetValues(typeof(Backuper.Schedule));
var schedulebinding = new Binding("Schedule");
schedulebinding.Source = BackupPlan;
schedulebinding.Mode = BindingMode.TwoWay;
ScheduleCombobox.SetBinding(ComboBox.SelectedItemProperty, schedulebinding);
}

private void addFolderButton_Click(object sender, RoutedEventArgs e)
{
OpenFolderDialog openFolderDialog = new OpenFolderDialog();
if(openFolderDialog.ShowDialog() == true)
{
var folderInfo = new FileInfo(openFolderDialog.FolderName);

var backupSource = new BackupSource();
backupSource.Name = folderInfo.Name;
backupSource.Path = openFolderDialog.FolderName;
backupSource.Type = Backuper.Type.Directory;

m_backupSources.Add(backupSource);
}
}

private void addFileButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
{
var folderInfo = new FileInfo(openFileDialog.FileName);

var backupSource = new BackupSource();
backupSource.Name = folderInfo.Name;
backupSource.Path = openFileDialog.FileName;
backupSource.Type = Backuper.Type.File;

m_backupSources.Add(backupSource);
}
}

private void removeSelection_Click(object sender, RoutedEventArgs e)
{
if(backupSources.SelectedItem != null)
{
m_backupSources.Remove((BackupSource)backupSources.SelectedItem);
}
}

private void createPlanButton_Click(object sender, RoutedEventArgs e)
{
BackupPlan.Sources = m_backupSources.ToList();
Console.WriteLine(BackupPlan.Name);
m_mainWindow.SavePlans();
this.Close();
}


}
}
48 changes: 48 additions & 0 deletions Source/SBWPF/BackupWorker.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Backuper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Threading;

namespace SBWPF
{
public class BackupWorker
{
public DispatcherTimer Timer { get; set; }
public Guid Guid { get; set; }
private MainWindow m_mainWindow;
private BackupPlan m_backupPlan;

public BackupWorker(MainWindow mainWindow, BackupPlan plan)
{
m_mainWindow = mainWindow;
m_backupPlan = plan;
Guid = Guid.NewGuid();
}

public void StartTimer(int intervall)
{
m_mainWindow.ShowPlanProgress(m_backupPlan);
Timer = new DispatcherTimer();
Timer.Tick += Timer_Tick;
Timer.Interval = TimeSpan.FromMicroseconds(intervall);
Timer.Start();
}

public void StopTimer()
{
Timer.Stop();
m_mainWindow.HidePlanProgress(m_backupPlan);
}

private void Timer_Tick(object? sender, EventArgs e)
{
m_mainWindow.Dispatcher.InvokeAsync(() =>
{
m_mainWindow.ShowPlanProgress(m_backupPlan);
});
}
}
}
4 changes: 4 additions & 0 deletions Source/SBWPF/Images/arrow-clockwise.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Source/SBWPF/Images/box-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Source/SBWPF/Images/clock-history.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Source/SBWPF/Images/exclamation-triangle-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Source/SBWPF/Images/info-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions Source/SBWPF/Images/plus-circle.svg
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 Source/SBWPF/Images/smartli.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5036a57

Please sign in to comment.