It is now possible to add a new backup using the wizard!

git-svn-id: https://duplicati.googlecode.com/svn/trunk@17 59da171f-624f-0410-aa54-27559c288bec
This commit is contained in:
kenneth.skovhede@gmail.com
2008-07-11 14:03:20 +00:00
parent 6665916b2a
commit 5a400a9765
30 changed files with 595 additions and 62 deletions
+4
View File
@@ -69,6 +69,10 @@ namespace Duplicati.Datamodel.Backends
env["FTP_PASSWORD"] = this.Password;
}
public string FriendlyName { get { return "FTP host"; } }
public string SystemName { get { return "ftp"; } }
public void SetService() { m_owner.Service = this.SystemName; }
#endregion
}
}
+4
View File
@@ -79,6 +79,10 @@ namespace Duplicati.Datamodel.Backends
args.Add(this.TimeSeparator);
}
public string FriendlyName { get { return "External drive or folder"; } }
public string SystemName { get { return "file"; } }
public void SetService() { m_owner.Service = this.SystemName; }
#endregion
}
}
+4
View File
@@ -28,5 +28,9 @@ namespace Duplicati.Datamodel.Backends
{
string GetDestinationPath();
void GetExtraSettings(List<string> args, StringDictionary env);
string FriendlyName { get; }
string SystemName { get; }
void SetService();
}
}
+4
View File
@@ -103,6 +103,10 @@ namespace Duplicati.Datamodel.Backends
env["AWS_ACCESS_KEY"] = this.AccessKey;
}
public string FriendlyName { get { return "Amazon S3"; } }
public string SystemName { get { return "s3"; } }
public void SetService() { m_owner.Service = this.SystemName; }
#endregion
}
}
+4
View File
@@ -106,6 +106,10 @@ namespace Duplicati.Datamodel.Backends
env["FTP_PASSWORD"] = this.Password;
}
public string FriendlyName { get { return "SSH host"; } }
public string SystemName { get { return "ssh"; } }
public void SetService() { m_owner.Service = this.SystemName; }
#endregion
}
}
+2
View File
@@ -53,6 +53,8 @@ namespace Duplicati.Datamodel
return new Backends.S3(this);
case "file":
return new Backends.File(this);
case "ftp":
return new Backends.FTP(this);
}
return null;
+10
View File
@@ -169,6 +169,12 @@
<Compile Include="Wizard pages\Add backup\SelectFiles.Designer.cs">
<DependentUpon>SelectFiles.cs</DependentUpon>
</Compile>
<Compile Include="Wizard pages\Add backup\SelectName.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Wizard pages\Add backup\SelectName.Designer.cs">
<DependentUpon>SelectName.cs</DependentUpon>
</Compile>
<Compile Include="Wizard pages\Add backup\SelectWhen.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -323,6 +329,10 @@
<SubType>Designer</SubType>
<DependentUpon>SelectFiles.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Wizard pages\Add backup\SelectName.resx">
<SubType>Designer</SubType>
<DependentUpon>SelectName.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Wizard pages\Add backup\SelectWhen.resx">
<SubType>Designer</SubType>
<DependentUpon>SelectWhen.cs</DependentUpon>
+45 -4
View File
@@ -39,7 +39,35 @@ namespace Duplicati.HelperControls
InitializeComponent();
}
public void Setup(IDataFetcher connection, bool allowEdit)
public string SelectedFolder
{
get
{
if (treeView.SelectedNode == null)
return "";
else
{
string s = treeView.SelectedNode.FullPath;
if (s == treeView.SelectedNode.Text)
return "";
else
return s.Substring(0, s.Length - treeView.SelectedNode.Text.Length - treeView.PathSeparator.Length);
}
}
set
{
TreeNode match;
FindNode(value, false, out match);
if (match != null)
match.TreeView.SelectedNode = match;
else
treeView.SelectedNode = null;
}
}
public void Setup(IDataFetcher connection, bool allowEdit, bool onlyFolders)
{
m_connection = connection;
m_allowEdit = allowEdit;
@@ -54,19 +82,32 @@ namespace Duplicati.HelperControls
t.ImageIndex = t.SelectedImageIndex = imageList.Images.IndexOfKey("Backup");
t.Tag = s;
TreeNodeCollection col;
if (string.IsNullOrEmpty(s.Path))
treeView.Nodes.Add(t);
col = treeView.Nodes;
else
FindNode(s.Path, true).Add(t);
col = FindNode(s.Path, true);
if (!onlyFolders)
col.Add(t);
}
treeView.LabelEdit = m_allowEdit;
}
private TreeNodeCollection FindNode(string path, bool allowCreate)
{
TreeNode dummy;
return FindNode(path, allowCreate, out dummy);
}
private TreeNodeCollection FindNode(string path, bool allowCreate, out TreeNode match)
{
TreeNodeCollection col = treeView.Nodes;
TreeNode match = null;
match = null;
if (string.IsNullOrEmpty(path))
return col;
foreach (string p in path.Split(treeView.PathSeparator[0]))
{
+15 -12
View File
@@ -55,6 +55,7 @@ namespace Duplicati
public static ServiceStatus StatusDialog;
public static ServiceSetup SetupDialog;
public static WizardHandler Wizard;
public static ApplicationSettings ApplicationSettings;
@@ -106,11 +107,11 @@ namespace Duplicati
TrayIcon.ContextMenuStrip.Items.Add("Status", new Bitmap(asm.GetManifestResourceStream(typeof(Program), "Icons.Status.ico")), new EventHandler(Status_Clicked));
TrayIcon.ContextMenuStrip.Items.Add("Setup", new Bitmap(asm.GetManifestResourceStream(typeof(Program), "Icons.Time.ico")), new EventHandler(Settings_Clicked));
TrayIcon.ContextMenuStrip.Items.Add("Setup", new Bitmap(asm.GetManifestResourceStream(typeof(Program), "Icons.Time.ico")), new EventHandler(Setup_Clicked));
TrayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator());
TrayIcon.ContextMenuStrip.Items.Add("Settings", new Bitmap(asm.GetManifestResourceStream(typeof(Program), "Icons.Settings.ico")), new EventHandler(Setup_Clicked));
TrayIcon.ContextMenuStrip.Items.Add("Settings", new Bitmap(asm.GetManifestResourceStream(typeof(Program), "Icons.Settings.ico")), new EventHandler(Settings_Clicked));
TrayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator());
@@ -176,13 +177,12 @@ namespace Duplicati
private static void Setup_Clicked(object sender, EventArgs e)
{
ShowSetup();
ShowWizard();
}
private static void TrayIcon_DoubleClick(object sender, EventArgs e)
{
//ShowStatus();
ShowWizard();
ShowStatus();
}
public static void ShowStatus()
@@ -194,7 +194,15 @@ namespace Duplicati
StatusDialog.Activate();
}
public static void ShowSettings()
public static void ShowWizard()
{
if (Wizard == null || Wizard.Visible)
Wizard = new WizardHandler();
Wizard.Show();
}
public static void ShowSetup()
{
if (SetupDialog == null || !SetupDialog.Visible)
SetupDialog = new ServiceSetup();
@@ -203,7 +211,7 @@ namespace Duplicati
SetupDialog.Activate();
}
public static void ShowSetup()
public static void ShowSettings()
{
lock (MainLock)
{
@@ -212,10 +220,5 @@ namespace Duplicati
}
}
public static void ShowWizard()
{
new WizardHandler().Show();
}
}
}
+8 -1
View File
@@ -100,7 +100,14 @@ namespace Duplicati
int i = 0;
while (start <= DateTime.Now && i++ < 50000)
start = Timeparser.ParseTimeInterval(sc.Repeat, start);
try
{
start = Timeparser.ParseTimeInterval(sc.Repeat, start);
}
catch
{
continue;
}
if (start < DateTime.Now)
continue;
+1 -1
View File
@@ -37,7 +37,7 @@ namespace Duplicati
InitializeComponent();
m_connection = new DataFetcherNested(Program.DataConnection);
backupTreeView.Setup(m_connection, true);
backupTreeView.Setup(m_connection, true, false);
backupTreeView.treeView.AfterSelect += new TreeViewEventHandler(treeView_AfterSelect);
backupTreeView.treeView.ContextMenuStrip = TreeMenuStrip;
}
+1 -1
View File
@@ -157,7 +157,7 @@ namespace Duplicati
recentBackups.Items.Clear();
foreach (Log l in logs)
{
ListViewItem lvi = new ListViewItem(new string[] { l.EndTime.ToString("g", System.Globalization.CultureInfo.CurrentUICulture), l.OwnerTask.Schedule.Name, l.TransferSizeString });
ListViewItem lvi = new ListViewItem(new string[] { l.EndTime.ToString("g", System.Globalization.CultureInfo.CurrentUICulture), l.OwnerTask == null ? "" : l.OwnerTask.Schedule.Name, l.TransferSizeString });
lvi.Tag = l;
lvi.ImageIndex = imageList.Images.ContainsKey(l.ParsedStatus) ? imageList.Images.IndexOfKey(l.ParsedStatus) : imageList.Images.IndexOfKey("Warning");
@@ -44,6 +44,7 @@ namespace Duplicati.Wizard_pages.Add_backup
//
// Summary
//
this.Summary.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Summary.Location = new System.Drawing.Point(24, 40);
this.Summary.Multiline = true;
this.Summary.Name = "Summary";
@@ -48,9 +48,39 @@ namespace Duplicati.Wizard_pages.Add_backup
void IWizardControl.Enter(IWizardForm owner)
{
Summary.Text =
"Action: Add new backup\r\n" +
"When: " + m_schedule.When.ToString() + "\r\n";
List<KeyValuePair<string, string>> strings = new List<KeyValuePair<string,string>>();
strings.Add(new KeyValuePair<string,string>("Action", "Add new backup"));
strings.Add(new KeyValuePair<string,string>("Source folder", m_schedule.Tasks[0].SourcePath));
strings.Add(new KeyValuePair<string,string>("When", m_schedule.When.ToString()));
if (!string.IsNullOrEmpty(m_schedule.Repeat))
strings.Add(new KeyValuePair<string,string>("Repeat", m_schedule.Repeat));
if (!string.IsNullOrEmpty(m_schedule.FullAfter))
strings.Add(new KeyValuePair<string,string>("Full backup each", m_schedule.FullAfter));
if (m_schedule.KeepFull > 0)
strings.Add(new KeyValuePair<string,string>("Keep full backups", m_schedule.KeepFull.ToString()));
if (m_schedule.Tasks != null && m_schedule.Tasks.Count == 1)
{
Duplicati.Datamodel.Backends.IBackend backend = m_schedule.Tasks[0].Backend;
strings.Add(new KeyValuePair<string, string>(null, null));
strings.Add(new KeyValuePair<string, string>("Destination", backend.FriendlyName));
strings.Add(new KeyValuePair<string, string>("Destination path", backend.GetDestinationPath()));
}
int maxlen = 0;
foreach(KeyValuePair<string, string> i in strings)
if (i.Key != null)
maxlen = Math.Max(maxlen, i.Key.Length);
System.Text.StringBuilder sb = new StringBuilder();
foreach (KeyValuePair<string, string> i in strings)
if (i.Key == null)
sb.Append("\r\n");
else
sb.Append(i.Key + ": " + new String(' ', maxlen - i.Key.Length) + i.Value + "\r\n");
Summary.Text = sb.ToString();
}
void IWizardControl.Leave(IWizardForm owner, ref bool cancel)
@@ -67,5 +97,6 @@ namespace Duplicati.Wizard_pages.Add_backup
}
#endregion
}
}
@@ -155,7 +155,7 @@ namespace Duplicati.Wizard_pages.Add_backup
if (m_schedule != null)
{
if (FullBackups.Checked)
m_schedule.Repeat = FullBackups.Text;
m_schedule.Repeat = FullDuration.Text;
else
m_schedule.Repeat = null;
@@ -124,7 +124,7 @@ namespace Duplicati.Wizard_pages.Add_backup
{
m_owner = owner;
if (m_schedule != null)
TargetFolder.Text = m_schedule.Path;
TargetFolder.Text = m_schedule.Tasks[0].SourcePath;
Rescan();
}
@@ -229,7 +229,7 @@ namespace Duplicati.Wizard_pages.Add_backup
m_calculator.AddTask(TargetFolder.Text);
}
m_schedule.Path = TargetFolder.Text;
m_schedule.Tasks[0].SourcePath = TargetFolder.Text;
}
#region IScheduleBased Members
+104
View File
@@ -0,0 +1,104 @@
namespace Duplicati.Wizard_pages.Add_backup
{
partial class SelectName
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.BackupFolder = new Duplicati.HelperControls.BackupTreeView();
this.label1 = new System.Windows.Forms.Label();
this.BackupName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// BackupFolder
//
this.BackupFolder.Location = new System.Drawing.Point(24, 80);
this.BackupFolder.Name = "BackupFolder";
this.BackupFolder.Size = new System.Drawing.Size(440, 120);
this.BackupFolder.TabIndex = 0;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(24, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(73, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Backup name";
//
// BackupName
//
this.BackupName.Location = new System.Drawing.Point(120, 16);
this.BackupName.Name = "BackupName";
this.BackupName.Size = new System.Drawing.Size(344, 20);
this.BackupName.TabIndex = 2;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(24, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(187, 13);
this.label2.TabIndex = 3;
this.label2.Text = "Place the backup in a group (optional)";
//
// button1
//
this.button1.Location = new System.Drawing.Point(344, 200);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(120, 24);
this.button1.TabIndex = 4;
this.button1.Text = "Add a group";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// SelectName
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.BackupName);
this.Controls.Add(this.label1);
this.Controls.Add(this.BackupFolder);
this.Name = "SelectName";
this.Size = new System.Drawing.Size(506, 242);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Duplicati.HelperControls.BackupTreeView BackupFolder;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox BackupName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button button1;
}
}
@@ -0,0 +1,108 @@
#region Disclaimer / License
// Copyright (C) 2008, Kenneth Skovhede
// http://www.hexad.dk, opensource@hexad.dk
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Windows.Forms.Wizard;
using Duplicati.Datamodel;
namespace Duplicati.Wizard_pages.Add_backup
{
public partial class SelectName : UserControl, IWizardControl, Interfaces.IScheduleBased
{
private Schedule m_schedule;
public SelectName()
{
InitializeComponent();
BackupFolder.treeView.HideSelection = false;
}
#region IWizardControl Members
Control IWizardControl.Control
{
get { return this; }
}
string IWizardControl.Title
{
get { return "Enter a name for the backup"; }
}
string IWizardControl.HelpText
{
get { return "On this page you can enter a name for the backup, so you can find and modify it later"; }
}
Image IWizardControl.Image
{
get { return null; }
}
bool IWizardControl.FullSize
{
get { return false; }
}
void IWizardControl.Enter(IWizardForm owner)
{
BackupName.Text = m_schedule.Name;
BackupFolder.SelectedFolder = (string.IsNullOrEmpty(m_schedule.Path) ? "" : m_schedule.Path + BackupFolder.treeView.PathSeparator) + m_schedule.Name;
}
void IWizardControl.Leave(IWizardForm owner, ref bool cancel)
{
if (BackupName.Text.Trim().Length <= 0)
{
MessageBox.Show(this, "You must enter a name for the backup", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
cancel = true;
return;
}
m_schedule.Name = BackupName.Text;
if (BackupFolder.treeView.SelectedNode != null)
m_schedule.Path = BackupFolder.SelectedFolder;
else
m_schedule.Path = "";
}
#endregion
#region IScheduleBased Members
public void Setup(Schedule schedule)
{
m_schedule = schedule;
BackupFolder.Setup(schedule.DataParent, true, true);
}
#endregion
private void button1_Click(object sender, EventArgs e)
{
BackupFolder.SelectedFolder = null;
BackupFolder.AddFolder(null);
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -99,6 +99,7 @@ namespace Duplicati.Wizard_pages.Backends.FTP
m_ftp.Username = Username.Text;
m_ftp.Password = Password.Text;
m_ftp.Port = (int)Port.Value;
m_ftp.SetService();
}
#endregion
@@ -123,6 +123,7 @@ namespace Duplicati.Wizard_pages.Backends.File
}
m_file.DestinationFolder = TargetFolder.Text;
if (UseCredentials.Checked)
{
m_file.Username = Username.Text;
@@ -133,6 +134,8 @@ namespace Duplicati.Wizard_pages.Backends.File
m_file.Username = null;
m_file.Password = null;
}
m_file.SetService();
}
#endregion
@@ -84,6 +84,7 @@ namespace Duplicati.Wizard_pages.Backends.S3
m_s3.ServerUrl = null;
m_s3.Prefix = null;
m_s3.UseEuroBucket = UseEuroBuckets.Checked;
m_s3.SetService();
}
@@ -108,6 +108,7 @@ namespace Duplicati.Wizard_pages.Backends.SSH
}
m_ssh.Port = (int)Port.Value;
m_ssh.SetService();
}
+40 -27
View File
@@ -30,9 +30,10 @@ namespace Duplicati.Wizard_pages
{
this.label1 = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.CreateNew = new System.Windows.Forms.RadioButton();
this.Edit = new System.Windows.Forms.RadioButton();
this.Restore = new System.Windows.Forms.RadioButton();
this.Edit = new System.Windows.Forms.RadioButton();
this.CreateNew = new System.Windows.Forms.RadioButton();
this.ShowAdvanced = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
@@ -52,33 +53,9 @@ namespace Duplicati.Wizard_pages
this.panel1.Controls.Add(this.CreateNew);
this.panel1.Location = new System.Drawing.Point(32, 32);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(440, 184);
this.panel1.Size = new System.Drawing.Size(440, 104);
this.panel1.TabIndex = 1;
//
// CreateNew
//
this.CreateNew.AutoSize = true;
this.CreateNew.Location = new System.Drawing.Point(0, 8);
this.CreateNew.Name = "CreateNew";
this.CreateNew.Size = new System.Drawing.Size(141, 17);
this.CreateNew.TabIndex = 0;
this.CreateNew.TabStop = true;
this.CreateNew.Text = "Schedule a new backup";
this.CreateNew.UseVisualStyleBackColor = true;
this.CreateNew.CheckedChanged += new System.EventHandler(this.Radio_CheckedChanged);
//
// Edit
//
this.Edit.AutoSize = true;
this.Edit.Location = new System.Drawing.Point(0, 40);
this.Edit.Name = "Edit";
this.Edit.Size = new System.Drawing.Size(185, 17);
this.Edit.TabIndex = 1;
this.Edit.TabStop = true;
this.Edit.Text = "Edit or remove an existing backup";
this.Edit.UseVisualStyleBackColor = true;
this.Edit.CheckedChanged += new System.EventHandler(this.Radio_CheckedChanged);
//
// Restore
//
this.Restore.AutoSize = true;
@@ -91,10 +68,45 @@ namespace Duplicati.Wizard_pages
this.Restore.UseVisualStyleBackColor = true;
this.Restore.CheckedChanged += new System.EventHandler(this.Radio_CheckedChanged);
//
// Edit
//
this.Edit.AutoSize = true;
this.Edit.Location = new System.Drawing.Point(0, 40);
this.Edit.Name = "Edit";
this.Edit.Size = new System.Drawing.Size(185, 17);
this.Edit.TabIndex = 1;
this.Edit.TabStop = true;
this.Edit.Text = "Edit or remove an existing backup";
this.Edit.UseVisualStyleBackColor = true;
this.Edit.CheckedChanged += new System.EventHandler(this.Radio_CheckedChanged);
//
// CreateNew
//
this.CreateNew.AutoSize = true;
this.CreateNew.Location = new System.Drawing.Point(0, 8);
this.CreateNew.Name = "CreateNew";
this.CreateNew.Size = new System.Drawing.Size(141, 17);
this.CreateNew.TabIndex = 0;
this.CreateNew.TabStop = true;
this.CreateNew.Text = "Schedule a new backup";
this.CreateNew.UseVisualStyleBackColor = true;
this.CreateNew.CheckedChanged += new System.EventHandler(this.Radio_CheckedChanged);
//
// ShowAdvanced
//
this.ShowAdvanced.Location = new System.Drawing.Point(32, 184);
this.ShowAdvanced.Name = "ShowAdvanced";
this.ShowAdvanced.Size = new System.Drawing.Size(104, 24);
this.ShowAdvanced.TabIndex = 2;
this.ShowAdvanced.Text = "Advanced setup";
this.ShowAdvanced.UseVisualStyleBackColor = true;
this.ShowAdvanced.Click += new System.EventHandler(this.ShowAdvanced_Click);
//
// MainPage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.ShowAdvanced);
this.Controls.Add(this.panel1);
this.Controls.Add(this.label1);
this.Name = "MainPage";
@@ -113,5 +125,6 @@ namespace Duplicati.Wizard_pages
private System.Windows.Forms.RadioButton Restore;
private System.Windows.Forms.RadioButton Edit;
private System.Windows.Forms.RadioButton CreateNew;
private System.Windows.Forms.Button ShowAdvanced;
}
}
+16
View File
@@ -76,10 +76,19 @@ namespace Duplicati.Wizard_pages
{
m_owner = owner;
UpdateButtonState();
this.Controls.Remove(ShowAdvanced);
m_owner.ButtonPanel.Controls.Add(ShowAdvanced);
ShowAdvanced.Top = m_owner.CancelButton.Top;
ShowAdvanced.Left = m_owner.ButtonPanel.Width - m_owner.CancelButton.Right;
ShowAdvanced.Visible = true;
}
void IWizardControl.Leave(IWizardForm owner, ref bool cancel)
{
m_owner.ButtonPanel.Controls.Remove(ShowAdvanced);
this.Controls.Add(ShowAdvanced);
ShowAdvanced.Visible = false;
}
#endregion
@@ -110,5 +119,12 @@ namespace Duplicati.Wizard_pages
}
}
private void ShowAdvanced_Click(object sender, EventArgs e)
{
Program.ShowSetup();
m_owner.Dialog.DialogResult = DialogResult.Cancel;
m_owner.Dialog.Close();
}
}
}
+42 -6
View File
@@ -16,6 +16,7 @@ namespace Duplicati
public enum Pages
{
MainAction,
Add_SelectName,
Add_SelectFiles,
Add_SelectWhen,
Add_Incremental,
@@ -29,11 +30,31 @@ namespace Duplicati
Add_Finished,
}
/// <summary>
/// The main wizard form
/// </summary>
IWizardForm m_form;
/// <summary>
/// The connection on which changes are made
/// </summary>
IDataFetcher m_connection;
/// <summary>
/// The item to be commited, for the add procedure
/// </summary>
Schedule m_addedItem;
/// <summary>
/// The item to be committed, for the edit procedure
/// </summary>
Schedule m_editItem;
/// <summary>
/// The page that produced the finish page, used to go back to it
/// </summary>
IWizardControl m_addFinishedPage = null;
public WizardHandler()
{
@@ -43,6 +64,7 @@ namespace Duplicati
m_form.Pages.Clear();
m_form.Pages.AddRange(new IWizardControl[] {
new Wizard_pages.MainPage(),
new Wizard_pages.Add_backup.SelectName(),
new Wizard_pages.Add_backup.SelectFiles(),
new Wizard_pages.Add_backup.SelectWhen(),
new Wizard_pages.Add_backup.IncrementalSettings(),
@@ -59,8 +81,21 @@ namespace Duplicati
m_form.DefaultImage = Program.NeutralIcon.ToBitmap();
m_form.BackPressed += new PageChangeHandler(m_form_BackPressed);
m_form.NextPressed += new PageChangeHandler(m_form_NextPressed);
m_form.Finished += new System.ComponentModel.CancelEventHandler(m_form_Finished);
}
void m_form_Finished(object sender, System.ComponentModel.CancelEventArgs e)
{
//TODO: Implement CommitRecursive
m_connection.CommitAll();
Program.DataConnection.CommitAll();
if ((m_form.CurrentPage as Duplicati.Wizard_pages.Add_backup.FinishedAdd).RunNow.Checked)
Program.WorkThread.AddTask(new FullBackupTask(m_addedItem));
}
public bool Visible { get { return m_form.Dialog.Visible; } }
void m_form_NextPressed(object sender, PageChangedArgs args)
{
switch ((Pages)m_form.Pages.IndexOf(m_form.CurrentPage))
@@ -69,7 +104,7 @@ namespace Duplicati
switch (((Wizard_pages.MainPage)m_form.CurrentPage).SelectedAction)
{
case Duplicati.Wizard_pages.MainPage.Action.Add:
args.NextPage = m_form.Pages[(int)Pages.Add_SelectFiles];
args.NextPage = m_form.Pages[(int)Pages.Add_SelectName];
if (m_addedItem == null || m_editItem != null)
{
@@ -127,11 +162,12 @@ namespace Duplicati
case Pages.Add_SSHOptions:
case Pages.Add_WebDAVOptions:
case Pages.Add_S3Options:
m_addFinishedPage = m_form.CurrentPage;
args.NextPage = m_form.Pages[(int)Pages.Add_Finished];
args.TreatAsLast = true;
break;
case Pages.Add_Finished:
SetupFinishPage(m_form.Pages[(int)Pages.Add_Finished] as Wizard_pages.Add_backup.FinishedAdd);
break;
@@ -152,6 +188,10 @@ namespace Duplicati
case Pages.Add_SelectFiles:
args.NextPage = m_form.Pages[(int)Pages.MainAction];
break;
case Pages.Add_Finished:
if (m_addFinishedPage != null)
args.NextPage = m_addFinishedPage;
break;
}
}
@@ -160,9 +200,5 @@ namespace Duplicati
(m_form as Form).ShowDialog();
}
private void SetupFinishPage(Wizard_pages.Add_backup.FinishedAdd page)
{
}
}
}
+1 -1
View File
@@ -143,7 +143,7 @@ namespace Duplicati
if (m_tasks.Count > 0)
m_currentTask = m_tasks.Dequeue();
if (m_currentTask == null)
if (m_currentTask == null && !m_terminate)
m_event.WaitOne();
if (m_terminate)
+3
View File
@@ -113,6 +113,7 @@ namespace System.Windows.Forms.Wizard
//
// _CancelButton
//
this._CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this._CancelButton.Location = new System.Drawing.Point(416, 16);
this._CancelButton.Name = "_CancelButton";
this._CancelButton.Size = new System.Drawing.Size(80, 24);
@@ -133,6 +134,7 @@ namespace System.Windows.Forms.Wizard
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this._CancelButton;
this.ClientSize = new System.Drawing.Size(506, 354);
this.Controls.Add(this._ButtonPanel);
this.Controls.Add(this._InfoPanel);
@@ -143,6 +145,7 @@ namespace System.Windows.Forms.Wizard
this.Name = "Dialog";
this.Text = "Dialog";
this.Load += new System.EventHandler(this.Dialog_Load);
this.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Dialog_KeyUp);
this._InfoPanel.ResumeLayout(false);
this._InfoPanel.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this._PageIcon)).EndInit();
+14 -2
View File
@@ -36,7 +36,7 @@ namespace System.Windows.Forms.Wizard
private bool m_isLastPage = false;
public event CancelEventHandler Finished;
public event EventHandler Cancelled;
public event CancelEventHandler Cancelled;
public event PageChangeHandler NextPressed;
public event PageChangeHandler BackPressed;
@@ -202,7 +202,12 @@ namespace System.Windows.Forms.Wizard
private void CancelBtn_Click(object sender, EventArgs e)
{
if (Cancelled != null)
Cancelled(this, null);
{
CancelEventArgs ce = new CancelEventArgs(false);
Cancelled(this, ce);
if (ce.Cancel)
return;
}
this.DialogResult = DialogResult.Cancel;
this.Close();
}
@@ -267,5 +272,12 @@ namespace System.Windows.Forms.Wizard
if (this.Pages.Count > 0)
this.CurrentPage = Pages[0];
}
private void Dialog_KeyUp(object sender, KeyEventArgs e)
{
//Setting the CancelButton property of the form does not allow canceling the event
if (e.KeyCode == Keys.Escape)
this.CancelBtn_Click(null, null);
}
}
}
+1 -1
View File
@@ -63,6 +63,6 @@ namespace System.Windows.Forms.Wizard
event PageChangeHandler NextPressed;
event PageChangeHandler BackPressed;
event CancelEventHandler Finished;
event EventHandler Cancelled;
event CancelEventHandler Cancelled;
}
}