From 76f6fca48b3be8f31e9845a6f87b0795f2a016a9 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Sun, 16 Apr 2017 00:21:20 +0000 Subject: [PATCH] Development Checkin, should not break --- svnsync/Controllers/ControllersTray.cs | 28 +++- svnsync/Controllers/ControllersWindow.cs | 25 +++- svnsync/Helpers/Handles.cs | 13 +- svnsync/Helpers/TreeBuilder.cs | 120 ++++++++++++++++++ svnsync/Libraries/Svn.cs | 48 +------ svnsync/Models/ModelsWindow.cs | 14 +- svnsync/Program.cs | 4 +- svnsync/Properties/AssemblyInfo.cs | 6 +- svnsync/Views/ViewsWindow.cs | 47 ++++++- svnsync/Views/ViewsWindowForm.Designer.cs | 36 +++--- svnsync/Views/ViewsWindowForm.cs | 7 +- .../Views/ViewsWindowFormFileList.Designer.cs | 103 +++++++++++++++ svnsync/Views/ViewsWindowFormFileList.cs | 49 +++++++ svnsync/Views/ViewsWindowFormFileList.resx | 120 ++++++++++++++++++ svnsync/Views/ViewsWindowFormInterface.cs | 17 +++ svnsync/svnsync.csproj | 13 +- svnsync/svnsync.csproj.user | 2 +- 17 files changed, 573 insertions(+), 79 deletions(-) create mode 100644 svnsync/Helpers/TreeBuilder.cs create mode 100644 svnsync/Views/ViewsWindowFormFileList.Designer.cs create mode 100644 svnsync/Views/ViewsWindowFormFileList.cs create mode 100644 svnsync/Views/ViewsWindowFormFileList.resx create mode 100644 svnsync/Views/ViewsWindowFormInterface.cs diff --git a/svnsync/Controllers/ControllersTray.cs b/svnsync/Controllers/ControllersTray.cs index 7dfd0b6..d0c6ffd 100644 --- a/svnsync/Controllers/ControllersTray.cs +++ b/svnsync/Controllers/ControllersTray.cs @@ -2,6 +2,7 @@ using BlubbFish.Utils; using svnsync.Views; using svnsync.Helpers; +using System.Collections.Generic; namespace svnsync.Controllers { @@ -21,8 +22,7 @@ namespace svnsync.Controllers protected override void Init() { viewTray = new ViewsTray(); - controllerWindow = new ControllersWindow(); - controllerWindow.SetAction(Handles.FormType.Normal); + InitControllerWindow(); if (viewTray.Model.Args.HasArgumentType("-cron")) { if (this.CronJob(0, false)) { viewTray.ShowSuccess(); @@ -37,6 +37,12 @@ namespace svnsync.Controllers } } + private static void InitControllerWindow() { + controllerWindow = new ControllersWindow(); + controllerWindow.SetAction(Handles.FormType.Normal); + controllerWindow.SetDeletedFiles(new List()); + } + public override void Dispose() { if (viewTray != null) { @@ -104,7 +110,7 @@ namespace svnsync.Controllers return true; } - private Boolean HandleError(Handles.SvnType svnType, String message, String stacktrace = "") + private static Boolean HandleError(Handles.SvnType svnType, String message, String stacktrace = "") { viewTray.ShowError(svnType, message); switch (svnType) { @@ -120,6 +126,7 @@ namespace svnsync.Controllers break; case Handles.SvnType.ExternDeletedFiles: controllerWindow.SetAction(Handles.FormType.DeletedFiles); + controllerWindow.SetDeletedFiles(viewTray.Model.Svn.WasDeletedFiles); break; case Handles.SvnType.LockedFile: controllerWindow.SetAction(Handles.FormType.ManualResolve); @@ -159,5 +166,20 @@ namespace svnsync.Controllers viewTray.Dispose(); System.Windows.Forms.Application.Exit(); } + + internal static void DeleteButton_Click(object sender, EventArgs e) { + if(!(sender is System.Windows.Forms.Button)) { + return; + } + System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)((ViewsWindowFormFileList)((System.Windows.Forms.Button)sender).Parent).tree; + List l = TreeBuilder.getSelectedNodes(t.Nodes); + controllerWindow.Hide(); + viewTray.Model.Svn.DeleteFiles(l); + if(viewTray.Model.Svn.IsError) { + HandleError(Handles.SvnType.UnexpectedError, viewTray.Model.Svn.Error); + return; + } + //this.runagainButton_Click(sender, null); + } } } diff --git a/svnsync/Controllers/ControllersWindow.cs b/svnsync/Controllers/ControllersWindow.cs index ff4e09c..b034fb4 100644 --- a/svnsync/Controllers/ControllersWindow.cs +++ b/svnsync/Controllers/ControllersWindow.cs @@ -3,6 +3,7 @@ using System.Windows.Forms; using BlubbFish.Utils; using svnsync.Views; using svnsync.Helpers; +using System.Collections.Generic; namespace svnsync.Controllers { @@ -11,6 +12,8 @@ namespace svnsync.Controllers private static ViewsWindow viewWindow; private Handles.FormType initAction; private String initMessage; + private List initDeletedFiles; + private static ControllersTray controllerTray; /// /// Tray Controller /// @@ -21,6 +24,8 @@ namespace svnsync.Controllers viewWindow = new ViewsWindow(); viewWindow.Model.Message = this.initMessage; viewWindow.Model.FormType = this.initAction; + viewWindow.Model.DeletedFiles = this.initDeletedFiles; + viewWindow.Draw(); } public override void Dispose() @@ -47,7 +52,6 @@ namespace svnsync.Controllers //this.CreateSVNOpen("Fehler im Cronjob, mehr als 10 Aufrufe!", ""); //this.CreateFileList("Hinzufügen", "Diese Daten sind unversioniert:", s.getNoVersionFiles(), new EventHandler(addButton_Click)); //this.CreateSVNOpen("Es ist ein Unvorhersebarer Fehler aufgetreten", p); - //this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", s.getWasDeletedFiles(), new EventHandler(deleteButton_Click)); } internal void SetMessage(String p) @@ -58,5 +62,24 @@ namespace svnsync.Controllers viewWindow.Model.Message = p; } } + internal void SetDeletedFiles(List p) { + if(viewWindow == null) { + this.initDeletedFiles = p; + } else { + viewWindow.Model.DeletedFiles = p; + } + } + + internal static void RunAgainButton_Click(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + internal static void SvnOpenButton_Click(object sender, EventArgs e) { + throw new NotImplementedException(); + } + + internal void Hide() { + viewWindow.Hide(); + } } } diff --git a/svnsync/Helpers/Handles.cs b/svnsync/Helpers/Handles.cs index b6ed83b..bd93064 100644 --- a/svnsync/Helpers/Handles.cs +++ b/svnsync/Helpers/Handles.cs @@ -1,8 +1,9 @@ using System; +using System.Collections.Generic; namespace svnsync.Helpers { - class Handles + public class Handles { public enum SvnType { @@ -33,4 +34,14 @@ namespace svnsync.Helpers System.Runtime.Serialization.StreamingContext context) { } } + public class TreePart { + public TreePart(String name, bool isFolder, List child) { + this.name = name; + this.child = child; + this.isFolder = isFolder; + } + public string name { get; private set; } + public List child { get; set; } + public bool isFolder { get; set; } + } } diff --git a/svnsync/Helpers/TreeBuilder.cs b/svnsync/Helpers/TreeBuilder.cs new file mode 100644 index 0000000..7e480fa --- /dev/null +++ b/svnsync/Helpers/TreeBuilder.cs @@ -0,0 +1,120 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace svnsync.Helpers { + public class TreeBuilder { + public static TreeNode[] createDirList(List tree, String root) { + List ntree = new List(); + foreach(String node in tree) { + String folder = node; + folder = folder.Replace('\\', '/'); + folder = (folder.StartsWith("/")) ? folder.Substring(1) : folder; + folder = (folder.EndsWith("/")) ? folder.Substring(0, folder.Length - 1) : folder; + bool isFolder = System.IO.Directory.Exists(root + "/" + folder); + String[] folders = folder.Split('/'); + Array.Reverse(folders); + List prev = null; + foreach(String entry in folders) { + String name = entry; + if(prev == null) + prev = new List() { new TreePart(name, isFolder, new List()) }; + else + prev = new List() { new TreePart(name, isFolder, prev) }; + if(!isFolder) + isFolder = true; + } + ntree = treeMatch(ntree, prev); + } + return createListDirRender(ntree); + } + public static List treeMatch(List ntree, List input) { + String[] key1 = array_keys(input); + if(ntree.Count == 0 || (key1.Length > 0 && !array_key_exists(key1[0], ntree)) || key1.Length == 0) { + ntree.Add(input[0]); + } else { + String[] key2 = array_keys(findName(key1[0], input)); + if(key2.Length != 0) { + if(array_key_exists(key2[0], findName(key1[0], ntree))) { + /*setChild(key2[0], findName(key1[0], ntree),*/ + treeMatch(findName(key1[0], ntree), findName(key1[0], input)); + } else { + findName(key1[0], ntree).Add(findName(key1[0], input)[0]); + } + } + } + return ntree; + } + public static string[] array_keys(List input) { + List ret = new List(); + foreach(TreePart item in input) { + ret.Add(item.name); + } + return ret.ToArray(); + } + public static bool array_key_exists(string p, List ntree) { + foreach(TreePart item in ntree) { + if(item.name == p) + return true; + } + return false; + } + public static List findName(string key, List input) { + foreach(TreePart item in input) { + if(item.name == key) + return item.child; + } + return null; + } + public static TreeNode[] createListDirRender(List ntree) { + TreeNode[] t = new TreeNode[ntree.Count]; + int i = 0; + foreach(TreePart item in ntree) { + String name = item.name + ((item.isFolder) ? ".folder" : (item.name.LastIndexOf('.') == -1) ? ".file" : item.name.Substring(item.name.LastIndexOf('.'))); + if(item.child.Count == 0) + t[i++] = new TreeNode(name); + else + t[i++] = new TreeNode(name, createListDirRender(item.child)); + t[i - 1].Checked = true; + } + return t; + } + public static ImageList getImages(TreeNodeCollection treeNodeCollection) { + ImageList li = new ImageList(); + runThroughNodes(li.Images, treeNodeCollection); + return li; + } + public static void runThroughNodes(ImageList.ImageCollection imageCollection, TreeNodeCollection treeNodeCollection) { + foreach(TreeNode item in treeNodeCollection) { + imageCollection.Add(getImageType(item.Text)); + item.ImageIndex = imageCollection.Count - 1; + item.Text = item.Text.Substring(0, item.Text.LastIndexOf(".")); + if(item.Nodes.Count > 0) + runThroughNodes(imageCollection, item.Nodes); + } + } + public static Icon getImageType(string p) { + switch(p.Substring(p.LastIndexOf("."))) { + case ".folder": + return Properties.Resources.Special_Folder; + case ".file": + return Properties.Resources.Special_File; + } + return Properties.Resources.Special_File; + } + public static List getSelectedNodes(TreeNodeCollection treeNodeCollection) { + List l = new List(); + foreach(TreeNode item in treeNodeCollection) { + if(item.Checked && item.Nodes.Count == 0) + l.Add(item); + if(item.Nodes.Count > 0) + l.AddRange(getSelectedNodes(item.Nodes)); + } + return l; + } + } +} diff --git a/svnsync/Libraries/Svn.cs b/svnsync/Libraries/Svn.cs index 78413e6..0f0fe77 100644 --- a/svnsync/Libraries/Svn.cs +++ b/svnsync/Libraries/Svn.cs @@ -51,9 +51,7 @@ namespace svnsync.Libraries { if (handles[0] == ' ') { if (handles[2] == 'L') { throw new Helpers.SvnLockedException("Datei: " + file + " ist gelockt!"); - } - //Modifizierte Eigenschaft - else if (handles[1] == 'M') { + } else if(handles[1] == 'M') { //Modifizierte Eigenschaft this.modified.Add(file); } else { throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] ' '"); @@ -62,9 +60,7 @@ namespace svnsync.Libraries { this.added.Add(file); } else if (handles[0] == 'D') { this.isdeleted.Add(file); - } - // Modifizierte Datei - else if (handles[0] == 'M') { + } else if(handles[0] == 'M') { // Modifizierte Datei this.modified.Add(file); } else if (handles[0] == 'R') { throw new NotImplementedException("NOT IMPLEMENTED in SvnClass: SVN Line[0] 'R'"); @@ -94,45 +90,11 @@ namespace svnsync.Libraries { private void Runner(String arg) { this.SvnOutput = ""; this.SvnError = ""; - this.p.StartInfo.Arguments = arg; + this.p.StartInfo.Arguments = arg + " --non-interactive"; this.p.Start(); - Int64 e_lenth = 0; - while (!this.p.HasExited) { - if(this.p.StandardOutput.Peek() != -1) { - this.SvnOutput += this.p.StandardOutput.ReadLine(); - } - this.p.StandardError.BaseStream.Flush(); - - if (this.p.StandardError.BaseStream.Length > e_lenth) { - this.SvnError += this.p.StandardError.BaseStream.ReadByte(); - e_lenth++; - } - System.Threading.Thread.Sleep(10); - } - this.SvnOutput += p.StandardOutput.ReadToEnd(); - this.SvnError += p.StandardError.ReadToEnd(); - /*this.p.OutputDataReceived += this.P_OutputDataReceived; - this.p.ErrorDataReceived += this.P_ErrorDataReceived; - this.p.BeginOutputReadLine(); - this.p.BeginErrorReadLine(); - while(!this.p.HasExited) { - this.p.StandardError.BaseStream.FlushAsync(); - this.p.StandardOutput.BaseStream.FlushAsync(); - System.Threading.Thread.Sleep(10); - } this.p.WaitForExit(); - this.p.CancelOutputRead(); - this.p.CancelErrorRead();*/ - } - - private void P_ErrorDataReceived(Object sender, DataReceivedEventArgs e) { - if(e.Data != null) { - this.SvnError += e.Data + "\n"; - } - } - - private void P_OutputDataReceived(Object sender, DataReceivedEventArgs e) { - this.SvnOutput += e.Data + "\n"; + this.SvnError = this.p.StandardError.ReadToEnd(); + this.SvnOutput = this.p.StandardOutput.ReadToEnd(); } internal void DeleteFiles(List files) { diff --git a/svnsync/Models/ModelsWindow.cs b/svnsync/Models/ModelsWindow.cs index e6eb755..b58f4df 100644 --- a/svnsync/Models/ModelsWindow.cs +++ b/svnsync/Models/ModelsWindow.cs @@ -1,6 +1,7 @@ using System; using BlubbFish.Utils; using svnsync.Helpers; +using System.Collections.Generic; namespace svnsync.Models { @@ -11,7 +12,7 @@ namespace svnsync.Models } protected override void Init() { - + this.Args = CmdArgs.Instance; } private String MessageValue = ""; @@ -21,9 +22,18 @@ namespace svnsync.Models } private Handles.FormType FormTypeValue; - internal Handles.FormType FormType { + public Handles.FormType FormType { get { return this.FormTypeValue; } set { this.FormTypeValue = value; this.Update(); } } + + private List DeletedFilesValue; + public List DeletedFiles { + get { return this.DeletedFilesValue; } + set { this.DeletedFilesValue = value; this.Update(); } + } + + public CmdArgs Args { get; private set; } + } } diff --git a/svnsync/Program.cs b/svnsync/Program.cs index b600b2e..0302080 100644 --- a/svnsync/Program.cs +++ b/svnsync/Program.cs @@ -43,7 +43,9 @@ namespace svnsync if (!CmdArgs.Instance.HasArgumentType("-cron")) { T_StartLoop(); } - FileMutex.Instance.Delete(); + #if !DEBUG + FileMutex.Instance.Delete(); + #endif return; /*Application.Run();*/ /*Application.EnableVisualStyles(); diff --git a/svnsync/Properties/AssemblyInfo.cs b/svnsync/Properties/AssemblyInfo.cs index 809062f..3f7fba9 100644 --- a/svnsync/Properties/AssemblyInfo.cs +++ b/svnsync/Properties/AssemblyInfo.cs @@ -11,7 +11,7 @@ using System.Resources; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("BlubbFish")] [assembly: AssemblyProduct("SvnSync")] -[assembly: AssemblyCopyright("Copyright © 2012 - 10.03.2017")] +[assembly: AssemblyCopyright("Copyright © 2012 - 16.04.2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -33,6 +33,6 @@ using System.Resources; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.3.1")] -[assembly: AssemblyFileVersion("1.0.3.1")] +[assembly: AssemblyVersion("1.0.4.0")] +[assembly: AssemblyFileVersion("1.0.4.0")] [assembly: NeutralResourcesLanguageAttribute("de-DE")] diff --git a/svnsync/Views/ViewsWindow.cs b/svnsync/Views/ViewsWindow.cs index 6105793..8332452 100644 --- a/svnsync/Views/ViewsWindow.cs +++ b/svnsync/Views/ViewsWindow.cs @@ -1,29 +1,58 @@ using System; using BlubbFish.Utils; using svnsync.Models; +using System.Windows.Forms; namespace svnsync.Views { public class ViewsWindow : OwnView { - private ViewsWindowForm form; + private ViewsWindowFormInterface form; + public ViewsWindow() { - this.form = new ViewsWindowForm(); this.Init(); - this.Model.SetObserver(this); } public override void Update() { + Boolean change = false; + switch(this.Model.FormType) { + default: + case Helpers.Handles.FormType.Normal: + if(!(this.form is ViewsWindowForm)) { + change = true; + } + break; + case Helpers.Handles.FormType.DeletedFiles: + if(!(this.form is ViewsWindowFormFileList)) { + change = true; + } + break; + } + if(change) { + this.SwitchContext(); + } this.form.UpdateForm(); } + private void SwitchContext() { + switch(this.Model.FormType) { + default: + case Helpers.Handles.FormType.Normal: + this.form = new ViewsWindowForm(); + break; + case Helpers.Handles.FormType.DeletedFiles: + this.form = new ViewsWindowFormFileList(); + break; + } + this.form.SetModel(this.Model); + this.form.Show(); + } + protected override void Init() { this.Model = ModelsWindow.Instance; - this.form.SetModel(this.Model); - this.form.Show(); } public override void Dispose() @@ -34,5 +63,13 @@ namespace svnsync.Views } public ModelsWindow Model { get; private set; } + + internal void Draw() { + this.Model.SetObserver(this); + } + + internal void Hide() { + this.form.Hide(); + } } } diff --git a/svnsync/Views/ViewsWindowForm.Designer.cs b/svnsync/Views/ViewsWindowForm.Designer.cs index d862d51..4023309 100644 --- a/svnsync/Views/ViewsWindowForm.Designer.cs +++ b/svnsync/Views/ViewsWindowForm.Designer.cs @@ -1,6 +1,6 @@ namespace svnsync.Views { - partial class ViewsWindowForm + partial class ViewsWindowForm { /// /// Required designer variable. @@ -28,32 +28,32 @@ /// private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); this.messageBox = new System.Windows.Forms.RichTextBox(); + this.label1 = new System.Windows.Forms.Label(); this.opencmd = new System.Windows.Forms.Button(); this.SuspendLayout(); // + // messageBox + // + this.messageBox.Location = new System.Drawing.Point(6, 19); + this.messageBox.Name = "messageBox"; + this.messageBox.ReadOnly = true; + this.messageBox.Size = new System.Drawing.Size(452, 208); + this.messageBox.TabIndex = 2; + this.messageBox.Text = ""; + // // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Location = new System.Drawing.Point(6, 3); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(51, 13); this.label1.TabIndex = 1; this.label1.Text = "Meldung:"; // - // messageBox - // - this.messageBox.Location = new System.Drawing.Point(15, 26); - this.messageBox.Name = "messageBox"; - this.messageBox.ReadOnly = true; - this.messageBox.Size = new System.Drawing.Size(437, 96); - this.messageBox.TabIndex = 2; - this.messageBox.Text = ""; - // // opencmd // - this.opencmd.Location = new System.Drawing.Point(15, 227); + this.opencmd.Location = new System.Drawing.Point(6, 233); this.opencmd.Name = "opencmd"; this.opencmd.Size = new System.Drawing.Size(75, 23); this.opencmd.TabIndex = 3; @@ -66,10 +66,11 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(464, 262); + this.Controls.Add(this.label1); this.Controls.Add(this.opencmd); this.Controls.Add(this.messageBox); - this.Controls.Add(this.label1); this.Name = "ViewsWindowForm"; + this.Padding = new System.Windows.Forms.Padding(3); this.Text = "ViewsWindowsForm"; this.ResumeLayout(false); this.PerformLayout(); @@ -78,8 +79,9 @@ #endregion - private System.Windows.Forms.Label label1; private System.Windows.Forms.RichTextBox messageBox; - private System.Windows.Forms.Button opencmd; - } + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button opencmd; + + } } \ No newline at end of file diff --git a/svnsync/Views/ViewsWindowForm.cs b/svnsync/Views/ViewsWindowForm.cs index 034a135..da8ab5b 100644 --- a/svnsync/Views/ViewsWindowForm.cs +++ b/svnsync/Views/ViewsWindowForm.cs @@ -12,7 +12,7 @@ using svnsync.Controllers; namespace svnsync.Views { - public partial class ViewsWindowForm : Form + public partial class ViewsWindowForm : Form, ViewsWindowFormInterface { private ModelsWindow model; public ViewsWindowForm() @@ -32,5 +32,10 @@ namespace svnsync.Views { this.model = window; } + + public void Hide() { + this.ShowInTaskbar = false; + this.WindowState = FormWindowState.Minimized; + } } } diff --git a/svnsync/Views/ViewsWindowFormFileList.Designer.cs b/svnsync/Views/ViewsWindowFormFileList.Designer.cs new file mode 100644 index 0000000..1b664c0 --- /dev/null +++ b/svnsync/Views/ViewsWindowFormFileList.Designer.cs @@ -0,0 +1,103 @@ +namespace svnsync.Views { + partial class ViewsWindowFormFileList { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.tree = new System.Windows.Forms.TreeView(); + this.title = new System.Windows.Forms.Label(); + this.runButton = new System.Windows.Forms.Button(); + this.doAgainButton = new System.Windows.Forms.Button(); + this.svnOpenButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // tree + // + this.tree.CheckBoxes = true; + this.tree.HideSelection = false; + this.tree.Location = new System.Drawing.Point(10, 30); + this.tree.Name = "tree"; + this.tree.Size = new System.Drawing.Size(440, 191); + this.tree.TabIndex = 0; + // + // title + // + this.title.AutoSize = true; + this.title.Location = new System.Drawing.Point(10, 10); + this.title.Name = "title"; + this.title.Size = new System.Drawing.Size(35, 13); + this.title.TabIndex = 1; + this.title.Text = "label1"; + // + // runButton + // + this.runButton.Location = new System.Drawing.Point(10, 226); + this.runButton.Name = "runButton"; + this.runButton.Size = new System.Drawing.Size(140, 23); + this.runButton.TabIndex = 2; + this.runButton.Text = "button1"; + this.runButton.UseVisualStyleBackColor = true; + // + // doAgainButton + // + this.doAgainButton.Location = new System.Drawing.Point(162, 226); + this.doAgainButton.Name = "doAgainButton"; + this.doAgainButton.Size = new System.Drawing.Size(140, 23); + this.doAgainButton.TabIndex = 3; + this.doAgainButton.Text = "Wiederholen"; + this.doAgainButton.UseVisualStyleBackColor = true; + // + // svnOpenButton + // + this.svnOpenButton.Location = new System.Drawing.Point(310, 226); + this.svnOpenButton.Name = "svnOpenButton"; + this.svnOpenButton.Size = new System.Drawing.Size(140, 23); + this.svnOpenButton.TabIndex = 4; + this.svnOpenButton.Text = "SVN Öffnen"; + this.svnOpenButton.UseVisualStyleBackColor = true; + // + // ViewsWindowFormFileList + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(464, 262); + this.Controls.Add(this.svnOpenButton); + this.Controls.Add(this.doAgainButton); + this.Controls.Add(this.runButton); + this.Controls.Add(this.title); + this.Controls.Add(this.tree); + this.Name = "ViewsWindowFormFileList"; + this.Text = "ViewsWindowFormDelete"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label title; + private System.Windows.Forms.Button runButton; + private System.Windows.Forms.Button doAgainButton; + private System.Windows.Forms.Button svnOpenButton; + protected internal System.Windows.Forms.TreeView tree; + } +} \ No newline at end of file diff --git a/svnsync/Views/ViewsWindowFormFileList.cs b/svnsync/Views/ViewsWindowFormFileList.cs new file mode 100644 index 0000000..aa56b61 --- /dev/null +++ b/svnsync/Views/ViewsWindowFormFileList.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using svnsync.Models; +using svnsync.Controllers; +using svnsync.Helpers; + +namespace svnsync.Views { + public partial class ViewsWindowFormFileList : Form, ViewsWindowFormInterface { + private ModelsWindow model; + public ViewsWindowFormFileList() { + InitializeComponent(); + this.FormClosed += ControllersWindow.FormClosed; + this.doAgainButton.Click += new EventHandler(ControllersWindow.RunAgainButton_Click); + this.svnOpenButton.Click += new EventHandler(ControllersWindow.SvnOpenButton_Click); + } + + public void UpdateForm() { + this.BeginInvoke((Action)(() => { + switch(this.model.FormType) { + case Helpers.Handles.FormType.DeletedFiles: + this.title.Text = "Diese Daten sind gelöscht worden:"; + this.runButton.Text = "Löschen"; + this.tree.Nodes.AddRange(TreeBuilder.createDirList(this.model.DeletedFiles, this.model.Args.GetArgumentData("-d"))); + this.tree.ImageList = TreeBuilder.getImages(this.tree.Nodes); + this.runButton.Click += new EventHandler(ControllersTray.DeleteButton_Click); + break; + } + })); + } + + //this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", s.getWasDeletedFiles(), new EventHandler(deleteButton_Click)); + + public void SetModel(ModelsWindow window) { + this.model = window; + } + + public void Hide() { + this.ShowInTaskbar = false; + this.WindowState = FormWindowState.Minimized; + } + } +} diff --git a/svnsync/Views/ViewsWindowFormFileList.resx b/svnsync/Views/ViewsWindowFormFileList.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/svnsync/Views/ViewsWindowFormFileList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/svnsync/Views/ViewsWindowFormInterface.cs b/svnsync/Views/ViewsWindowFormInterface.cs new file mode 100644 index 0000000..efd6571 --- /dev/null +++ b/svnsync/Views/ViewsWindowFormInterface.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using svnsync.Models; + +namespace svnsync.Views { + public interface ViewsWindowFormInterface { + void UpdateForm(); + void SetModel(ModelsWindow window); + void Show(); + IAsyncResult BeginInvoke(Delegate method); + void Dispose(); + void Hide(); + } +} diff --git a/svnsync/svnsync.csproj b/svnsync/svnsync.csproj index 7e2bbb4..64eff00 100644 --- a/svnsync/svnsync.csproj +++ b/svnsync/svnsync.csproj @@ -31,7 +31,7 @@ true - x64 + x86 true full false @@ -78,6 +78,7 @@ + @@ -91,6 +92,13 @@ ViewsWindowForm.cs + + Form + + + ViewsWindowFormFileList.cs + + Form1.cs @@ -107,6 +115,9 @@ ViewsWindowForm.cs + + ViewsWindowFormFileList.cs + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/svnsync/svnsync.csproj.user b/svnsync/svnsync.csproj.user index 458d539..3d66a99 100644 --- a/svnsync/svnsync.csproj.user +++ b/svnsync/svnsync.csproj.user @@ -1,7 +1,7 @@  - -d "E:\\Eigene Dateien\\Dokumente\\Visual Studio 2017\\Projects" -cron -autoadd -autodelete -externals-own + -d "D:\\Visual Studio 2012\\Projects" -cron -autoadd -externals-own false Project