Commit 70ae836d authored by Manu's avatar Manu 🏅
Browse files

Upgrade to .NET FW 4.8 & Cleanup

parent eff3b470
......@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace BackupManager.BackupProcessor
......@@ -29,7 +28,7 @@ namespace BackupManager.BackupProcessor
internal string TargetLocation { get; set; }
private List<BackupItem> BackupItems = new List<BackupItem>();
private readonly List<BackupItem> BackupItems = new List<BackupItem>();
/// <summary>
/// Is the backup process running?
......@@ -39,10 +38,7 @@ namespace BackupManager.BackupProcessor
private int currentMajorProgress = 0;
public int CurrentMajorProgress
{
get
{
return currentMajorProgress;
}
get => currentMajorProgress;
set
{
currentMajorProgress = value;
......@@ -53,10 +49,7 @@ namespace BackupManager.BackupProcessor
private int maximumMajorProgress = 1;
public int MaximumMajorProgress
{
get
{
return maximumMajorProgress;
}
get => maximumMajorProgress;
set
{
maximumMajorProgress = value;
......@@ -64,13 +57,10 @@ namespace BackupManager.BackupProcessor
}
}
private string majorProgressText = String.Empty;
private string majorProgressText = string.Empty;
public string MajorProgressText
{
get
{
return majorProgressText;
}
get => majorProgressText;
set
{
majorProgressText = value;
......@@ -81,10 +71,7 @@ namespace BackupManager.BackupProcessor
private int currentMinorProgress = 0;
public int CurrentMinorProgress
{
get
{
return currentMinorProgress;
}
get => currentMinorProgress;
set
{
currentMinorProgress = value;
......@@ -95,10 +82,7 @@ namespace BackupManager.BackupProcessor
private int maximumMinorProgress = 1;
public int MaximumMinorProgress
{
get
{
return maximumMinorProgress;
}
get => maximumMinorProgress;
set
{
maximumMinorProgress = value;
......@@ -106,13 +90,10 @@ namespace BackupManager.BackupProcessor
}
}
private string minorProgressText = String.Empty;
private string minorProgressText = string.Empty;
public string MinorProgressText
{
get
{
return minorProgressText;
}
get => minorProgressText;
set
{
minorProgressText = value;
......
......@@ -11,10 +11,7 @@ namespace BackupManager.BusinessLogic
/// </summary>
public string Name
{
get
{
return name;
}
get => name;
set
{
name = value;
......@@ -29,10 +26,7 @@ namespace BackupManager.BusinessLogic
/// </summary>
public string Location
{
get
{
return location;
}
get => location;
set
{
location = value;
......@@ -47,10 +41,7 @@ namespace BackupManager.BusinessLogic
/// </summary>
public DateTime LastBackup
{
get
{
return lastBackup;
}
get => lastBackup;
set
{
lastBackup = value;
......@@ -65,10 +56,7 @@ namespace BackupManager.BusinessLogic
/// </summary>
public DateTime Created
{
get
{
return created;
}
get => created;
set
{
created = value;
......@@ -83,10 +71,7 @@ namespace BackupManager.BusinessLogic
/// </summary>
public DateTime Modified
{
get
{
return modified;
}
get => modified;
set
{
modified = value;
......@@ -98,10 +83,7 @@ namespace BackupManager.BusinessLogic
protected void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
\ No newline at end of file
......@@ -39,15 +39,9 @@ namespace BackupManager.BusinessLogic
/// </summary>
public string TargetLocation { get; set; }
private ObservableCollection<BackupItem> backupItems = new ObservableCollection<BackupItem>();
private readonly ObservableCollection<BackupItem> backupItems = new ObservableCollection<BackupItem>();
public ObservableCollection<BackupItem> BackupItems
{
get
{
return backupItems;
}
}
public ObservableCollection<BackupItem> BackupItems => backupItems;
/// <summary>
/// Loads Backup Items from a file
......
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BackupManager.BusinessLogic</RootNamespace>
<AssemblyName>BackupManagerLogic</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
......
using BackupManager.BackupProcessor;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace BackupManager.BusinessLogic
{
......@@ -32,21 +31,9 @@ namespace BackupManager.BusinessLogic
public BackupHandler BackupHandler { get; set; } = new BackupHandler();
public bool IsRunning
{
get
{
return BackupHandler.IsRunning;
}
}
public bool IsRunning => BackupHandler.IsRunning;
public bool IsCancelling
{
get
{
return BackupHandler.IsCancelling;
}
}
public bool IsCancelling => BackupHandler.IsCancelling;
/// <summary>
/// Start the backup process
......
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
......
using System;
using System.Collections.Generic;
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;
using System.Windows;
namespace BackupManager.UserInterface
{
......
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
</configuration>
......@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BackupManager.UserInterface</RootNamespace>
<AssemblyName>BackupManager</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
......
using BackupManager.UserInterface.ViewModels;
using System.Threading.Tasks;
using System.Windows;
namespace BackupManager.UserInterface
......
......@@ -86,11 +86,13 @@ namespace BackupManager
{
BackupViewModel backupViewModel = (BackupViewModel)DataContext;
BackupItem newBackupItem = new BackupItem();
newBackupItem.Created = DateTime.Now;
newBackupItem.Modified = DateTime.Now;
newBackupItem.Name = "";
newBackupItem.Location = "";
BackupItem newBackupItem = new BackupItem
{
Created = DateTime.Now,
Modified = DateTime.Now,
Name = "",
Location = ""
};
backupViewModel.BackupItems.Add(newBackupItem);
}
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Linq;
using System.Windows;
namespace BackupManager
......@@ -11,7 +7,7 @@ namespace BackupManager
{
public static bool IsWindowOpen<T>(string name = "") where T : Window
{
return String.IsNullOrEmpty(name)
return string.IsNullOrEmpty(name)
? Application.Current.Windows.OfType<T>().Any()
: Application.Current.Windows.OfType<T>().Any(w => w.Name.Equals(name));
}
......
......@@ -15,8 +15,10 @@ namespace BackupManager
{
InitializeComponent();
MainViewModel mainViewModel = new MainViewModel();
mainViewModel.BackupItemLibraryFileName = "";
MainViewModel mainViewModel = new MainViewModel
{
BackupItemLibraryFileName = ""
};
DataContext = mainViewModel;
mainViewModel.LoadSettings();
......
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
......
......@@ -19,7 +19,7 @@ namespace BackupManager.UserInterface.Properties {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
......
......@@ -12,7 +12,7 @@ namespace BackupManager.UserInterface.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.7.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
......
using BackupManager.UserInterface.ViewModels;
using System;
using System.Collections.Generic;
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 BackupManager.UserInterface
{
......
......@@ -3,8 +3,6 @@ using BackupManager.BusinessLogic;
using BackupManager.ViewModels;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
namespace BackupManager.UserInterface.ViewModels
{
......@@ -31,10 +29,7 @@ namespace BackupManager.UserInterface.ViewModels
public int CurrentMajorProgress
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMajorProgress;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMajorProgress;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMajorProgress = value;
......@@ -44,10 +39,7 @@ namespace BackupManager.UserInterface.ViewModels
public int MaximumMajorProgress
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMajorProgress;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMajorProgress;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMajorProgress = value;
......@@ -57,10 +49,7 @@ namespace BackupManager.UserInterface.ViewModels
public string MajorProgressText
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MajorProgressText;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MajorProgressText;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MajorProgressText = value;
......@@ -70,10 +59,7 @@ namespace BackupManager.UserInterface.ViewModels
public int CurrentMinorProgress
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMinorProgress;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMinorProgress;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.CurrentMinorProgress = value;
......@@ -83,10 +69,7 @@ namespace BackupManager.UserInterface.ViewModels
public int MaximumMinorProgress
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMinorProgress;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMinorProgress;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MaximumMinorProgress = value;
......@@ -96,10 +79,7 @@ namespace BackupManager.UserInterface.ViewModels
public string MinorProgressText
{
get
{
return BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MinorProgressText;
}
get => BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MinorProgressText;
set
{
BusinessLogic.BackupProcessor.GetInstance().BackupHandler.MinorProgressText = value;
......@@ -110,10 +90,7 @@ namespace BackupManager.UserInterface.ViewModels
private bool isCancelButtonEnabled = false;
public bool IsCancelButtonEnabled
{
get
{
return isCancelButtonEnabled;
}
get => isCancelButtonEnabled;
set
{
isCancelButtonEnabled = value;
......@@ -124,10 +101,7 @@ namespace BackupManager.UserInterface.ViewModels
private string cancelButtonText = "Cancel";
public string CancelButtonText
{
get
{
return cancelButtonText;
}
get => cancelButtonText;
set
{
cancelButtonText = value;
......
using BackupManager.BusinessLogic;
using System.Collections.ObjectModel;
using System;
using Ookii.Dialogs.Wpf;
using System.Windows.Media;
using System;
using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Media;
namespace BackupManager.ViewModels
{
......@@ -11,10 +11,7 @@ namespace BackupManager.ViewModels
{
public string BackupItemLibraryFileName
{
get
{
return BackupItemLibrary.GetInstance().FilePath;
}
get => BackupItemLibrary.GetInstance().FilePath;
set
{
BackupItemLibrary.GetInstance().FilePath = value;
......@@ -29,10 +26,7 @@ namespace BackupManager.ViewModels
public string TargetLocation
{
get
{
return BackupItemLibrary.GetInstance().TargetLocation;
}
get => BackupItemLibrary.GetInstance().TargetLocation;
set
{
BackupItemLibrary.GetInstance().TargetLocation = value;
......@@ -40,22 +34,13 @@ namespace BackupManager.ViewModels
}
}
public ObservableCollection<BackupItem> BackupItems
{
get
{
return BackupItemLibrary.GetInstance().BackupItems;
}
}
public ObservableCollection<BackupItem> BackupItems => BackupItemLibrary.GetInstance().BackupItems;
private BackupItem selectedBackupItem;
public BackupItem SelectedBackupItem
{
get
{
return selectedBackupItem;
}
get => selectedBackupItem;
set
{
selectedBackupItem = value;
......@@ -87,7 +72,7 @@ namespace BackupManager.ViewModels
internal void SaveBackupItemLibrary()
{
if (BackupItemLibraryFileName != String.Empty)
if (BackupItemLibraryFileName != string.Empty)
{
Exception e = BackupItemLibrary.GetInstance().SaveBackupItemLibraryToFile();
if (e != null)
......@@ -105,7 +90,7 @@ namespace BackupManager.ViewModels
{
VistaSaveFileDialog saveFileDialog = new VistaSaveFileDialog();
if (BackupItemLibraryFileName != String.Empty)
if (BackupItemLibraryFileName != string.Empty)
{
saveFileDialog.FileName = BackupItemLibraryFileName;
}
......
......@@ -11,10 +11,7 @@ namespace BackupManager.ViewModels
public string BackupItemLibraryFileName
{
get
{
return BackupItemLibrary.GetInstance().FilePath;
}
get => BackupItemLibrary.GetInstance().FilePath;
set
{
BackupItemLibrary.GetInstance().FilePath = value;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment