Procházet zdrojové kódy

添加了备份计划UI和执行逻辑

zoule před 10 měsíci
rodič
revize
cedcaefd9f

+ 9 - 0
DbBackup/DbBackup.csproj

@@ -58,6 +58,7 @@
     <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
     </Reference>
+    <Reference Include="PresentationCore" />
     <Reference Include="Serilog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
       <HintPath>..\packages\Serilog.4.0.0\lib\net471\Serilog.dll</HintPath>
     </Reference>
@@ -89,6 +90,7 @@
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
+    <Reference Include="System.Runtime.Remoting" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
     <Reference Include="System.Security" />
@@ -99,6 +101,8 @@
       <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
     </Reference>
     <Reference Include="System.Transactions" />
+    <Reference Include="System.Windows.Input.Manipulations" />
+    <Reference Include="System.Xaml" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
@@ -107,6 +111,10 @@
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
+    <Reference Include="UIAutomationClient" />
+    <Reference Include="UIAutomationProvider" />
+    <Reference Include="UIAutomationTypes" />
+    <Reference Include="WindowsBase" />
   </ItemGroup>
   <ItemGroup>
     <Compile Include="DxHelper\MsgBoxHelper.cs" />
@@ -151,6 +159,7 @@
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ViewModel\LogInfo.cs" />
+    <Compile Include="ViewModel\PlanInfo.cs" />
     <EmbeddedResource Include="ExtensionsDev\PopupControlDocker.resx">
       <DependentUpon>PopupControlDocker.cs</DependentUpon>
     </EmbeddedResource>

+ 15 - 0
DbBackup/DxHelper/SvgHelper.cs

@@ -484,6 +484,21 @@ namespace DxHelper
             ms.Dispose();
             return svg;
         }
+        /// <summary>
+        /// 查看检测结果
+        /// </summary>
+        /// <returns></returns>
+        public static SvgImage CreateOpenDir(string color = "#FFB115", int width = 24, int height = 24)
+        {
+            string xml = $"<svg xmlns='http://www.w3.org/2000/svg\' width='{width}px' height='{height}px' viewBox='0 0 32 32'>"
+                        + $"<path opacity='0.75' fill='{color}' d='M2.2,25.2l5.5-12c0.3-0.7,1-1.2,1.8-1.2H26V9c0-0.6-0.4-1-1-1H12V5c0-0.6-0.4-1-1-1H3C2.4,4,2,4.4,2,5v20c0,0.2,0,0.3,0.1,0.4C2.1,25.3,2.2,25.3,2.2,25.2z'/>"
+                        + $"<path fill='{color}' d='M31.3,14H9.6L4,26h21.8c0.5,0,1.1-0.3,1.3-0.7L32,14.7C32.1,14.3,31.8,14,31.3,14z'/>"
+                        + "</svg>";
+            MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(xml));
+            var svg = SvgLoader.LoadFromStream(ms);
+            ms.Dispose();
+            return svg;
+        }
 
         /// <summary>
         /// 手动定位

+ 533 - 143
DbBackup/Form1.Designer.cs

@@ -34,8 +34,18 @@
             DevExpress.Utils.ToolTipItem toolTipItem2 = new DevExpress.Utils.ToolTipItem();
             DevExpress.Utils.SuperToolTip superToolTip3 = new DevExpress.Utils.SuperToolTip();
             DevExpress.Utils.ToolTipItem toolTipItem3 = new DevExpress.Utils.ToolTipItem();
+            DevExpress.Utils.SuperToolTip superToolTip4 = new DevExpress.Utils.SuperToolTip();
+            DevExpress.Utils.ToolTipItem toolTipItem4 = new DevExpress.Utils.ToolTipItem();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
             this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
+            this.btnStop = new DevExpress.XtraEditors.SimpleButton();
+            this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
+            this.txtAllExeTime = new DevExpress.XtraEditors.DateEdit();
+            this.labelControl3 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
+            this.txtMonthDays = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
+            this.btnStart = new DevExpress.XtraEditors.SimpleButton();
             this.txtAllFile = new DevExpress.XtraEditors.ButtonEdit();
             this.txtBackupAll = new DevExpress.XtraEditors.CheckEdit();
             this.txtBackupIncrement = new DevExpress.XtraEditors.CheckEdit();
@@ -54,8 +64,30 @@
             this.btnOpenDir = new DevExpress.XtraEditors.SimpleButton();
             this.txtDataFile = new DevExpress.XtraEditors.ButtonEdit();
             this.txtSysPwd = new DevExpress.XtraEditors.TextEdit();
+            this.btnConnectTest1 = new DevExpress.XtraEditors.SimpleButton();
+            this.btnConnectTest2 = new DevExpress.XtraEditors.SimpleButton();
+            this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
+            this.txtIncExeTime = new DevExpress.XtraEditors.DateEdit();
+            this.labelControl31 = new DevExpress.XtraEditors.LabelControl();
+            this.labelControl22 = new DevExpress.XtraEditors.LabelControl();
+            this.txtWeekDays = new DevExpress.XtraEditors.ComboBoxEdit();
+            this.labelControl12 = new DevExpress.XtraEditors.LabelControl();
+            this.txtDbAddr3 = new DevExpress.XtraEditors.TextEdit();
+            this.txtUser3 = new DevExpress.XtraEditors.TextEdit();
+            this.txtPwd3 = new DevExpress.XtraEditors.TextEdit();
+            this.txtService3 = new DevExpress.XtraEditors.TextEdit();
             this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
             this.tabbedControlGroup1 = new DevExpress.XtraLayout.TabbedControlGroup();
+            this.layoutControlGroup5 = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.itemStartStop = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem20 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem18 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem19 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem21 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem22 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem23 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem24 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
             this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -63,12 +95,11 @@
             this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
             this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
-            this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup();
-            this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem13 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem14 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem15 = new DevExpress.XtraLayout.LayoutControlItem();
             this.itemAllFile = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlItem17 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlGroup3 = new DevExpress.XtraLayout.LayoutControlGroup();
             this.layoutControlItem7 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem8 = new DevExpress.XtraLayout.LayoutControlItem();
@@ -77,16 +108,16 @@
             this.layoutControlItem11 = new DevExpress.XtraLayout.LayoutControlItem();
             this.itemAllFile1 = new DevExpress.XtraLayout.LayoutControlItem();
             this.layoutControlItem16 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.layoutControlGroup5 = new DevExpress.XtraLayout.LayoutControlGroup();
-            this.btnConnectTest1 = new DevExpress.XtraEditors.SimpleButton();
-            this.layoutControlItem17 = new DevExpress.XtraLayout.LayoutControlItem();
-            this.simpleLabelItem2 = new DevExpress.XtraLayout.SimpleLabelItem();
-            this.simpleLabelItem3 = new DevExpress.XtraLayout.SimpleLabelItem();
-            this.emptySpaceItem2 = new DevExpress.XtraLayout.EmptySpaceItem();
-            this.btnConnectTest2 = new DevExpress.XtraEditors.SimpleButton();
             this.layoutControlItem12 = new DevExpress.XtraLayout.LayoutControlItem();
+            this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup();
+            this.layoutControlItem6 = new DevExpress.XtraLayout.LayoutControlItem();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
             this.layoutControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
+            this.panelControl1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.txtAllExeTime.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtAllExeTime.Properties.CalendarTimeProperties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtMonthDays.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtAllFile.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtBackupAll.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtBackupIncrement.Properties)).BeginInit();
@@ -102,8 +133,27 @@
             ((System.ComponentModel.ISupportInitialize)(this.txtService2.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtDataFile.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtSysPwd.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.panelControl2)).BeginInit();
+            this.panelControl2.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.txtIncExeTime.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtIncExeTime.Properties.CalendarTimeProperties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWeekDays.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtDbAddr3.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtUser3.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtPwd3.Properties)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtService3.Properties)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.tabbedControlGroup1)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup5)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.itemStartStop)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem18)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem22)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem23)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem24)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
@@ -111,12 +161,11 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem15)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemAllFile)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).BeginInit();
@@ -125,16 +174,16 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem11)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemAllFile1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup5)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem2)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem3)).BeginInit();
-            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).BeginInit();
             this.SuspendLayout();
             // 
             // layoutControl1
             // 
+            this.layoutControl1.Controls.Add(this.btnStop);
+            this.layoutControl1.Controls.Add(this.panelControl1);
+            this.layoutControl1.Controls.Add(this.btnStart);
             this.layoutControl1.Controls.Add(this.txtAllFile);
             this.layoutControl1.Controls.Add(this.txtBackupAll);
             this.layoutControl1.Controls.Add(this.txtBackupIncrement);
@@ -154,6 +203,11 @@
             this.layoutControl1.Controls.Add(this.txtSysPwd);
             this.layoutControl1.Controls.Add(this.btnConnectTest1);
             this.layoutControl1.Controls.Add(this.btnConnectTest2);
+            this.layoutControl1.Controls.Add(this.panelControl2);
+            this.layoutControl1.Controls.Add(this.txtDbAddr3);
+            this.layoutControl1.Controls.Add(this.txtUser3);
+            this.layoutControl1.Controls.Add(this.txtPwd3);
+            this.layoutControl1.Controls.Add(this.txtService3);
             this.layoutControl1.Dock = System.Windows.Forms.DockStyle.Fill;
             this.layoutControl1.Location = new System.Drawing.Point(0, 0);
             this.layoutControl1.Name = "layoutControl1";
@@ -163,6 +217,92 @@
             this.layoutControl1.TabIndex = 0;
             this.layoutControl1.Text = "layoutControl1";
             // 
+            // btnStop
+            // 
+            this.btnStop.Enabled = false;
+            this.btnStop.Location = new System.Drawing.Point(118, 452);
+            this.btnStop.Name = "btnStop";
+            this.btnStop.Size = new System.Drawing.Size(93, 23);
+            this.btnStop.StyleController = this.layoutControl1;
+            this.btnStop.TabIndex = 16;
+            this.btnStop.Text = "停止备份计划";
+            this.btnStop.Click += new System.EventHandler(this.btnStop_Click);
+            // 
+            // panelControl1
+            // 
+            this.panelControl1.Controls.Add(this.txtAllExeTime);
+            this.panelControl1.Controls.Add(this.labelControl3);
+            this.panelControl1.Controls.Add(this.labelControl2);
+            this.panelControl1.Controls.Add(this.txtMonthDays);
+            this.panelControl1.Controls.Add(this.labelControl1);
+            this.panelControl1.Location = new System.Drawing.Point(15, 279);
+            this.panelControl1.Name = "panelControl1";
+            this.panelControl1.Size = new System.Drawing.Size(196, 76);
+            this.panelControl1.TabIndex = 15;
+            // 
+            // txtAllExeTime
+            // 
+            this.txtAllExeTime.EditValue = null;
+            this.txtAllExeTime.Location = new System.Drawing.Point(50, 46);
+            this.txtAllExeTime.Name = "txtAllExeTime";
+            this.txtAllExeTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtAllExeTime.Properties.CalendarDateEditing = false;
+            this.txtAllExeTime.Properties.CalendarTimeEditing = DevExpress.Utils.DefaultBoolean.True;
+            this.txtAllExeTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtAllExeTime.Properties.DisplayFormat.FormatString = "HH:mm";
+            this.txtAllExeTime.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
+            this.txtAllExeTime.Properties.EditFormat.FormatString = "HH:mm";
+            this.txtAllExeTime.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
+            this.txtAllExeTime.Properties.MaskSettings.Set("mask", "HH:mm");
+            this.txtAllExeTime.Size = new System.Drawing.Size(118, 20);
+            this.txtAllExeTime.TabIndex = 4;
+            // 
+            // labelControl3
+            // 
+            this.labelControl3.Location = new System.Drawing.Point(20, 49);
+            this.labelControl3.Name = "labelControl3";
+            this.labelControl3.Size = new System.Drawing.Size(24, 14);
+            this.labelControl3.TabIndex = 3;
+            this.labelControl3.Text = "时间";
+            // 
+            // labelControl2
+            // 
+            this.labelControl2.Location = new System.Drawing.Point(108, 19);
+            this.labelControl2.Name = "labelControl2";
+            this.labelControl2.Size = new System.Drawing.Size(60, 14);
+            this.labelControl2.TabIndex = 3;
+            this.labelControl2.Text = "号全量备份";
+            // 
+            // txtMonthDays
+            // 
+            this.txtMonthDays.Location = new System.Drawing.Point(50, 16);
+            this.txtMonthDays.Name = "txtMonthDays";
+            this.txtMonthDays.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtMonthDays.Size = new System.Drawing.Size(52, 20);
+            this.txtMonthDays.TabIndex = 2;
+            this.txtMonthDays.ToolTip = "如果月份没有选择的号数,则会在最后一天执行备份";
+            // 
+            // labelControl1
+            // 
+            this.labelControl1.Location = new System.Drawing.Point(20, 19);
+            this.labelControl1.Name = "labelControl1";
+            this.labelControl1.Size = new System.Drawing.Size(24, 14);
+            this.labelControl1.TabIndex = 1;
+            this.labelControl1.Text = "每月";
+            // 
+            // btnStart
+            // 
+            this.btnStart.Location = new System.Drawing.Point(15, 452);
+            this.btnStart.Name = "btnStart";
+            this.btnStart.Size = new System.Drawing.Size(93, 23);
+            this.btnStart.StyleController = this.layoutControl1;
+            this.btnStart.TabIndex = 14;
+            this.btnStart.Text = "启动备份计划";
+            this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
+            // 
             // txtAllFile
             // 
             this.txtAllFile.Location = new System.Drawing.Point(15, 294);
@@ -176,10 +316,10 @@
             // 
             // txtBackupAll
             // 
-            this.txtBackupAll.Location = new System.Drawing.Point(90, 243);
+            this.txtBackupAll.Location = new System.Drawing.Point(115, 243);
             this.txtBackupAll.Name = "txtBackupAll";
             this.txtBackupAll.Properties.Caption = "全量备份";
-            this.txtBackupAll.Size = new System.Drawing.Size(121, 20);
+            this.txtBackupAll.Size = new System.Drawing.Size(96, 20);
             this.txtBackupAll.StyleController = this.layoutControl1;
             this.txtBackupAll.TabIndex = 11;
             this.txtBackupAll.CheckedChanged += new System.EventHandler(this.txtBackupAll_CheckedChanged);
@@ -190,7 +330,7 @@
             this.txtBackupIncrement.Location = new System.Drawing.Point(15, 243);
             this.txtBackupIncrement.Name = "txtBackupIncrement";
             this.txtBackupIncrement.Properties.Caption = "增量备份";
-            this.txtBackupIncrement.Size = new System.Drawing.Size(71, 20);
+            this.txtBackupIncrement.Size = new System.Drawing.Size(96, 20);
             this.txtBackupIncrement.StyleController = this.layoutControl1;
             this.txtBackupIncrement.TabIndex = 10;
             this.txtBackupIncrement.CheckedChanged += new System.EventHandler(this.txtBackupIncrement_CheckedChanged);
@@ -340,6 +480,129 @@
             this.txtSysPwd.StyleController = this.layoutControl1;
             this.txtSysPwd.TabIndex = 6;
             // 
+            // btnConnectTest1
+            // 
+            this.btnConnectTest1.Location = new System.Drawing.Point(15, 338);
+            this.btnConnectTest1.Name = "btnConnectTest1";
+            this.btnConnectTest1.Size = new System.Drawing.Size(186, 22);
+            this.btnConnectTest1.StyleController = this.layoutControl1;
+            this.btnConnectTest1.TabIndex = 9;
+            this.btnConnectTest1.Text = "测试连接";
+            this.btnConnectTest1.Click += new System.EventHandler(this.btnConnectTest1_Click);
+            // 
+            // btnConnectTest2
+            // 
+            this.btnConnectTest2.Location = new System.Drawing.Point(15, 355);
+            this.btnConnectTest2.Name = "btnConnectTest2";
+            this.btnConnectTest2.Size = new System.Drawing.Size(186, 22);
+            this.btnConnectTest2.StyleController = this.layoutControl1;
+            this.btnConnectTest2.TabIndex = 9;
+            this.btnConnectTest2.Text = "测试连接";
+            this.btnConnectTest2.Click += new System.EventHandler(this.btnConnectTest2_Click);
+            // 
+            // panelControl2
+            // 
+            this.panelControl2.Controls.Add(this.txtIncExeTime);
+            this.panelControl2.Controls.Add(this.labelControl31);
+            this.panelControl2.Controls.Add(this.labelControl22);
+            this.panelControl2.Controls.Add(this.txtWeekDays);
+            this.panelControl2.Controls.Add(this.labelControl12);
+            this.panelControl2.Location = new System.Drawing.Point(15, 359);
+            this.panelControl2.Name = "panelControl2";
+            this.panelControl2.Size = new System.Drawing.Size(196, 76);
+            this.panelControl2.TabIndex = 15;
+            // 
+            // txtIncExeTime
+            // 
+            this.txtIncExeTime.EditValue = null;
+            this.txtIncExeTime.Location = new System.Drawing.Point(50, 42);
+            this.txtIncExeTime.Name = "txtIncExeTime";
+            this.txtIncExeTime.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtIncExeTime.Properties.CalendarDateEditing = false;
+            this.txtIncExeTime.Properties.CalendarTimeEditing = DevExpress.Utils.DefaultBoolean.True;
+            this.txtIncExeTime.Properties.CalendarTimeProperties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtIncExeTime.Properties.DisplayFormat.FormatString = "HH:mm";
+            this.txtIncExeTime.Properties.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
+            this.txtIncExeTime.Properties.EditFormat.FormatString = "HH:mm";
+            this.txtIncExeTime.Properties.EditFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
+            this.txtIncExeTime.Properties.MaskSettings.Set("mask", "HH:mm");
+            this.txtIncExeTime.Size = new System.Drawing.Size(118, 20);
+            this.txtIncExeTime.TabIndex = 4;
+            // 
+            // labelControl31
+            // 
+            this.labelControl31.Location = new System.Drawing.Point(20, 45);
+            this.labelControl31.Name = "labelControl31";
+            this.labelControl31.Size = new System.Drawing.Size(24, 14);
+            this.labelControl31.TabIndex = 3;
+            this.labelControl31.Text = "时间";
+            // 
+            // labelControl22
+            // 
+            this.labelControl22.Location = new System.Drawing.Point(108, 15);
+            this.labelControl22.Name = "labelControl22";
+            this.labelControl22.Size = new System.Drawing.Size(48, 14);
+            this.labelControl22.TabIndex = 3;
+            this.labelControl22.Text = "增量备份";
+            // 
+            // txtWeekDays
+            // 
+            this.txtWeekDays.Location = new System.Drawing.Point(50, 12);
+            this.txtWeekDays.Name = "txtWeekDays";
+            this.txtWeekDays.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
+            new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
+            this.txtWeekDays.Size = new System.Drawing.Size(52, 20);
+            this.txtWeekDays.TabIndex = 2;
+            // 
+            // labelControl12
+            // 
+            this.labelControl12.Location = new System.Drawing.Point(20, 15);
+            this.labelControl12.Name = "labelControl12";
+            this.labelControl12.Size = new System.Drawing.Size(24, 14);
+            this.labelControl12.TabIndex = 1;
+            this.labelControl12.Text = "每周";
+            // 
+            // txtDbAddr3
+            // 
+            this.txtDbAddr3.EditValue = "127.0.0.1:1521";
+            this.txtDbAddr3.Location = new System.Drawing.Point(15, 66);
+            this.txtDbAddr3.Name = "txtDbAddr3";
+            this.txtDbAddr3.Properties.NullValuePrompt = "127.0.0.1:1521";
+            this.txtDbAddr3.Size = new System.Drawing.Size(186, 20);
+            this.txtDbAddr3.StyleController = this.layoutControl1;
+            this.txtDbAddr3.TabIndex = 4;
+            // 
+            // txtUser3
+            // 
+            this.txtUser3.Location = new System.Drawing.Point(15, 126);
+            this.txtUser3.Name = "txtUser3";
+            this.txtUser3.Size = new System.Drawing.Size(186, 20);
+            this.txtUser3.StyleController = this.layoutControl1;
+            toolTipItem4.Text = "不区分大小写";
+            superToolTip4.Items.Add(toolTipItem4);
+            this.txtUser3.SuperTip = superToolTip4;
+            this.txtUser3.TabIndex = 5;
+            // 
+            // txtPwd3
+            // 
+            this.txtPwd3.Location = new System.Drawing.Point(15, 186);
+            this.txtPwd3.Name = "txtPwd3";
+            this.txtPwd3.Size = new System.Drawing.Size(186, 20);
+            this.txtPwd3.StyleController = this.layoutControl1;
+            this.txtPwd3.TabIndex = 6;
+            // 
+            // txtService3
+            // 
+            this.txtService3.EditValue = "orcl";
+            this.txtService3.Location = new System.Drawing.Point(15, 246);
+            this.txtService3.Name = "txtService3";
+            this.txtService3.Properties.NullValuePrompt = "orcl";
+            this.txtService3.Size = new System.Drawing.Size(186, 20);
+            this.txtService3.StyleController = this.layoutControl1;
+            this.txtService3.TabIndex = 7;
+            // 
             // Root
             // 
             this.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.True;
@@ -356,13 +619,157 @@
             this.tabbedControlGroup1.Location = new System.Drawing.Point(0, 0);
             this.tabbedControlGroup1.Name = "tabbedControlGroup1";
             this.tabbedControlGroup1.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.tabbedControlGroup1.SelectedTabPage = this.layoutControlGroup3;
+            this.tabbedControlGroup1.SelectedTabPage = this.layoutControlGroup5;
             this.tabbedControlGroup1.Size = new System.Drawing.Size(206, 538);
             this.tabbedControlGroup1.TabPages.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
             this.layoutControlGroup1,
             this.layoutControlGroup3,
             this.layoutControlGroup5});
             // 
+            // layoutControlGroup5
+            // 
+            this.layoutControlGroup5.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.itemStartStop,
+            this.layoutControlItem20,
+            this.layoutControlItem18,
+            this.layoutControlItem19,
+            this.layoutControlItem21,
+            this.layoutControlItem22,
+            this.layoutControlItem23,
+            this.layoutControlItem24,
+            this.emptySpaceItem2});
+            this.layoutControlGroup5.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlGroup5.Name = "layoutControlGroup5";
+            this.layoutControlGroup5.Size = new System.Drawing.Size(200, 508);
+            this.layoutControlGroup5.Text = "  计划  ";
+            // 
+            // itemStartStop
+            // 
+            this.itemStartStop.Control = this.btnStart;
+            this.itemStartStop.Location = new System.Drawing.Point(0, 400);
+            this.itemStartStop.MaxSize = new System.Drawing.Size(0, 40);
+            this.itemStartStop.MinSize = new System.Drawing.Size(86, 40);
+            this.itemStartStop.Name = "itemStartStop";
+            this.itemStartStop.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 5, 15, 2);
+            this.itemStartStop.Size = new System.Drawing.Size(100, 40);
+            this.itemStartStop.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.itemStartStop.TextSize = new System.Drawing.Size(0, 0);
+            this.itemStartStop.TextVisible = false;
+            // 
+            // layoutControlItem20
+            // 
+            this.layoutControlItem20.Control = this.panelControl1;
+            this.layoutControlItem20.Location = new System.Drawing.Point(0, 240);
+            this.layoutControlItem20.MaxSize = new System.Drawing.Size(0, 80);
+            this.layoutControlItem20.MinSize = new System.Drawing.Size(5, 80);
+            this.layoutControlItem20.Name = "layoutControlItem20";
+            this.layoutControlItem20.Size = new System.Drawing.Size(200, 80);
+            this.layoutControlItem20.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem20.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem20.TextVisible = false;
+            // 
+            // layoutControlItem18
+            // 
+            this.layoutControlItem18.Control = this.panelControl2;
+            this.layoutControlItem18.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem18.CustomizationFormText = "layoutControlItem20";
+            this.layoutControlItem18.Location = new System.Drawing.Point(0, 320);
+            this.layoutControlItem18.MaxSize = new System.Drawing.Size(0, 80);
+            this.layoutControlItem18.MinSize = new System.Drawing.Size(5, 80);
+            this.layoutControlItem18.Name = "layoutControlItem18";
+            this.layoutControlItem18.Size = new System.Drawing.Size(200, 80);
+            this.layoutControlItem18.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem18.Text = "layoutControlItem20";
+            this.layoutControlItem18.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem18.TextVisible = false;
+            // 
+            // layoutControlItem19
+            // 
+            this.layoutControlItem19.Control = this.btnStop;
+            this.layoutControlItem19.Location = new System.Drawing.Point(100, 400);
+            this.layoutControlItem19.MaxSize = new System.Drawing.Size(0, 40);
+            this.layoutControlItem19.MinSize = new System.Drawing.Size(86, 40);
+            this.layoutControlItem19.Name = "layoutControlItem19";
+            this.layoutControlItem19.Padding = new DevExpress.XtraLayout.Utils.Padding(5, 2, 15, 2);
+            this.layoutControlItem19.Size = new System.Drawing.Size(100, 40);
+            this.layoutControlItem19.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem19.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem19.TextVisible = false;
+            // 
+            // layoutControlItem21
+            // 
+            this.layoutControlItem21.Control = this.txtDbAddr3;
+            this.layoutControlItem21.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem21.CustomizationFormText = "数据库地址";
+            this.layoutControlItem21.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlItem21.MaxSize = new System.Drawing.Size(0, 60);
+            this.layoutControlItem21.MinSize = new System.Drawing.Size(84, 60);
+            this.layoutControlItem21.Name = "layoutControlItem21";
+            this.layoutControlItem21.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 12, 2);
+            this.layoutControlItem21.Size = new System.Drawing.Size(200, 60);
+            this.layoutControlItem21.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem21.Text = "数据库地址";
+            this.layoutControlItem21.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem21.TextSize = new System.Drawing.Size(70, 14);
+            // 
+            // layoutControlItem22
+            // 
+            this.layoutControlItem22.Control = this.txtUser3;
+            this.layoutControlItem22.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem22.CustomizationFormText = "用户名";
+            this.layoutControlItem22.Location = new System.Drawing.Point(0, 60);
+            this.layoutControlItem22.MaxSize = new System.Drawing.Size(0, 60);
+            this.layoutControlItem22.MinSize = new System.Drawing.Size(84, 60);
+            this.layoutControlItem22.Name = "layoutControlItem22";
+            this.layoutControlItem22.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 12, 2);
+            this.layoutControlItem22.Size = new System.Drawing.Size(200, 60);
+            this.layoutControlItem22.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem22.Text = "用户名";
+            this.layoutControlItem22.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem22.TextSize = new System.Drawing.Size(70, 14);
+            // 
+            // layoutControlItem23
+            // 
+            this.layoutControlItem23.Control = this.txtPwd3;
+            this.layoutControlItem23.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem23.CustomizationFormText = "密码";
+            this.layoutControlItem23.Location = new System.Drawing.Point(0, 120);
+            this.layoutControlItem23.MaxSize = new System.Drawing.Size(0, 60);
+            this.layoutControlItem23.MinSize = new System.Drawing.Size(84, 60);
+            this.layoutControlItem23.Name = "layoutControlItem23";
+            this.layoutControlItem23.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 12, 2);
+            this.layoutControlItem23.Size = new System.Drawing.Size(200, 60);
+            this.layoutControlItem23.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem23.Text = "密码";
+            this.layoutControlItem23.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem23.TextSize = new System.Drawing.Size(70, 14);
+            // 
+            // layoutControlItem24
+            // 
+            this.layoutControlItem24.Control = this.txtService3;
+            this.layoutControlItem24.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem24.CustomizationFormText = "服务名";
+            this.layoutControlItem24.Location = new System.Drawing.Point(0, 180);
+            this.layoutControlItem24.MaxSize = new System.Drawing.Size(200, 60);
+            this.layoutControlItem24.MinSize = new System.Drawing.Size(200, 60);
+            this.layoutControlItem24.Name = "layoutControlItem24";
+            this.layoutControlItem24.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 12, 2);
+            this.layoutControlItem24.Size = new System.Drawing.Size(200, 60);
+            this.layoutControlItem24.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem24.Text = "服务名";
+            this.layoutControlItem24.TextLocation = DevExpress.Utils.Locations.Top;
+            this.layoutControlItem24.TextSize = new System.Drawing.Size(70, 14);
+            // 
+            // emptySpaceItem2
+            // 
+            this.emptySpaceItem2.AllowHotTrack = false;
+            this.emptySpaceItem2.Location = new System.Drawing.Point(0, 440);
+            this.emptySpaceItem2.MinSize = new System.Drawing.Size(104, 24);
+            this.emptySpaceItem2.Name = "emptySpaceItem2";
+            this.emptySpaceItem2.Size = new System.Drawing.Size(200, 68);
+            this.emptySpaceItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
+            // 
             // layoutControlGroup1
             // 
             this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
@@ -396,7 +803,7 @@
             this.layoutControlItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem1.Text = "数据库地址";
             this.layoutControlItem1.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem1.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem1.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem2
             // 
@@ -410,7 +817,7 @@
             this.layoutControlItem2.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem2.Text = "用户名";
             this.layoutControlItem2.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem2.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem2.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem3
             // 
@@ -424,7 +831,7 @@
             this.layoutControlItem3.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem3.Text = "密码";
             this.layoutControlItem3.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem3.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem3.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem4
             // 
@@ -438,7 +845,7 @@
             this.layoutControlItem4.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem4.Text = "服务名";
             this.layoutControlItem4.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem4.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem4.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem5
             // 
@@ -465,26 +872,6 @@
             this.emptySpaceItem1.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
             // 
-            // layoutControlGroup2
-            // 
-            this.layoutControlGroup2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
-            this.layoutControlItem6});
-            this.layoutControlGroup2.Location = new System.Drawing.Point(206, 0);
-            this.layoutControlGroup2.Name = "layoutControlGroup2";
-            this.layoutControlGroup2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlGroup2.Size = new System.Drawing.Size(722, 538);
-            this.layoutControlGroup2.Text = "日志信息";
-            // 
-            // layoutControlItem6
-            // 
-            this.layoutControlItem6.Control = this.gcLog;
-            this.layoutControlItem6.Location = new System.Drawing.Point(0, 0);
-            this.layoutControlItem6.Name = "layoutControlItem6";
-            this.layoutControlItem6.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
-            this.layoutControlItem6.Size = new System.Drawing.Size(716, 511);
-            this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0);
-            this.layoutControlItem6.TextVisible = false;
-            // 
             // layoutControlItem13
             // 
             this.layoutControlItem13.Control = this.btnOpenDir;
@@ -507,17 +894,17 @@
             this.layoutControlItem14.Location = new System.Drawing.Point(0, 194);
             this.layoutControlItem14.Name = "layoutControlItem14";
             this.layoutControlItem14.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
-            this.layoutControlItem14.Size = new System.Drawing.Size(75, 34);
+            this.layoutControlItem14.Size = new System.Drawing.Size(100, 34);
             this.layoutControlItem14.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem14.TextVisible = false;
             // 
             // layoutControlItem15
             // 
             this.layoutControlItem15.Control = this.txtBackupAll;
-            this.layoutControlItem15.Location = new System.Drawing.Point(75, 194);
+            this.layoutControlItem15.Location = new System.Drawing.Point(100, 194);
             this.layoutControlItem15.Name = "layoutControlItem15";
             this.layoutControlItem15.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 12, 2);
-            this.layoutControlItem15.Size = new System.Drawing.Size(125, 34);
+            this.layoutControlItem15.Size = new System.Drawing.Size(100, 34);
             this.layoutControlItem15.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem15.TextVisible = false;
             // 
@@ -530,7 +917,23 @@
             this.itemAllFile.Size = new System.Drawing.Size(200, 51);
             this.itemAllFile.Text = "全量文件";
             this.itemAllFile.TextLocation = DevExpress.Utils.Locations.Top;
-            this.itemAllFile.TextSize = new System.Drawing.Size(91, 14);
+            this.itemAllFile.TextSize = new System.Drawing.Size(70, 14);
+            // 
+            // layoutControlItem17
+            // 
+            this.layoutControlItem17.Control = this.btnConnectTest1;
+            this.layoutControlItem17.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
+            this.layoutControlItem17.CustomizationFormText = "layoutControlItem5";
+            this.layoutControlItem17.Location = new System.Drawing.Point(0, 279);
+            this.layoutControlItem17.MaxSize = new System.Drawing.Size(200, 46);
+            this.layoutControlItem17.MinSize = new System.Drawing.Size(200, 46);
+            this.layoutControlItem17.Name = "layoutControlItem17";
+            this.layoutControlItem17.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 22, 2);
+            this.layoutControlItem17.Size = new System.Drawing.Size(200, 46);
+            this.layoutControlItem17.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
+            this.layoutControlItem17.Text = "layoutControlItem5";
+            this.layoutControlItem17.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem17.TextVisible = false;
             // 
             // layoutControlGroup3
             // 
@@ -564,7 +967,7 @@
             this.layoutControlItem7.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem7.Text = "数据库地址";
             this.layoutControlItem7.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem7.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem7.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem8
             // 
@@ -580,7 +983,7 @@
             this.layoutControlItem8.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem8.Text = "用户名";
             this.layoutControlItem8.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem8.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem8.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem9
             // 
@@ -596,7 +999,7 @@
             this.layoutControlItem9.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem9.Text = "密码";
             this.layoutControlItem9.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem9.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem9.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem10
             // 
@@ -612,7 +1015,7 @@
             this.layoutControlItem10.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem10.Text = "服务名";
             this.layoutControlItem10.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem10.TextSize = new System.Drawing.Size(91, 14);
+            this.layoutControlItem10.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem11
             // 
@@ -641,7 +1044,7 @@
             this.itemAllFile1.Size = new System.Drawing.Size(200, 51);
             this.itemAllFile1.Text = "数据文件";
             this.itemAllFile1.TextLocation = DevExpress.Utils.Locations.Top;
-            this.itemAllFile1.TextSize = new System.Drawing.Size(91, 14);
+            this.itemAllFile1.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem16
             // 
@@ -657,86 +1060,7 @@
             this.layoutControlItem16.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
             this.layoutControlItem16.Text = "SYS账户密码";
             this.layoutControlItem16.TextLocation = DevExpress.Utils.Locations.Top;
-            this.layoutControlItem16.TextSize = new System.Drawing.Size(91, 14);
-            // 
-            // layoutControlGroup5
-            // 
-            this.layoutControlGroup5.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
-            this.simpleLabelItem2,
-            this.simpleLabelItem3,
-            this.emptySpaceItem2});
-            this.layoutControlGroup5.Location = new System.Drawing.Point(0, 0);
-            this.layoutControlGroup5.Name = "layoutControlGroup5";
-            this.layoutControlGroup5.Size = new System.Drawing.Size(200, 508);
-            this.layoutControlGroup5.Text = "  计划  ";
-            // 
-            // btnConnectTest1
-            // 
-            this.btnConnectTest1.Location = new System.Drawing.Point(15, 338);
-            this.btnConnectTest1.Name = "btnConnectTest1";
-            this.btnConnectTest1.Size = new System.Drawing.Size(186, 22);
-            this.btnConnectTest1.StyleController = this.layoutControl1;
-            this.btnConnectTest1.TabIndex = 9;
-            this.btnConnectTest1.Text = "测试连接";
-            this.btnConnectTest1.Click += new System.EventHandler(this.btnConnectTest1_Click);
-            // 
-            // layoutControlItem17
-            // 
-            this.layoutControlItem17.Control = this.btnConnectTest1;
-            this.layoutControlItem17.ControlAlignment = System.Drawing.ContentAlignment.TopLeft;
-            this.layoutControlItem17.CustomizationFormText = "layoutControlItem5";
-            this.layoutControlItem17.Location = new System.Drawing.Point(0, 279);
-            this.layoutControlItem17.MaxSize = new System.Drawing.Size(200, 46);
-            this.layoutControlItem17.MinSize = new System.Drawing.Size(200, 46);
-            this.layoutControlItem17.Name = "layoutControlItem17";
-            this.layoutControlItem17.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 12, 22, 2);
-            this.layoutControlItem17.Size = new System.Drawing.Size(200, 46);
-            this.layoutControlItem17.SizeConstraintsType = DevExpress.XtraLayout.SizeConstraintsType.Custom;
-            this.layoutControlItem17.Text = "layoutControlItem5";
-            this.layoutControlItem17.TextSize = new System.Drawing.Size(0, 0);
-            this.layoutControlItem17.TextVisible = false;
-            // 
-            // simpleLabelItem2
-            // 
-            this.simpleLabelItem2.AllowHotTrack = false;
-            this.simpleLabelItem2.AppearanceItemCaption.ForeColor = System.Drawing.Color.Red;
-            this.simpleLabelItem2.AppearanceItemCaption.Options.UseForeColor = true;
-            this.simpleLabelItem2.Location = new System.Drawing.Point(0, 0);
-            this.simpleLabelItem2.Name = "simpleLabelItem2";
-            this.simpleLabelItem2.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 100, 2);
-            this.simpleLabelItem2.Size = new System.Drawing.Size(200, 116);
-            this.simpleLabelItem2.Text = "每月1号全量备份";
-            this.simpleLabelItem2.TextSize = new System.Drawing.Size(91, 14);
-            // 
-            // simpleLabelItem3
-            // 
-            this.simpleLabelItem3.AllowHotTrack = false;
-            this.simpleLabelItem3.AppearanceItemCaption.ForeColor = System.Drawing.Color.LimeGreen;
-            this.simpleLabelItem3.AppearanceItemCaption.Options.UseForeColor = true;
-            this.simpleLabelItem3.Location = new System.Drawing.Point(0, 116);
-            this.simpleLabelItem3.Name = "simpleLabelItem3";
-            this.simpleLabelItem3.Padding = new DevExpress.XtraLayout.Utils.Padding(2, 2, 100, 2);
-            this.simpleLabelItem3.Size = new System.Drawing.Size(200, 116);
-            this.simpleLabelItem3.Text = "每周1增量备份";
-            this.simpleLabelItem3.TextSize = new System.Drawing.Size(91, 14);
-            // 
-            // emptySpaceItem2
-            // 
-            this.emptySpaceItem2.AllowHotTrack = false;
-            this.emptySpaceItem2.Location = new System.Drawing.Point(0, 232);
-            this.emptySpaceItem2.Name = "emptySpaceItem2";
-            this.emptySpaceItem2.Size = new System.Drawing.Size(200, 276);
-            this.emptySpaceItem2.TextSize = new System.Drawing.Size(0, 0);
-            // 
-            // btnConnectTest2
-            // 
-            this.btnConnectTest2.Location = new System.Drawing.Point(15, 355);
-            this.btnConnectTest2.Name = "btnConnectTest2";
-            this.btnConnectTest2.Size = new System.Drawing.Size(186, 22);
-            this.btnConnectTest2.StyleController = this.layoutControl1;
-            this.btnConnectTest2.TabIndex = 9;
-            this.btnConnectTest2.Text = "测试连接";
-            this.btnConnectTest2.Click += new System.EventHandler(this.btnConnectTest2_Click);
+            this.layoutControlItem16.TextSize = new System.Drawing.Size(70, 14);
             // 
             // layoutControlItem12
             // 
@@ -754,6 +1078,26 @@
             this.layoutControlItem12.TextSize = new System.Drawing.Size(0, 0);
             this.layoutControlItem12.TextVisible = false;
             // 
+            // layoutControlGroup2
+            // 
+            this.layoutControlGroup2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
+            this.layoutControlItem6});
+            this.layoutControlGroup2.Location = new System.Drawing.Point(206, 0);
+            this.layoutControlGroup2.Name = "layoutControlGroup2";
+            this.layoutControlGroup2.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
+            this.layoutControlGroup2.Size = new System.Drawing.Size(722, 538);
+            this.layoutControlGroup2.Text = "日志信息";
+            // 
+            // layoutControlItem6
+            // 
+            this.layoutControlItem6.Control = this.gcLog;
+            this.layoutControlItem6.Location = new System.Drawing.Point(0, 0);
+            this.layoutControlItem6.Name = "layoutControlItem6";
+            this.layoutControlItem6.Padding = new DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0);
+            this.layoutControlItem6.Size = new System.Drawing.Size(716, 511);
+            this.layoutControlItem6.TextSize = new System.Drawing.Size(0, 0);
+            this.layoutControlItem6.TextVisible = false;
+            // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
@@ -767,6 +1111,12 @@
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
             this.layoutControl1.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.panelControl1)).EndInit();
+            this.panelControl1.ResumeLayout(false);
+            this.panelControl1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.txtAllExeTime.Properties.CalendarTimeProperties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtAllExeTime.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtMonthDays.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtAllFile.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtBackupAll.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtBackupIncrement.Properties)).EndInit();
@@ -782,8 +1132,28 @@
             ((System.ComponentModel.ISupportInitialize)(this.txtService2.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtDataFile.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.txtSysPwd.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.panelControl2)).EndInit();
+            this.panelControl2.ResumeLayout(false);
+            this.panelControl2.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.txtIncExeTime.Properties.CalendarTimeProperties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtIncExeTime.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtWeekDays.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtDbAddr3.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtUser3.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtPwd3.Properties)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.txtService3.Properties)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.tabbedControlGroup1)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup5)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.itemStartStop)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem20)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem18)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem19)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem21)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem22)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem23)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem24)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
@@ -791,12 +1161,11 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem13)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem14)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem15)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemAllFile)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup3)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem7)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem8)).EndInit();
@@ -805,12 +1174,9 @@
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem11)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.itemAllFile1)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem16)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup5)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem17)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem2)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.simpleLabelItem3)).EndInit();
-            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem2)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem12)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem6)).EndInit();
             this.ResumeLayout(false);
 
         }
@@ -862,11 +1228,35 @@
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem16;
         private DevExpress.XtraEditors.SimpleButton btnConnectTest1;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem17;
-        private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItem2;
-        private DevExpress.XtraLayout.SimpleLabelItem simpleLabelItem3;
-        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2;
         private DevExpress.XtraEditors.SimpleButton btnConnectTest2;
         private DevExpress.XtraLayout.LayoutControlItem layoutControlItem12;
+        private DevExpress.XtraEditors.LabelControl labelControl1;
+        private DevExpress.XtraEditors.ComboBoxEdit txtMonthDays;
+        private DevExpress.XtraEditors.LabelControl labelControl2;
+        private DevExpress.XtraEditors.SimpleButton btnStart;
+        private DevExpress.XtraLayout.LayoutControlItem itemStartStop;
+        private DevExpress.XtraEditors.PanelControl panelControl1;
+        private DevExpress.XtraEditors.DateEdit txtAllExeTime;
+        private DevExpress.XtraEditors.LabelControl labelControl3;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem20;
+        private DevExpress.XtraEditors.PanelControl panelControl2;
+        private DevExpress.XtraEditors.DateEdit txtIncExeTime;
+        private DevExpress.XtraEditors.LabelControl labelControl31;
+        private DevExpress.XtraEditors.LabelControl labelControl22;
+        private DevExpress.XtraEditors.ComboBoxEdit txtWeekDays;
+        private DevExpress.XtraEditors.LabelControl labelControl12;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem18;
+        private DevExpress.XtraEditors.SimpleButton btnStop;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem19;
+        private DevExpress.XtraEditors.TextEdit txtDbAddr3;
+        private DevExpress.XtraEditors.TextEdit txtUser3;
+        private DevExpress.XtraEditors.TextEdit txtPwd3;
+        private DevExpress.XtraEditors.TextEdit txtService3;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem21;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem22;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem23;
+        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem24;
+        private DevExpress.XtraLayout.EmptySpaceItem emptySpaceItem2;
     }
 }
 

+ 284 - 4
DbBackup/Form1.cs

@@ -1,5 +1,8 @@
 using DbBackup.ViewModel;
 using DevExpress.XtraEditors;
+using DxHelper;
+using ExtensionsDev;
+using Newtonsoft.Json;
 using Oracle11;
 using System;
 using System.Collections.Generic;
@@ -9,9 +12,9 @@ using System.Drawing;
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
-using static DevExpress.XtraEditors.Mask.MaskSettings;
 
 namespace DbBackup
 {
@@ -19,18 +22,67 @@ namespace DbBackup
     {
         List<LogInfo> logData1 = new List<LogInfo>();
         List<LogInfo> logData2 = new List<LogInfo>();
+        Dictionary<int, string> dic = new Dictionary<int, string>()
+        {
+            { 1,"一" },
+            { 2,"二" },
+            { 3,"三" },
+            { 4,"四" },
+            { 5,"五" },
+            { 6,"六" },
+            { 0,"日" },
+
+        };
         public Form1()
         {
             InitializeComponent();
             tabbedControlGroup1.SelectedTabPageIndex = 0;
-            gcLog.UseDefault(logData1).UseClear<LogInfo>().UseRowNumber().SetLogImageColumn(nameof(LogInfo.LogType), typeof(EnumLogType));
+            gcLog.UseDefault(logData1).UseClear<LogInfo>().UseRowNumber()
+                .SetLogImageColumn(nameof(LogInfo.LogType), typeof(EnumLogType))
+                .AddContentMenu<LogInfo>("打开日志文件", SvgHelper.CreateOpenDir(), data =>
+                {
+                    string dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs");
+                    if (!Directory.Exists(dir))
+                        dir = AppDomain.CurrentDomain.BaseDirectory;
+                    System.Diagnostics.Process.Start("explorer.exe", dir);
+                });
             gvLog.Columns[nameof(ViewModel.LogInfo.LogType)].MaxWidth = 100;
             gvLog.Columns[nameof(ViewModel.LogInfo.LogTime)].MaxWidth = 150;
+
+            for (int i = 1; i <= 31; i++)
+            {
+                txtMonthDays.Properties.Items.Add(i);
+            }
+            txtMonthDays.SelectedIndex = 0;
+            foreach (var kv in dic)
+            {
+                txtWeekDays.Properties.Items.Add(kv.Value);
+            }
+            txtWeekDays.SelectedIndex = 0;
         }
 
         private void Form1_Load(object sender, EventArgs e)
         {
-
+            Directory.CreateDirectory("Data");//存放备份计划的目录
+            string planFile = "Data\\plan.json";
+            if (File.Exists(planFile))
+            {
+                var strPlanInfo = File.ReadAllText(planFile);
+                var planInfo = JsonConvert.DeserializeObject<PlanInfo>(strPlanInfo);
+                this.txtMonthDays.Text = planInfo.AllMonthDay.ToString();
+                txtAllExeTime.DateTime = planInfo.AllTime;
+                txtWeekDays.Text = dic.First(p => p.Key == planInfo.IncWeekDay).Value;
+                txtIncExeTime.DateTime = planInfo.IncTime;
+                btnStart.Enabled = !planInfo.Enable;
+                btnStop.Enabled = planInfo.Enable;
+                panelControl1.Enabled = panelControl2.Enabled = !planInfo.Enable;
+                txtDbAddr3.Text = planInfo.DbAddr;
+                txtUser3.Text = planInfo.User;
+                txtPwd3.Text = planInfo.Pwd;
+                txtService3.Text = planInfo.ServiceName;
+            }
+            DoPlainAll();
+            DoPlainInc();
         }
         //备份
         private async void btnBackup_Click(object sender, EventArgs e)
@@ -72,7 +124,7 @@ namespace DbBackup
                           var zipFile = DbHelper.BackupIncrementDb(allFile, dbAddr, user, pwd, service);//增量备份
                           if (zipFile == null)
                           {
-                              Info($"数据未改变,不进行增量备份");
+                              Info($"数据未改变,不进行增量备份");
                           }
                           else
                           {
@@ -129,9 +181,215 @@ namespace DbBackup
             btnBackup.Enabled = true;
             btnRestore.Enabled = true;
         }
+        //启动备份计划
+        private void btnStart_Click(object sender, EventArgs e)
+        {
+            if (txtAllExeTime.DateTime == DateTime.MinValue)
+            {
+                Err("请指定全量备份执行时间!");
+                return;
+            }
+            if (txtIncExeTime.DateTime == DateTime.MinValue)
+            {
+                Err("请指定增量备份执行时间!");
+                return;
+            }
+            PlanInfo info = new PlanInfo()
+            {
+                AllMonthDay = Convert.ToInt32(txtMonthDays.Text),
+                AllTime = txtAllExeTime.DateTime,
+                IncTime = txtIncExeTime.DateTime,
+                Enable = true,
+                DbAddr = txtDbAddr3.Text.Trim(),
+                User = txtUser3.Text.Trim(),
+                Pwd = txtPwd3.Text.Trim(),
+                ServiceName = txtService3.Text.Trim(),
+            };
+            info.IncWeekDay = dic.First(p => p.Value == txtWeekDays.Text).Key;
+            File.WriteAllText("Data\\plan.json", JsonConvert.SerializeObject(info));
+            panelControl1.Enabled = false;
+            panelControl2.Enabled = false;
+            btnStart.Enabled = false;
+            btnStop.Enabled = true;
+            Info("备份计划已启动");
+        }
+        //停止备份计划
+        private void btnStop_Click(object sender, EventArgs e)
+        {
+            PlanInfo info = new PlanInfo()
+            {
+                AllMonthDay = Convert.ToInt32(txtMonthDays.Text),
+                AllTime = txtAllExeTime.DateTime,
+                IncTime = txtIncExeTime.DateTime,
+                Enable = false,
+                DbAddr = txtDbAddr3.Text.Trim(),
+                User = txtUser3.Text.Trim(),
+                Pwd = txtPwd3.Text.Trim(),
+                ServiceName = txtService3.Text.Trim(),
+            };
+            info.IncWeekDay = dic.First(p => p.Value == txtWeekDays.Text).Key;
+            File.WriteAllText("Data\\plan.json", JsonConvert.SerializeObject(info));
+            panelControl1.Enabled = true;
+            panelControl2.Enabled = true;
+            btnStart.Enabled = true;
+            btnStop.Enabled = false;
+            Info("备份计划已停止");
+
+        }
+
+        private void DoPlainAll()
+        {
+            Task.Run(() =>
+            {
+                while (!this.IsDisposed && !this.Disposing)
+                {
+                    try
+                    {
+                        string file = "Data\\plan.json";
+                        if (File.Exists(file))
+                        {
+                            PlanInfo info = null;
+                            try
+                            {
+                                var str = File.ReadAllText(file);
+                                info = JsonConvert.DeserializeObject<PlanInfo>(str);
+                            }
+                            catch (Exception ex)
+                            {
+                                Serilog.Log.Error("备份计划-->plan.json文件读取异常", ex);
+                            }
+                            if (info == null || !info.Enable) continue;
+                            string dbAddr = info.DbAddr;
+                            string user = info.User;
+                            string pwd = info.Pwd;
+                            string service = info.ServiceName;
+                            //如果设置了31号等,而本月没有31号则在本月最后一天执行计划
+                            int day = info.AllMonthDay > GetMaxDay() ? GetMaxDay() : info.AllMonthDay;
+                            var now = DateTime.Now;
+                            bool doAllBackup = now.Day == day && now.Hour == info.AllTime.Hour && now.Minute == info.AllTime.Minute;
+                            try
+                            {
+
+                                if (doAllBackup)
+                                {
+                                    Info("备份计划-->开始全量备份...");
+                                    var zipFile = DbHelper.BackupDb(dbAddr, user, pwd, service);//全量备份
+                                    Info($"备份计划-->全量备份完成,文件={zipFile}");
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                Err("备份计划-->全量备份出错", ex);
+                                ClearNoneZipFile();
+                            }
+                            finally
+                            {
+                                if (doAllBackup)
+                                    Wait(60);
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        Err("备份计划-->备份计划执行异常", ex);
+                    }
+                    finally
+                    {
+                        Wait(30);
+                    }
+                }
+            });
+        }
+        private void DoPlainInc()
+        {
+            Task.Run(() =>
+            {
+                while (!this.IsDisposed && !this.Disposing)
+                {
+                    try
+                    {
+                        string file = "Data\\plan.json";
+                        if (File.Exists(file))
+                        {
+                            PlanInfo info = null;
+                            try
+                            {
+                                var str = File.ReadAllText(file);
+                                info = JsonConvert.DeserializeObject<PlanInfo>(str);
+                            }
+                            catch (Exception ex)
+                            {
+                                Serilog.Log.Error("备份计划-->plan.json文件读取异常", ex);
+                            }
+                            if (info == null || !info.Enable) continue;
+                            string dbAddr = info.DbAddr;
+                            string user = info.User;
+                            string pwd = info.Pwd;
+                            string service = info.ServiceName;
+                            var now = DateTime.Now;
+                            bool doIncBackup = info.IncWeekDay == (int)now.DayOfWeek && now.Hour == info.IncTime.Hour && now.Minute == info.IncTime.Minute;
+                            try
+                            {
+                                if (doIncBackup)
+                                {
+                                    Info("备份计划-->开始增量备份...");
+                                    //获取最后一个全量备份的文件
+                                    var lastFile = Directory.EnumerateFiles("Backup","all-*.7z")
+                                        .Where(p => Path.GetFileNameWithoutExtension(p).Length == 18)
+                                        .OrderByDescending(p =>
+                                        {
+                                            var idx = p.LastIndexOf("-");
+                                            var time = DateTime.ParseExact(p.Substring(idx + 1, 14), "yyyyMMddHHmmss", null);
+                                            return time;
+                                        }).FirstOrDefault();
+                                    if (lastFile == null)
+                                    {
+                                        Info($"备份计划-->Backup目录中未找到全量备份文件,不进行增量备份");
+                                        continue;
+                                    }
+                                    else
+                                    {
+                                        Info($"备份计划-->开始对文件{Path.GetFileName(lastFile)}进行增量备份...");
+                                    }
+                                    var zipFile = DbHelper.BackupIncrementDb(lastFile, dbAddr, user, pwd, service);//增量备份
+                                    if (zipFile == null)
+                                    {
+                                        Info($"备份计划-->数据未改变,不进行增量备份");
+                                    }
+                                    else
+                                    {
+                                        Info($"备份计划-->增量备份完成,文件={zipFile}");
+                                    }
+                                }
+                            }
+                            catch (Exception ex)
+                            {
+                                Err("备份计划-->增量备份出错", ex);
+                                ClearNoneZipFile();
+                            }
+                            finally
+                            {
+                                if (doIncBackup)
+                                    Wait(60);
+                            }
+                        }
+                    }
+                    catch (Exception ex)
+                    {
+                        Err("备份计划-->备份计划执行异常", ex);
+                    }
+                    finally
+                    {
+                        Wait(30);
+                    }
+                }
+            });
+        }
         private void btnOpenDir_Click(object sender, EventArgs e)
         {
             string dir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Backup");
+            if (!Directory.Exists(dir))
+                dir = AppDomain.CurrentDomain.BaseDirectory;
             System.Diagnostics.Process.Start("explorer.exe", dir);
         }
         private void txtBackupIncrement_CheckedChanged(object sender, EventArgs e)
@@ -234,5 +492,27 @@ namespace DbBackup
                 }
             }
         }
+        private void Wait(int seconds)
+        {
+            for (int i = 0; i < seconds; i++)
+            {
+                Thread.Sleep(1000);
+                if (this.Disposing || this.IsDisposed)
+                    break;
+            }
+        }
+
+
+        //获取当前时间所在月份的最大天数
+        private int GetMaxDay()
+        {
+            DateTime dateTime = DateTime.Now;
+            DateTime d1 = new DateTime(dateTime.Year, dateTime.Month, 1);
+            DateTime d2 = d1.AddMonths(1).AddDays(-1);
+            return d2.Day;
+
+        }
+
+
     }
 }

+ 1 - 1
DbBackup/Form1.resx

@@ -121,7 +121,7 @@
   <data name="Form1.IconOptions.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
-        vgAADr4B6kKxwAAAAtBJREFUWEfFV82KE0EQHr3sQfEmK5hMEDzoWTwJHnyCPQjeveo7CCoYEHYmS8zF
+        vAAADrwBlbxySQAAAtBJREFUWEfFV82KE0EQHr3sQfEmK5hMEDzoWTwJHnyCPQjeveo7CCoYEHYmS8zF
         VxD3DVaP+wjm4HoWRJdlQXDdar+vpiapTjqzsxidgiKd+vmqp7qqpidrRc/CxcFOuJVvy5N+Ie/yUqb9
         Uo7we0q29dR0TweF3KaPef8FhXChV8pdgE4Q5EteyO+8DKGRYaO28KEvMQztfDQYh2sAewWwr8lALVh9
         gUEsg21H+SjcyYvwMQUas5xUnNI5JhYwDb6ZeoXcx84/pYD6ZTjEOe9hPcQ5P+4VYYvMNWXUwfeH96mZ

+ 7 - 5
DbBackup/Properties/licenses.licx

@@ -1,8 +1,10 @@
-DevExpress.XtraCharts.ChartControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraMap.MapControl, DevExpress.XtraMap.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
-DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.ButtonEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraCharts.ChartControl, DevExpress.XtraCharts.v23.2.UI, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
 DevExpress.XtraBars.BarManager, DevExpress.XtraBars.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
+DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

+ 57 - 0
DbBackup/ViewModel/PlanInfo.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DbBackup.ViewModel
+{
+    public class PlanInfo
+    {
+        /// <summary>
+        /// 每月全量备份的天
+        /// </summary>
+        public int AllMonthDay { get; set; }
+
+        /// <summary>
+        /// 全量备份时间
+        /// </summary>
+        public DateTime AllTime { get; set; }
+
+        /// <summary>
+        /// 每周增量备份的天
+        /// </summary>
+        public int IncWeekDay { get; set;}
+
+        /// <summary>
+        /// 增量备份时间
+        /// </summary>
+        public DateTime IncTime { get; set; }
+
+        /// <summary>
+        /// 是否启用
+        /// </summary>
+        public bool Enable { get; set; }
+
+
+        /// <summary>
+        /// 数据库地址
+        /// </summary>
+        public string DbAddr { get; set; }
+
+        /// <summary>
+        /// 用户名
+        /// </summary>
+        public string User { get; set; }
+
+        /// <summary>
+        /// 密码
+        /// </summary>
+        public string Pwd { get; set; }
+
+        /// <summary>
+        /// 服务名
+        /// </summary>
+        public string ServiceName { get; set; }
+    }
+}