svnsync/svnsync/Views/ViewsWindowFormError.cs

49 lines
1.5 KiB
C#

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, IViewsWindowFormInterface {
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() {
Dispose(true);
GC.SuppressFinalize(this);
}
}
}