[chronojump] chronopicConnection can be cancelled
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] chronopicConnection can be cancelled
- Date: Sun, 16 Oct 2016 13:19:46 +0000 (UTC)
commit a351a01c86962652b855aac4604f2666cf1a2868
Author: Xavier de Blas <xaviblas gmail com>
Date: Sun Oct 16 15:18:38 2016 +0200
chronopicConnection can be cancelled
diagrams/classes/chronopicConnection-1-6-3.dia | Bin 6837 -> 7229 bytes
src/chronopic.cs | 2 +-
src/chronopic2016.cs | 48 +++++++++++++++--------
src/gui/chronojump.cs | 2 +-
4 files changed, 33 insertions(+), 19 deletions(-)
---
diff --git a/diagrams/classes/chronopicConnection-1-6-3.dia b/diagrams/classes/chronopicConnection-1-6-3.dia
index d469147..e2d54dc 100644
Binary files a/diagrams/classes/chronopicConnection-1-6-3.dia and
b/diagrams/classes/chronopicConnection-1-6-3.dia differ
diff --git a/src/chronopic.cs b/src/chronopic.cs
index 94c007d..9e2d65f 100644
--- a/src/chronopic.cs
+++ b/src/chronopic.cs
@@ -489,7 +489,7 @@ public class ChronopicInit
LogB.Information("chronopicInit-4");
do {
LogB.Information("chronopicInit-5");
- ok=myCp.Read_platform(out myPS);
+ ok = myCp.Read_platform(out myPS);
LogB.Information("chronopicInit-6");
} while(! ok && ! CancelledByUser);
LogB.Information("chronopicInit-7");
diff --git a/src/chronopic2016.cs b/src/chronopic2016.cs
index 126093b..2cd037c 100644
--- a/src/chronopic2016.cs
+++ b/src/chronopic2016.cs
@@ -49,6 +49,8 @@ public class Chronopic2016
private Thread connectContactsRealThread;
//used to pass crp to connectContactsRealThread
private ChronopicRegisterPort crpConnectContactsRealThread;
+ private ChronopicInit chronopicInit;
+
public bool SuccededConnectContactsRealThread;
public Gtk.Button FakeButtonContactsRealDone;
@@ -75,24 +77,29 @@ public class Chronopic2016
progressbar = new Gtk.ProgressBar();
vbox_main.Add(progressbar);
+ Gtk.Button button_cancel = new Gtk.Button("Cancel");
+ button_cancel.Clicked += new EventHandler(on_button_cancel_clicked);
+ Gtk.HButtonBox hbox = new Gtk.HButtonBox ();
+ hbox.Add(button_cancel);
+ vbox_main.Add(hbox);
+
chronopic_contacts_real_win.ShowAll();
}
+ private void on_button_cancel_clicked(object o, EventArgs args)
+ {
+ cp.AbortFlush = true;
+ chronopicInit.CancelledByUser = true;
+ }
private void on_delete_event (object o, DeleteEventArgs args)
{
LogB.Information("calling on_delete_event");
args.RetVal = true;
- hideAndNull();
- }
- private void hideAndNull()
- {
- chronopic_contacts_real_win.Hide();
- chronopic_contacts_real_win = null;
+ on_button_cancel_clicked(new object(), new EventArgs());
}
-
public void ConnectContactsReal(Gtk.Window app1, ChronopicRegisterPort crp, string labelStr)
{
createGui(app1, labelStr);
@@ -114,10 +121,12 @@ public class Chronopic2016
bool success = false;
sp = new SerialPort(crp.Port);
- ChronopicInit chronopicInit = new ChronopicInit();
+ chronopicInit = new ChronopicInit();
bool connected = chronopicInit.Do(1, out cp, out sp,
platformState, crp.Port, out message, out success);
+ LogB.Information("Ended chronopicInit.Do()");
+
if(connected) {
lastConnectedRealPort = crp.Port;
lastConnectedRealSerialNumber = crp.SerialNumber;
@@ -155,14 +164,19 @@ public class Chronopic2016
FakeButtonContactsRealDone.Click();
}
+ private void hideAndNull()
+ {
+ chronopic_contacts_real_win.Hide();
+ chronopic_contacts_real_win = null;
+ }
public bool IsLastConnectedReal(ChronopicRegisterPort crp)
{
LogB.Information(string.Format(
"lastConnectedReal (port:{0}, serialNumber:{1}, type:{2})",
- lastConnectedRealPort, lastConnectedRealSerialNumber,
- lastConnectedRealType.ToString()));
+ lastConnectedRealPort, lastConnectedRealSerialNumber,
+ lastConnectedRealType.ToString()));
LogB.Information(crp.ToString());
if(lastConnectedRealPort != "" && lastConnectedRealSerialNumber != "" &&
@@ -231,14 +245,14 @@ public class Chronopic2016
/*
* method 1. Unused
- try {
- ChronopicAuto ca = new ChronopicAutoCheck();
- //problems with windows using this:
- string chronopicVersion = ca.Read(chronopicWin.SP);
- LogB.Debug("version: " + chronopicVersion);
+ try {
+ ChronopicAuto ca = new ChronopicAutoCheck();
+ //problems with windows using this:
+ string chronopicVersion = ca.Read(chronopicWin.SP);
+ LogB.Debug("version: " + chronopicVersion);
} catch {
- LogB.Information("Could not read from Chronopic with method 1");
- return;
+ LogB.Information("Could not read from Chronopic with method 1");
+ return;
}*/
//---- 4 try to communicate with multitest firmware (return if cannot connect)
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 53bb2d5..7208851 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3703,7 +3703,7 @@ public partial class ChronoJumpWindow
changeMultitestFirmwareIfNeeded();
on_button_execute_test_accepted();
} else
- LogB.Warning("Failure at Connecting real!");
+ LogB.Warning("Failure at Connecting real! (main GUI)");
}
void on_button_execute_test_accepted ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]