[WP] Refactoring so its in common to C#

This commit is contained in:
BlubbFish 2017-04-23 21:07:41 +00:00
parent 8f27deca87
commit c793466e5e
7 changed files with 22 additions and 21 deletions

View File

@ -31,7 +31,7 @@ namespace svnsync.Helpers
public SvnLockedException(String message) : base(message) { }
public SvnLockedException(String message, System.Exception inner) : base(message, inner) { }
protected SvnLockedException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
System.Runtime.Serialization.StreamingContext context) : base(info, context)
{ }
}
public class TreePart {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
namespace svnsync.Libraries {
class Svn {
class Svn : IDisposable {
private String dir;
private Process p = new Process();
private List<String> modified;
@ -202,5 +202,16 @@ namespace svnsync.Libraries {
internal void ClearError() {
this.SvnError = "";
}
protected virtual void Dispose(Boolean disposing) {
if (disposing) {
this.p.Close();
}
}
public void Dispose() {
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@ -65,11 +65,12 @@ namespace svnsync
}
private static void Update() {
Updater.Instance.SetPath("https://svn.blubbfish.net:18082/");
Updater.Instance.UpdateResult += Instance_UpdateResult;
Updater.Instance.SetPath("https://svn.blubbfish.net:18082/", new String[] { typeof(Program).Assembly.GetName().Version.ToString(), typeof(Updater).Assembly.GetName().Version.ToString() });
Updater.Instance.UpdateResult += HasUpdate;
Updater.Instance.Check();
}
private static void Instance_UpdateResult(Object sender, Updater.UpdaterEventArgs e) {
private static void HasUpdate(Object sender, Updater.UpdaterEventArgs e) {
if(e.HasUpdates) {
((Updater)sender).Update("SvnSync.exe", "https://");
}

View File

@ -20,7 +20,7 @@ namespace svnsync.Views
/// View of a Tray
/// </summary>
public ViewsTray() {
this.Init();
this.Model = ModelsTray.Instance;
this.Model.SetObserver(this);
}

View File

@ -9,11 +9,6 @@ namespace svnsync.Views
{
private IViewsWindowFormInterface form;
public ModelsWindow Model { get; private set; }
public ViewsWindow()
{
this.Init();
}
public override void Update()
{

View File

@ -41,11 +41,8 @@ namespace svnsync.Views {
this.model = window;
}
new public void Dispose() {
this.BeginInvoke((Action)(() => {
this.Visible = false;
this.ShowInTaskbar = false;
}));
base.Dispose(true);
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@ -46,11 +46,8 @@ namespace svnsync.Views {
this.model = window;
}
new public void Dispose() {
this.BeginInvoke((Action)(() => {
this.Visible = false;
this.ShowInTaskbar = false;
}));
base.Dispose(true);
Dispose(true);
GC.SuppressFinalize(this);
}
}
}