Beispiel #1
0
    /* ---------------------------------------------------------
     * ----------------  MULTI CHRONOPIC EXECUTION -------------
     *  --------------------------------------------------------
     */
    //recreate is used when a Chronopic was disconnected
    private void createChronopicWindow(bool recreate)
    {
        ArrayList cpd = new ArrayList();
        for(int i=1; i<=4;i++) {
            ChronopicPortData a = new ChronopicPortData(i,"",false);
            cpd.Add(a);
        }

        chronopicWin = ChronopicWindow.Create(cpd, recreate, volumeOn);
        //chronopicWin.FakeButtonCancelled.Clicked += new EventHandler(on_chronopic_window_cancelled);
        chronopicLabels(0);
    }
Beispiel #2
0
    //check if user has disconnected chronopic or port has changed
    private void checkChronopicDisconnected()
    {
        bool errorFound = false;

        foreach (ChronopicPortData a in cpd)
        {
            Chronopic            myCP;
            Chronopic.Plataforma myPS;
            if (a.Num == 1)
            {
                myCP = cp;
                myPS = platformState;
            }
            else if (a.Num == 2)
            {
                myCP = cp2;
                myPS = platformState2;
            }
            else if (a.Num == 3)
            {
                myCP = cp3;
                myPS = platformState3;
            }
            else
            {
                myCP = cp4;
                myPS = platformState4;
            }

            bool ok = false;
            if (a.Connected)
            {
                string myPort = a.Port;

                //http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=88415
                //https://bugzilla.xamarin.com/show_bug.cgi?id=15514
                if (!isWindows)
                {
                    if (!File.Exists(myPort))
                    {
                        LogB.Error("port does not exists:", myPort);
                        errorFound = true;
                    }
                }

                if (!errorFound)
                {
                    //try {
                    ok = myCP.Read_platform(out myPS);
                    //} catch {
                    //	LogB.DebugLine("catch at 1");
                    //}
                    if (!ok)
                    {
                        LogB.Error("false at 1");
                        errorFound = true;
                    }
                }
            }
        }

        if (errorFound)
        {
            ArrayList myCPD = new ArrayList();
            for (int i = 1; i <= 4; i++)
            {
                ChronopicPortData b = new ChronopicPortData(i, "", false);
                myCPD.Add(b);
            }
            Create(myCPD, encoderPort, true, volumeOn);

            connected = false;

            new DialogMessage(Constants.MessageTypes.WARNING,
                              Catalog.GetString("One or more Chronopics have been disconnected.") + "\n" +
                              Catalog.GetString("Please connect again, and configure on Chronopic window."));
        }
    }
Beispiel #3
0
    //check if user has disconnected chronopic or port has changed
    private void checkChronopicDisconnected()
    {
        bool errorFound = false;

        foreach(ChronopicPortData a in cpd) {
            Chronopic myCP;
            Chronopic.Plataforma myPS;
            if(a.Num == 1) {
                myCP = cp;
                myPS = platformState;
            } else if(a.Num == 2) {
                myCP = cp2;
                myPS = platformState2;
            } else if(a.Num == 3) {
                myCP = cp3;
                myPS = platformState3;
            } else {
                myCP = cp4;
                myPS = platformState4;
            }

            bool ok = false;
            if(a.Connected) {
                string myPort = a.Port;

                //http://www.raspberrypi.org/forums/viewtopic.php?f=66&t=88415
                //https://bugzilla.xamarin.com/show_bug.cgi?id=15514
                if(! isWindows) {
                    if(! File.Exists(myPort)) {
                        LogB.Error("port does not exists:", myPort);
                        errorFound = true;
                    }
                }

                if(! errorFound) {
                    //try {
                    ok = myCP.Read_platform(out myPS);
                    //} catch {
                    //	LogB.DebugLine("catch at 1");
                    //}
                    if(!ok) {
                        LogB.Error("false at 1");
                        errorFound = true;
                    }
                }
            }
        }

        if(errorFound) {
            ArrayList myCPD = new ArrayList();
            for(int i=1; i<=4; i++) {
                ChronopicPortData b = new ChronopicPortData(i,"",false);
                myCPD.Add(b);
            }
            Create (myCPD, encoderPort, true, volumeOn);

            connected = false;

            new DialogMessage(Constants.MessageTypes.WARNING,
                    Catalog.GetString("One or more Chronopics have been disconnected.") + "\n" +
                    Catalog.GetString("Please connect again, and configure on Chronopic window."));
        }
    }
Beispiel #4
0
    //check if user has disconnected chronopic or port has changed
    private void checkChronopicDisconnected()
    {
        foreach(ChronopicPortData a in cpd) {
            Chronopic myCP;
            Chronopic.Plataforma myPS;
            if(a.Num == 1) {
                myCP = cp;
                myPS = platformState;
            } else if(a.Num == 2) {
                myCP = cp2;
                myPS = platformState2;
            } else if(a.Num == 3) {
                myCP = cp3;
                myPS = platformState3;
            } else { //if(a.Num == 4) {
                myCP = cp4;
                myPS = platformState4;
            }

            int errorCount = 0;
            bool ok = false;
            if(a.Connected) {
                //try {
                    ok = myCP.Read_platform(out myPS);
                //} catch {
                //	Log.WriteLine("catch at 1");
                //}
                if(!ok) {
                    Log.WriteLine("false at 1");
                    errorCount ++;
                }
            }
            if(errorCount > 0) {
                ArrayList myCPD = new ArrayList();
                for(int i=1; i<=4;i++) {
                    ChronopicPortData b = new ChronopicPortData(i,"",false);
                    myCPD.Add(b);
                }
                Create (myCPD, true, volumeOn);
                new DialogMessage(Constants.MessageTypes.WARNING,
                        Catalog.GetString("One or more Chronopics have been disconnected.") + "\n" +
                        Catalog.GetString("Please connect again, and configure on Chronopic window."));
            }
        }
    }