[chronojump] ChronopicRegister window starts on first mode change if UNKNOWN Chronopic/s



commit 5b857a00909e649d98643aa29ff7ec463cd656f4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Oct 25 16:02:09 2016 +0200

    ChronopicRegister window starts on first mode change if  UNKNOWN Chronopic/s

 diagrams/classes/chronopicConnection-1-6-3.dia |  Bin 4307 -> 4439 bytes
 src/chronopic2016.cs                           |    4 ++++
 src/chronopicRegister.cs                       |    8 ++++++++
 src/gui/chronojump.cs                          |   13 +++++++++++--
 4 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/diagrams/classes/chronopicConnection-1-6-3.dia b/diagrams/classes/chronopicConnection-1-6-3.dia
index a6b2ab2..1e7b7c5 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/chronopic2016.cs b/src/chronopic2016.cs
index 17a003a..67dc322 100644
--- a/src/chronopic2016.cs
+++ b/src/chronopic2016.cs
@@ -29,8 +29,12 @@ public class Chronopic2016
                //this is constructed only one time
 
                FakeButtonContactsRealDone = new Gtk.Button();
+
+               WindowOpened = false;
        }
 
+       public bool WindowOpened;
+
        //used on contacts
        private Chronopic cp;
        private SerialPort sp;
diff --git a/src/chronopicRegister.cs b/src/chronopicRegister.cs
index e3c5a75..46f44ea 100644
--- a/src/chronopicRegister.cs
+++ b/src/chronopicRegister.cs
@@ -255,6 +255,14 @@ public abstract class ChronopicRegister
                return null;
        }
 
+       public bool UnknownFound()
+       {
+               if(NumConnectedOfType(ChronopicRegisterPort.Types.UNKNOWN) > 0)
+                       return true;
+
+               return false;
+       }
+
        public ChronopicRegisterPortList Crpl
        {
                get { return crpl; }
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 6e4661e..135af68 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -617,8 +617,6 @@ public partial class ChronoJumpWindow
                //this is constructed only one time
                cp2016 = new Chronopic2016();
 
-               //needed to initialize cp, sp, ...
-               chronopicRegisterUpdate(false);
 
                /*
                 * start a ping in other thread
@@ -2972,6 +2970,8 @@ public partial class ChronoJumpWindow
                //else if(wizardPortEncoder == "")
                //      autoDetectChronopic(m);
 
+               chronopicRegisterUpdate(false);
+
                chronojumpWindowTestsNext();
        }
 
@@ -6771,6 +6771,7 @@ LogB.Debug("X");
        {
                //chronopicRegisterUpdate(true);
        }
+
        private void chronopicRegisterUpdate(bool openWindow)
        {
                //on Windows need to close the port before reading with FTDI dll
@@ -6780,9 +6781,17 @@ LogB.Debug("X");
                ChronopicRegisterSelectOS cros = new ChronopicRegisterSelectOS();
                chronopicRegister = cros.Do();
 
+               /*
+                * openWindow: false, just generates the list,
+                * but if first time since cjump running and there are unknown Chronopics, window is opened
+                */
+               if(! cp2016.WindowOpened && chronopicRegister.UnknownFound())
+                       openWindow = true;
+
                if(openWindow) {
                        ChronopicRegisterWindow crWin = new ChronopicRegisterWindow(app1, 
chronopicRegister.Crpl.L);
                        crWin.FakeButtonCloseSerialPort.Clicked += new EventHandler(closeSerialPort);
+                       cp2016.WindowOpened = true;
                }
        }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]