From 5ae70f6ec378c8bc07e50c814b387160db6a67c2 Mon Sep 17 00:00:00 2001 From: BlubbFish Date: Mon, 17 Apr 2017 00:00:38 +0000 Subject: [PATCH] [NF] Errorlog now implemented #8 --- svnsync/Controllers/ControllersTray.cs | 1 + svnsync/Form1.Designer.cs | 63 -- svnsync/Form1.cs | 537 ------------------ svnsync/Libraries/Svn.cs | 6 +- svnsync/Properties/AssemblyInfo.cs | 4 +- svnsync/Views/ViewsWindow.cs | 26 +- .../Views/ViewsWindowFormError.Designer.cs | 115 ++++ svnsync/Views/ViewsWindowFormError.cs | 51 ++ .../ViewsWindowFormError.resx} | 13 +- svnsync/svnsync.csproj | 18 +- 10 files changed, 201 insertions(+), 633 deletions(-) delete mode 100644 svnsync/Form1.Designer.cs delete mode 100644 svnsync/Form1.cs create mode 100644 svnsync/Views/ViewsWindowFormError.Designer.cs create mode 100644 svnsync/Views/ViewsWindowFormError.cs rename svnsync/{Form1.resx => Views/ViewsWindowFormError.resx} (89%) diff --git a/svnsync/Controllers/ControllersTray.cs b/svnsync/Controllers/ControllersTray.cs index 28cf74c..66d5fb7 100644 --- a/svnsync/Controllers/ControllersTray.cs +++ b/svnsync/Controllers/ControllersTray.cs @@ -190,6 +190,7 @@ namespace svnsync.Controllers controllerWindow.Dispose(); System.Windows.Forms.Application.DoEvents(); InitControllerWindow(); + viewTray.Model.Svn.ClearError(); Runner(); } diff --git a/svnsync/Form1.Designer.cs b/svnsync/Form1.Designer.cs deleted file mode 100644 index 7fa9b09..0000000 --- a/svnsync/Form1.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace svnsync -{ - partial class Form1 - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); - this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components); - this.SuspendLayout(); - // - // notifyIcon - // - this.notifyIcon.Icon = Properties.Resources.Icon; - this.notifyIcon.Text = "SvnSync"; - this.notifyIcon.Visible = true; - this.notifyIcon.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseDoubleClick); - // - // Form1 - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(370, 262); - this.Icon = Properties.Resources.Icon; - this.Name = "Form1"; - this.ShowInTaskbar = false; - this.Text = "SvnSync"; - this.WindowState = System.Windows.Forms.FormWindowState.Minimized; - this.Resize += new System.EventHandler(this.EventHandler_Resize); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.NotifyIcon notifyIcon; - } -} - diff --git a/svnsync/Form1.cs b/svnsync/Form1.cs deleted file mode 100644 index 102acd8..0000000 --- a/svnsync/Form1.cs +++ /dev/null @@ -1,537 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using BlubbFish.Utils; -using svnsync.Libraries; - -namespace svnsync -{ - public partial class Form1 : Form - { - enum HandleSvnType - { - NotInit, - ToMutchChronRuns, - HasVersionitedFiles, - UnexpectedError, - ExternDeletedFiles, - } - private CmdArgs c; - private Svn s; - public Form1(string[] args) - { - InitializeComponent(); - /*List l = new List(); - l.Add("/abc/Bla/Blubb/"); - l.Add("/Blubb/Foo/"); - l.Add("/Blubb/Bla/"); - l.Add("/Blubb/Bla/Foo"); - l.Add("/Blubb/Bla/Blubb"); - this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", l, new EventHandler(deleteButton_Click)); - */ - Dictionary pargs = new Dictionary(); - pargs.Add("-d", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Touple, true)); - pargs.Add("-cron", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single)); - pargs.Add("-autoadd", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single)); - pargs.Add("-autodelete", new CmdArgs.VaildArguments(CmdArgs.ArgLength.Single)); - this.c = CmdArgs.Instance; - this.c.SetArguments(pargs, args); - this.StartSvn(); - if (this.s != null) - { - this.notifyIcon.Text = "SvnSync: " + this.c.GetArgumentData("-d"); - } - this.Init(); - } - - private void Init() - { - if (this.c.HasArgumentType("-cron")) - if (this.cronJob(0, false)) - { - this.ShowToolTip("Svn Sync", "Datensicherung Erfolgreich\n" + this.c.GetArgumentData("-d").Replace("\\\\","\\"), ToolTipIcon.Info); - System.Threading.Thread.Sleep(5000); - this.Close(); - //Application.Exit(); - } - - } - - private bool cronJob(int run, bool readyToCommit) - { - if (s == null) - return this.HandleSvn(HandleSvnType.NotInit, ""); - if (run > 10) - return this.HandleSvn(HandleSvnType.ToMutchChronRuns, ""); - if (s.IsError) - return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - try - { - s.CheckStatus(); - } - catch (NotImplementedException e) - { - return this.HandleSvn(HandleSvnType.UnexpectedError, e.Message); - } - if (s.IsNotOnlyModified) - { - if (s.IsUncheckedFiles) - { - if (c.HasArgumentType("-autoadd")) - s.AddFiles(s.NoVersionFiles); - else - return this.HandleSvn(HandleSvnType.HasVersionitedFiles, ""); - } - if (s.IsError) - return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - if (s.IsExternDeletedFiles) - { - if (c.HasArgumentType("-autodelete")) - s.DeleteFiles(s.WasDeletedFiles); - else - return this.HandleSvn(HandleSvnType.ExternDeletedFiles, ""); - } - if (s.IsError) - return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - return this.cronJob(run + 1, true); - } - else - { - if (readyToCommit) - { - s.SetArgCheckIn(this.GetTimeStamp(DateTime.Now)); - if (s.IsError) - return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - } - else - { - s.Update(); - if (s.IsError) - return this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - return this.cronJob(run + 1, true); - } - } - return true; - } - - private bool HandleSvn(HandleSvnType handleSvnType, string p) - { - switch (handleSvnType) - { - case HandleSvnType.NotInit: - this.ShowToolTip("Svn Sync Fehler", "Svn wurde noch nicht inizialisiert", ToolTipIcon.Error); - return false; - case HandleSvnType.ToMutchChronRuns: - this.ShowToolTip("Svn Sync Fehler", "Fehler im Cronjob, mehr als 10 Aufrufe!", ToolTipIcon.Error); - this.CreateSVNOpen("Fehler im Cronjob, mehr als 10 Aufrufe!", ""); - return false; - case HandleSvnType.HasVersionitedFiles: - this.ShowToolTip("Svn Sync", "Es sind unversionierte Dateien vorhanden (?)", ToolTipIcon.Info); - this.CreateFileList("Hinzufügen", "Diese Daten sind unversioniert:", s.NoVersionFiles, new EventHandler(addButton_Click)); - return false; - case HandleSvnType.UnexpectedError: - this.ShowToolTip("Svn Sync Fehler", "Es ist ein Unvorhersebarer Fehler aufgetreten: " + p, ToolTipIcon.Error); - this.CreateSVNOpen("Es ist ein Unvorhersebarer Fehler aufgetreten", p); - return false; - case HandleSvnType.ExternDeletedFiles: - this.ShowToolTip("Svn Sync", "Es sind extern gelöschte Dateien vorhanden (!)", ToolTipIcon.Info); - this.CreateFileList("Löschen", "Diese Daten sind gelöscht worden:", s.WasDeletedFiles, new EventHandler(deleteButton_Click)); - return false; - } - return false; - } - - private void CreateFileList(string textlabel, string titel, List list, EventHandler eventHandler) - { - this.Controls.Clear(); - list.Sort(); - System.Windows.Forms.TreeView tree = new System.Windows.Forms.TreeView(); - tree.Location = new System.Drawing.Point(10, 30); - tree.Size = new System.Drawing.Size(350, 180); - tree.TabIndex = 0; - tree.Nodes.AddRange(this.createDirList(list)); - tree.CheckBoxes = true; - tree.HideSelection = false; - tree.ImageList = this.getImages(tree.Nodes); - this.Controls.Add(tree); - - System.Windows.Forms.Label label = new System.Windows.Forms.Label(); - label.AutoSize = true; - label.Location = new System.Drawing.Point(10, 10); - label.Size = new System.Drawing.Size(35, 13); - label.TabIndex = 1; - label.Text = titel; - this.Controls.Add(label); - - System.Windows.Forms.Button runButton = new System.Windows.Forms.Button(); - runButton.Location = new System.Drawing.Point(10, 217); - runButton.Size = new System.Drawing.Size(120, 23); - runButton.TabIndex = 2; - runButton.Text = textlabel; - runButton.UseVisualStyleBackColor = true; - runButton.Click += eventHandler; - this.Controls.Add(runButton); - - System.Windows.Forms.Button doAgainButton = new System.Windows.Forms.Button(); - doAgainButton.Location = new System.Drawing.Point(136, 216); - doAgainButton.Size = new System.Drawing.Size(120, 23); - doAgainButton.TabIndex = 3; - doAgainButton.Text = "Wiederholen"; - doAgainButton.UseVisualStyleBackColor = true; - doAgainButton.Click += new EventHandler(runagainButton_Click); - this.Controls.Add(doAgainButton); - - System.Windows.Forms.Button svnOpenButton = new System.Windows.Forms.Button(); - svnOpenButton.Location = new System.Drawing.Point(263, 216); - svnOpenButton.Size = new System.Drawing.Size(100, 23); - svnOpenButton.TabIndex = 4; - svnOpenButton.Text = "SVN Öffnen"; - svnOpenButton.UseVisualStyleBackColor = true; - svnOpenButton.Click += new EventHandler(openButton_Click); - this.Controls.Add(svnOpenButton); - } - - private ImageList getImages(TreeNodeCollection treeNodeCollection) - { - ImageList li = new ImageList(); - this.runThroughNodes(li.Images, treeNodeCollection); - return li; - } - private void runThroughNodes(ImageList.ImageCollection imageCollection, TreeNodeCollection treeNodeCollection) - { - foreach (TreeNode item in treeNodeCollection) - { - imageCollection.Add(this.getImageType(item.Text)); - item.ImageIndex = imageCollection.Count - 1; - item.Text = item.Text.Substring(0, item.Text.LastIndexOf(".")); - if (item.Nodes.Count > 0) - this.runThroughNodes(imageCollection, item.Nodes); - - } - } - private 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; - } - 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; } - } - private TreeNode[] createDirList(List tree) - { - String root = this.c.GetArgumentData("-d"); - 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 = this.treeMatch(ntree, prev); - } - return this.createListDirRender(ntree); - } - - private 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, this.createListDirRender(item.child)); - t[i - 1].Checked = true; - } - return t; - } - - private List treeMatch(List ntree, List input) - { - String[] key1 = this.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),*/ - this.treeMatch(findName(key1[0], ntree), findName(key1[0], input)); - } - else - { - findName(key1[0], ntree).Add(findName(key1[0], input)[0]); - } - } - } - return ntree; - } - - private void setChild(string key, List input, List list) - { - foreach (TreePart item in input) - { - if (item.name == key) - item.child = list; - } - } - - private List findName(string key, List input) - { - foreach (TreePart item in input) - { - if (item.name == key) - return item.child; - } - return null; - } - - private bool array_key_exists(string p, List ntree) - { - foreach (TreePart item in ntree) - { - if (item.name == p) - return true; - } - return false; - } - - private string[] array_keys(List input) - { - List ret = new List(); - foreach (TreePart item in input) - { - ret.Add(item.name); - } - return ret.ToArray(); - } - - - private TreePart treeMatch(TreePart ntree, TreePart prev) - { - throw new NotImplementedException(); - } - - private void CreateSVNOpen(string title, string message) - { - this.Controls.Clear(); - System.Windows.Forms.Label label = new System.Windows.Forms.Label(); - label.AutoSize = true; - label.Location = new System.Drawing.Point(10, 10); - label.Size = new System.Drawing.Size(350, 13); - label.TabIndex = 0; - label.Text = title; - this.Controls.Add(label); - - System.Windows.Forms.TextBox textBox = new System.Windows.Forms.TextBox(); - textBox.Location = new System.Drawing.Point(10, 30); - textBox.Multiline = true; - textBox.ReadOnly = true; - textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - textBox.Size = new System.Drawing.Size(350, 120); - textBox.TabIndex = 0; - textBox.Text = message; - this.Controls.Add(textBox); - - System.Windows.Forms.Button openButton = new System.Windows.Forms.Button(); - openButton.Location = new System.Drawing.Point(10, 160); - openButton.Size = new System.Drawing.Size(120, 23); - openButton.TabIndex = 0; - openButton.Text = "SVN Öffnen"; - openButton.UseVisualStyleBackColor = true; - openButton.Click += new EventHandler(openButton_Click); - this.Controls.Add(openButton); - - System.Windows.Forms.Button runagainButton = new System.Windows.Forms.Button(); - runagainButton.Location = new System.Drawing.Point(140, 160); - runagainButton.Size = new System.Drawing.Size(120, 23); - runagainButton.TabIndex = 0; - runagainButton.Text = "Wiederholen"; - runagainButton.UseVisualStyleBackColor = true; - runagainButton.Click += new EventHandler(runagainButton_Click); - this.Controls.Add(runagainButton); - } - - void runagainButton_Click(object sender, EventArgs e) - { - this.Controls.Clear(); - this.ShowInTaskbar = false; - this.WindowState = FormWindowState.Minimized; - this.Init(); - } - - void openButton_Click(object sender, EventArgs e) - { - System.Diagnostics.Process p = new System.Diagnostics.Process(); - p.StartInfo.FileName = "cmd"; - p.StartInfo.WorkingDirectory = this.c.GetArgumentData("-d"); - p.Start(); - } - - void deleteButton_Click(object sender, EventArgs e) - { - System.Windows.Forms.TreeView t = null; - foreach (var item in this.Controls) - { - if (item is System.Windows.Forms.TreeView) - { - t = (System.Windows.Forms.TreeView)item; - } - } - if (t == null) - return; - List l = this.getSelectedNodes(t.Nodes); - this.Controls.Clear(); - this.ShowInTaskbar = false; - this.WindowState = FormWindowState.Minimized; - s.DeleteFiles(l); - if (s.IsError) - { - this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - return; - } - this.runagainButton_Click(sender, null); - } - - private 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(this.getSelectedNodes(item.Nodes)); - } - return l; - } - - void addButton_Click(object sender, EventArgs e) - { - System.Windows.Forms.TreeView t = null; - foreach (var item in this.Controls) - { - if (item is System.Windows.Forms.TreeView) - { - t = (System.Windows.Forms.TreeView)item; - } - } - if (t == null) - return; - List l = this.getSelectedNodes(t.Nodes); - this.Controls.Clear(); - this.ShowInTaskbar = false; - this.WindowState = FormWindowState.Minimized; - s.AddFiles(l); - if (s.IsError) - { - this.HandleSvn(HandleSvnType.UnexpectedError, s.Error); - return; - } - this.runagainButton_Click(sender, null); - } - - private string GetTimeStamp(DateTime dateTime) - { - String ret = ""; - ret += dateTime.Year.ToString().PadLeft(4, '0'); - ret += dateTime.Month.ToString().PadLeft(2, '0'); - ret += dateTime.Day.ToString().PadLeft(2, '0'); - ret += "-"; - ret += dateTime.Hour.ToString().PadLeft(2, '0'); - ret += dateTime.Minute.ToString().PadLeft(2, '0'); - ret += dateTime.Second.ToString().PadLeft(2, '0'); - return ret; - } - private void StartSvn() - { - if (!this.c.HasArgumentType("-d")) - { - this.ShowToolTip("Svn Sync Fehler", "Kein Verzeichniss angegeben \"-d\" fehlt", ToolTipIcon.Error); - return; - } - if (this.c.GetArgumentData("-d") == null) - { - this.ShowToolTip("Svn Sync Fehler", "Kein Argument für \"-d\" angegeben", ToolTipIcon.Error); - return; - } - this.s = Svn.Instance; - this.s.SetDirectory(this.c.GetArgumentData("-d")); - } - - private void EventHandler_Resize(object sender, System.EventArgs e) - { - if (this.WindowState == FormWindowState.Minimized) - { - this.ShowInTaskbar = false; - this.WindowState = FormWindowState.Minimized; - } - } - - private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) - { - this.WindowState = FormWindowState.Normal; - this.ShowInTaskbar = true; - foreach (var item in this.Controls) - { - if (item is System.Windows.Forms.TreeView) - { - System.Windows.Forms.TreeView t = (System.Windows.Forms.TreeView)item; - t.ExpandAll(); - } - - } - } - - private void ShowToolTip(string title, string text, ToolTipIcon toolTipIcon) - { - this.notifyIcon.ShowBalloonTip(15000, title, text, toolTipIcon); - this.notifyIcon.BalloonTipClicked += new EventHandler(notifyIcon_BalloonTipClicked); - //Add to Notify Quene - } - - private void notifyIcon_BalloonTipClicked(object sender, EventArgs e) - { - this.notifyIcon_MouseDoubleClick(sender, null); - } - } -} diff --git a/svnsync/Libraries/Svn.cs b/svnsync/Libraries/Svn.cs index 0f0fe77..e9e6d21 100644 --- a/svnsync/Libraries/Svn.cs +++ b/svnsync/Libraries/Svn.cs @@ -89,7 +89,7 @@ namespace svnsync.Libraries { private void Runner(String arg) { this.SvnOutput = ""; - this.SvnError = ""; + this.ClearError(); this.p.StartInfo.Arguments = arg + " --non-interactive"; this.p.Start(); this.p.WaitForExit(); @@ -198,5 +198,9 @@ namespace svnsync.Libraries { return this.SvnError; } } + + internal void ClearError() { + this.SvnError = ""; + } } } diff --git a/svnsync/Properties/AssemblyInfo.cs b/svnsync/Properties/AssemblyInfo.cs index 3261b38..7694676 100644 --- a/svnsync/Properties/AssemblyInfo.cs +++ b/svnsync/Properties/AssemblyInfo.cs @@ -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.5.2")] -[assembly: AssemblyFileVersion("1.0.5.2")] +[assembly: AssemblyVersion("1.0.6.0")] +[assembly: AssemblyFileVersion("1.0.6.0")] [assembly: NeutralResourcesLanguageAttribute("de-DE")] diff --git a/svnsync/Views/ViewsWindow.cs b/svnsync/Views/ViewsWindow.cs index d1a80f3..9426cd0 100644 --- a/svnsync/Views/ViewsWindow.cs +++ b/svnsync/Views/ViewsWindow.cs @@ -17,38 +17,30 @@ namespace svnsync.Views public override void Update() { - Boolean change = false; switch(this.Model.FormType) { default: case Helpers.Handles.FormType.Normal: if(!(this.form is ViewsWindowForm)) { - change = true; + this.SwitchContext(new ViewsWindowForm()); + } + break; + case Helpers.Handles.FormType.Error: + if(!(this.form is ViewsWindowFormError)) { + this.SwitchContext(new ViewsWindowFormError()); } break; case Helpers.Handles.FormType.UnversionFiles: case Helpers.Handles.FormType.DeletedFiles: if(!(this.form is ViewsWindowFormFileList)) { - change = true; + this.SwitchContext(new ViewsWindowFormFileList()); } 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.UnversionFiles: - case Helpers.Handles.FormType.DeletedFiles: - this.form = new ViewsWindowFormFileList(); - break; - } + private void SwitchContext(ViewsWindowFormInterface newform) { + this.form = newform; this.form.SetModel(this.Model); this.form.Show(); } diff --git a/svnsync/Views/ViewsWindowFormError.Designer.cs b/svnsync/Views/ViewsWindowFormError.Designer.cs new file mode 100644 index 0000000..2eed385 --- /dev/null +++ b/svnsync/Views/ViewsWindowFormError.Designer.cs @@ -0,0 +1,115 @@ +namespace svnsync.Views { + partial class ViewsWindowFormError { + /// + /// 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.svnOpenButton = new System.Windows.Forms.Button(); + this.doAgainButton = new System.Windows.Forms.Button(); + this.errorgrid = new System.Windows.Forms.DataGridView(); + this.ecode = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.etype = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.etext = new System.Windows.Forms.DataGridViewTextBoxColumn(); + ((System.ComponentModel.ISupportInitialize)(this.errorgrid)).BeginInit(); + this.SuspendLayout(); + // + // svnOpenButton + // + this.svnOpenButton.Location = new System.Drawing.Point(312, 227); + this.svnOpenButton.Name = "svnOpenButton"; + this.svnOpenButton.Size = new System.Drawing.Size(140, 23); + this.svnOpenButton.TabIndex = 6; + this.svnOpenButton.Text = "SVN Öffnen"; + this.svnOpenButton.UseVisualStyleBackColor = true; + // + // doAgainButton + // + this.doAgainButton.Location = new System.Drawing.Point(164, 227); + this.doAgainButton.Name = "doAgainButton"; + this.doAgainButton.Size = new System.Drawing.Size(140, 23); + this.doAgainButton.TabIndex = 5; + this.doAgainButton.Text = "Wiederholen"; + this.doAgainButton.UseVisualStyleBackColor = true; + // + // errorgrid + // + this.errorgrid.AllowUserToAddRows = false; + this.errorgrid.AllowUserToDeleteRows = false; + this.errorgrid.AllowUserToOrderColumns = true; + this.errorgrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.errorgrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.ecode, + this.etype, + this.etext}); + this.errorgrid.Location = new System.Drawing.Point(12, 12); + this.errorgrid.Name = "errorgrid"; + this.errorgrid.ReadOnly = true; + this.errorgrid.ShowEditingIcon = false; + this.errorgrid.Size = new System.Drawing.Size(440, 209); + this.errorgrid.TabIndex = 7; + // + // ecode + // + this.ecode.HeaderText = "Fehlercode"; + this.ecode.Name = "ecode"; + this.ecode.ReadOnly = true; + this.ecode.Width = 70; + // + // etype + // + this.etype.HeaderText = "Fehlertyp"; + this.etype.Name = "etype"; + this.etype.ReadOnly = true; + this.etype.Width = 70; + // + // etext + // + this.etext.HeaderText = "Fehlertext"; + this.etext.Name = "etext"; + this.etext.ReadOnly = true; + this.etext.Width = 257; + // + // ViewsWindowFormError + // + 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.errorgrid); + this.Controls.Add(this.svnOpenButton); + this.Controls.Add(this.doAgainButton); + this.Name = "ViewsWindowFormError"; + this.Text = "ViewsWindowFormError"; + ((System.ComponentModel.ISupportInitialize)(this.errorgrid)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Button svnOpenButton; + private System.Windows.Forms.Button doAgainButton; + private System.Windows.Forms.DataGridView errorgrid; + private System.Windows.Forms.DataGridViewTextBoxColumn ecode; + private System.Windows.Forms.DataGridViewTextBoxColumn etype; + private System.Windows.Forms.DataGridViewTextBoxColumn etext; + } +} \ No newline at end of file diff --git a/svnsync/Views/ViewsWindowFormError.cs b/svnsync/Views/ViewsWindowFormError.cs new file mode 100644 index 0000000..28cb110 --- /dev/null +++ b/svnsync/Views/ViewsWindowFormError.cs @@ -0,0 +1,51 @@ +using svnsync.Controllers; +using svnsync.Models; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace svnsync.Views { + public partial class ViewsWindowFormError : Form, ViewsWindowFormInterface { + private ModelsWindow model; + public ViewsWindowFormError() { + InitializeComponent(); + this.FormClosed += ControllersWindow.FormClosed; + this.doAgainButton.Click += new EventHandler(ControllersTray.RunAgainButton_Click); + this.svnOpenButton.Click += new EventHandler(ControllersTray.SvnOpenButton_Click); + } + + public void UpdateForm() { + this.BeginInvoke((Action)(() => { + String[] messages = this.model.Message.Split('\n'); + foreach(String message in messages) { + if(message == "") { + continue; + } + Match r = new Regex("svn:.*(([WE])[0-9]*): (.*)",RegexOptions.IgnoreCase).Match(message); + if(r.Success) { + String ecode = r.Groups[2].Value.ToLower() == "w" ? "Warnung" : "Fehler"; + this.errorgrid.Rows.Add(new string[] { r.Groups[1].Value, ecode, r.Groups[3].Value}); + } + } + })); + } + + public void SetModel(ModelsWindow window) { + this.model = window; + } + new public void Dispose() { + this.BeginInvoke((Action)(() => { + this.Visible = false; + this.ShowInTaskbar = false; + })); + base.Dispose(true); + } + } +} diff --git a/svnsync/Form1.resx b/svnsync/Views/ViewsWindowFormError.resx similarity index 89% rename from svnsync/Form1.resx rename to svnsync/Views/ViewsWindowFormError.resx index b08701a..6c17da7 100644 --- a/svnsync/Form1.resx +++ b/svnsync/Views/ViewsWindowFormError.resx @@ -117,8 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - + + True + + + True + + + True + \ No newline at end of file diff --git a/svnsync/svnsync.csproj b/svnsync/svnsync.csproj index 64eff00..8f7a753 100644 --- a/svnsync/svnsync.csproj +++ b/svnsync/svnsync.csproj @@ -70,12 +70,6 @@ - - Form - - - Form1.cs - @@ -92,6 +86,12 @@ ViewsWindowForm.cs + + Form + + + ViewsWindowFormError.cs + Form @@ -99,9 +99,6 @@ ViewsWindowFormFileList.cs - - Form1.cs - ResXFileCodeGenerator Resources.Designer.cs @@ -115,6 +112,9 @@ ViewsWindowForm.cs + + ViewsWindowFormError.cs + ViewsWindowFormFileList.cs