[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) : base(message) { }
public SvnLockedException(String message, System.Exception inner) : base(message, inner) { } public SvnLockedException(String message, System.Exception inner) : base(message, inner) { }
protected SvnLockedException(System.Runtime.Serialization.SerializationInfo info, protected SvnLockedException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context) System.Runtime.Serialization.StreamingContext context) : base(info, context)
{ } { }
} }
public class TreePart { public class TreePart {

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
namespace svnsync.Libraries { namespace svnsync.Libraries {
class Svn { class Svn : IDisposable {
private String dir; private String dir;
private Process p = new Process(); private Process p = new Process();
private List<String> modified; private List<String> modified;
@ -202,5 +202,16 @@ namespace svnsync.Libraries {
internal void ClearError() { internal void ClearError() {
this.SvnError = ""; 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() { private static void Update() {
Updater.Instance.SetPath("https://svn.blubbfish.net:18082/"); 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 += Instance_UpdateResult; 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) { if(e.HasUpdates) {
((Updater)sender).Update("SvnSync.exe", "https://"); ((Updater)sender).Update("SvnSync.exe", "https://");
} }

View File

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

View File

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

View File

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

View File

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