Information() 공개 정적인 메소드

public static Information ( string message ) : void
message string
리턴 void
예제 #1
0
    //typical constructor
    public PersonOld(string name, string sex, DateTime dateBorn,
                     double height, double weight, int sportID, int speciallityID, int practice, string description,
                     int race, int countryID, int serverUniqueID,
                     int sessionID)
    {
        name        = Util.RemoveTildeAndColon(name);
        description = Util.RemoveTildeAndColon(description);

        this.name           = name;
        this.sex            = sex;
        this.dateBorn       = dateBorn;
        this.height         = height;
        this.weight         = weight;
        this.sportID        = sportID;
        this.speciallityID  = speciallityID;
        this.practice       = practice;
        this.description    = description;
        this.race           = race;
        this.countryID      = countryID;
        this.serverUniqueID = serverUniqueID;         //remember don't do this on server
        this.sessionID      = sessionID;

        //insert in the person table
        //when insert as person we don't know uniqueID
        uniqueID = -1;
        int insertedID = this.InsertAtDB(false, Constants.PersonOldTable);

        //we need uniqueID for personSession
        uniqueID = insertedID;

        LogB.Information(this.ToString());

        //insert in the personSession table (fast way of knowing who was in each session)
        SqlitePersonSessionOld.Insert(false, Constants.PersonSessionOldWeightTable, "-1", uniqueID, sessionID, weight);
    }
예제 #2
0
    //typical constructor with personsSport stuff
    //this inserts the session in SQL
    public Session(string newName, string newPlace, DateTime newDate,
                   int personsSportID, int personsSpeciallityID, int personsPractice,
                   string comments, int serverUniqueID)
    {
        name  = newName;
        place = newPlace;
        date  = newDate;
        this.personsSportID       = personsSportID;
        this.personsSpeciallityID = personsSpeciallityID;
        this.personsPractice      = personsPractice;

        name                = Util.RemoveTildeAndColon(name);
        place               = Util.RemoveTildeAndColon(place);
        this.comments       = Util.RemoveTildeAndColon(comments);
        this.serverUniqueID = serverUniqueID;         //remember don't do this on server

        /*
         * uniqueID = SqliteSession.Insert (false, //dbconOpened,
         *              Constants.SessionTable, name, place, date, personsSportID, personsSpeciallityID, personsPractice, comments, serverUniqueID);
         */
        uniqueID = -1;
        int insertedID = this.InsertAtDB(false, Constants.SessionTable);

        //we need uniqueID for personSession
        uniqueID = insertedID;


        LogB.Information(this.ToString());
    }
예제 #3
0
    /*
     * don't use this because in linux R script can be called by:
     * "/usr/lib/R/bin/exec/R"
     * and it will not be found passing "R" or "*R"
     * private bool isRunningThisProcess(string name)
     * {
     *      Process [] pids = Process.GetProcessesByName(name);
     *      foreach (Process myPid in pids) {
     *              LogB.Debug(string.Format("pids id: {0}", myPid.Id));
     *              if (myPid.Id == Convert.ToInt32(p.Id))
     *                      return true;
     *      }
     *
     *      return false;
     * }
     */

    public static bool IsFileLocked(FileInfo finfo)
    {
        LogB.Information("Checking file lock at IsFileLocked ...");
        //https://stackoverflow.com/a/937558
        FileStream stream = null;

        try {
            stream = finfo.Open(FileMode.Open, FileAccess.Read, FileShare.None);
        }
        catch (IOException) {
            //the file is unavailable because it is:
            //still being written to
            //or being processed by another thread
            //or does not exist (has already been processed)
            LogB.Information("Catched! at IsFileLocked: is locked!");
            return(true);
        }
        finally {
            if (stream != null)
            {
                stream.Close();
            }
        }

        //file is not locked
        LogB.Information("is NOT locked!");
        return(false);
    }
예제 #4
0
    public void Detect(string mode)
    {
        //set variables
        cancel    = false;
        Detected  = "";
        Detecting = true;
        connectedNormalChronopic = false;

        progressbar.Text            = Constants.ChronopicDetecting;
        needToChangeProgressbarText = false;


        if (mode == "ENCODER")
        {
            LogB.Information("Detecting encoder... ");
            thread = new Thread(new ThreadStart(detectEncoder));
        }
        else
        {
            LogB.Information("Detecting normal Chronopic... ");
            thread = new Thread(new ThreadStart(detectNormal));
        }

        GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));

        LogB.ThreadStart();
        thread.Start();
    }
예제 #5
0
    public static void WakeUpRaspberryIfNeeded()
    {
        string        executable = "xset";
        List <string> parameters = new List <string>();

        parameters.Insert(0, "-q");
        ExecuteProcess.Result execute_result = ExecuteProcess.run(executable, parameters);

        bool on = screenIsOn(execute_result.stdout);

        LogB.Information("Screen is on?" + on.ToString());

        if (!on)
        {
            //xset -display :0 dpms force on
            parameters = new List <string>();
            parameters.Insert(0, "-display");
            parameters.Insert(1, ":0");
            parameters.Insert(2, "dpms");
            parameters.Insert(3, "force");
            parameters.Insert(4, "on");
        }

        execute_result = ExecuteProcess.run(executable, parameters);
        LogB.Information("Result = " + execute_result.stdout);
    }
예제 #6
0
    private bool PulseGTK()
    {
        if (cancel || !thread.IsAlive)
        {
            LogB.ThreadEnding();

            if (cancel)
            {
                thread.Abort();
            }

            LogB.Information("Connected = " + connectedNormalChronopic.ToString());

            FakeButtonDone.Click();             //send signal to gui/chronojump.cs to read Detected
            Detecting = false;

            LogB.ThreadEnded();
            return(false);
        }

        progressbar.Pulse();

        if (needToChangeProgressbarText)
        {
            progressbar.Text            = Constants.ChronopicNeedTouch;
            needToChangeProgressbarText = false;
        }

        Thread.Sleep(50);
        LogB.Debug(thread.ThreadState.ToString());
        return(true);
    }
예제 #7
0
    private bool make(SerialPort sp)
    {
        this.sp = sp;

        if (sp == null)
        {
            return(false);
        }

        LogB.Information("opening port... ");
        try {
            if (sp != null)
            {
                if (sp.IsOpen)
                {
                    sp.Close();                     //close to ensure no bytes are comming
                }
            }
            sp.Open();
        } catch {
            LogB.Warning("catched!");
            return(false);
        }
        LogB.Information("opened");

        if (IsEncoder)
        {
            setEncoderBauds();
        }

        str = "";
        return(true);
    }
예제 #8
0
    public string [] GetStringArray()
    {
        string [] str = new string [lname.Count()];
        int       i   = 0;

        foreach (IDName iname in lname.l)
        {
            str[i++] = iname.ToString();
        }

        //read every list
        foreach (IDDoubleList ldoublelist in ldoublelistoflists)
        {
            LogB.Information(ldoublelist.ToString());

            //find if exists a record on this list for the uniqueID on lname
            i = 0;
            foreach (IDName iname in lname.l)
            {
                double d = ldoublelist.FindDouble(iname.UniqueID);
                if (d == -1)
                {
                    str[i++] += ":" + "-";
                }
                else
                {
                    str[i++] += ":" + d.ToString();
                }
            }
        }
        return(str);
    }
예제 #9
0
    //chronopic init should not touch  gtk, for the threads
    public bool Do(int currentCp, out Chronopic myCp, out SerialPort mySp, Chronopic.Plataforma myPS, string myPort, out string returnString, out bool success)
    {
        LogB.Information("starting connection with chronopic");

        CancelledByUser = false;
        success         = true;

        LogB.Information("chronopicInit-1");
        LogB.Information(string.Format("chronopic port: {0}", myPort));
        mySp = new SerialPort(myPort);
        try {
            mySp.Open();
            LogB.Information("chronopicInit-2");
            //-- Create chronopic object, for accessing chronopic
            myCp = new Chronopic(mySp);

            LogB.Information("chronopicInit-2.1");
            myCp.Flush();

            //if myCp has been cancelled
            if (myCp.AbortFlush)
            {
                LogB.Information("chronopicInit-2.2 cancelled");
                success = false;
                myCp    = new Chronopic();              //fake constructor
            }
            else
            {
                LogB.Information("chronopicInit-3");
                //on windows, this check make a crash
                //i think the problem is: as we don't really know the Timeout on Windows (.NET) and this variable is not defined on chronopic.cs
                //the Read_platform comes too much soon (when cp is not totally created), and this makes crash

                //-- Obtener el estado inicial de la plataforma

                bool ok = false;
                LogB.Information("chronopicInit-4");
                do
                {
                    LogB.Information("chronopicInit-5");
                    ok = myCp.Read_platform(out myPS);
                    LogB.Information("chronopicInit-6");
                } while(!ok && !CancelledByUser);
                LogB.Information("chronopicInit-7");
                if (!ok)
                {
                    //-- Si hay error terminar
                    LogB.Error(string.Format("Error: {0}", myCp.Error));
                    success = false;
                }
            }
        } catch {
            LogB.Error("chronopicInit-2.a catched");
            success = false;
            myCp    = new Chronopic();          //fake constructor
        }

        returnString = "";
        return(success);
    }
    public bool CaptureBG()
    {
        LogB.Information("CaptureBG!");
        sp.Open();
        LogB.Information("sp opened");

        int byteReaded;

        do
        {
            try {
                byteReaded = readByte();
            } catch {
                LogB.Error("ERROR at InertialCaptureBackground: Maybe encoder cable is disconnected");
                return(false);
            }

            byteReaded = convertByte(byteReaded);
            angleNow  += byteReaded;

            if (StoreData)
            {
                EncoderCaptureInertialBackgroundStatic.ListCaptured.Add(byteReaded);
            }
            //LogB.Information("angleNow = " + angleNow.ToString());
        } while (!finishBG);

        sp.Close();
        return(true);
    }
예제 #11
0
    //height can be -1 to maintain aspect ratio
    public static bool ImageSurfaceResize(ImageSurface imgSurface, string filename_dest,
                                          int width, int height)
    {
        //maintain aspect ratio
        if (height == -1)
        {
            double ratioOriginal = imgSurface.Width / (1.0 * imgSurface.Height);
            height = Convert.ToInt32(width / ratioOriginal);
        }

        //return if problems on calculating aspect ratio
        if (width <= 0 || height <= 0)
        {
            return(false);
        }

        Surface surfaceResized = scale_surface(
            imgSurface, imgSurface.Width, imgSurface.Height, width, height);

        LogB.Information("ImageFileResize - " + filename_dest);
        try {
            surfaceResized.WriteToPng(filename_dest);
        } catch {
            LogB.Warning("Catched at ImageFileResize");
            return(false);
        }

        return(true);
    }
예제 #12
0
    //At YOMO free network without transaction each record needs 0.9 seconds
    //At YOMO free network with transaction each record needs 0.3 seconds
    public static void UploadExhibitionTestsPending()
    {
        Json json = new Json();

        Sqlite.Open();         // ---------------->

        int countSucceded = 0;
        List <ExhibitionTest> listEtTemp = SqliteJson.SelectTempExhibitionTest(true);

        if (listEtTemp.Count > 0)
        {
            LogB.Information("Starting to upload {0} exhibitionTests...");
            using (SqliteTransaction tr = dbcon.BeginTransaction())
            {
                using (SqliteCommand dbcmdTr = dbcon.CreateCommand())
                {
                    dbcmdTr.Transaction = tr;

                    foreach (ExhibitionTest et in listEtTemp)
                    {
                        bool success = json.UploadExhibitionTest(et);
                        //LogB.Information(json.ResultMessage);
                        if (success)
                        {
                            countSucceded++;
                            SqliteJson.DeleteTempExhibitionTest(true, et, dbcmdTr);                             //delete the record
                        }
                    }
                }
                tr.Commit();
            }
            LogB.Information(string.Format("Done! succeded {0}/{1}", countSucceded, listEtTemp.Count));
        }
        Sqlite.Close();         // <----------------
    }
예제 #13
0
 private void on_SQL_stress_test_not_safe_long_clicked(object o, EventArgs args)
 {
     LogB.Information("start not safe long stress test ---->");
     Sqlite.SafeClose = false;
     sql_stress_test(4000);
     Sqlite.SafeClose = true;
 }
예제 #14
0
    void on_button_logs_folder_open_clicked(object o, EventArgs args)
    {
        string dir = UtilAll.GetLogsDir();

        LogB.Information(dir);

        if (!new System.IO.DirectoryInfo(dir).Exists)
        {
            try {
                Directory.CreateDirectory(dir);
            } catch {
                new DialogMessage(Constants.MessageTypes.WARNING,
                                  Catalog.GetString("Cannot create directory.") + "\n\n" + dir);
                return;
            }
        }

        try {
            System.Diagnostics.Process.Start(dir);
        }
        catch {
            new DialogMessage(Constants.MessageTypes.WARNING,
                              Constants.DirectoryCannotOpen + "\n\n" + dir);
        }
    }
예제 #15
0
    bool progressbarEncoderDo()
    {
        LogB.Information("progressbarEncoderDo");
        if (!progressbarContinue)
        {
            return(false);
        }

        //will be each 500 ms (because progressbarEncoderDo is called each 50 ms)
        if (progressbarCount >= 10)
        {
            LogB.Information("Wizard detecting encoder");

            progressbarCount = 0;
            ArrayList newPorts = detectPorts();
            if (newPorts.Count > 0)
            {
                progressbarContinue = false;
                detectedEncoder(newPorts);
                return(false);
            }
        }
        else
        {
            progressbarCount++;
        }

        progressbar_encoder.Pulse();
        return(true);
    }
예제 #16
0
    private void button_start_clicked(object o, EventArgs args)
    {
        Button buttonClicked = o as Button;

        if (o == null)
        {
            return;
        }

        int count = 0;

        foreach (Gtk.Button button in list_buttons_start)
        {
            if (button == buttonClicked)
            {
                LogB.Information("Clicked button start: " + count.ToString());

                taskActive = list_tasks_fixed[count];
                Fake_button_start_task.Click();

                return;
            }
            count++;
        }
    }
예제 #17
0
    private string parseSupportedMode(string l)     //TODO: currently only for mac
    {
        if (!l.Contains("avfoundation"))
        {
            return("");
        }

        //parse this:
        //	[avfoundation @ 0x7f849a8be800]   1280x720@[23.999981 23.999981]fps
        //use: https://regex101.com/r/lZ5mN8/50
        //  (\d+)x(\d+)@\[(\d+).(\d+)\s+

        Match match = Regex.Match(l, @"(\d+)x(\d+)@\[(\d+).(\d+)\s+");

        //TODO: use these lines
        //LogB.Information("match group count: ", match.Groups.Count.ToString());
        //if(match.Groups.Count != 5) //first is all match, second is the first int (width), last one is the decimals of the resolution
        //	return "";
        LogB.Information("match group count is 5?", (match.Groups.Count == 5).ToString());
        LogB.Information("match group count is -5?", (match.Groups.Count == -5).ToString());

        return(string.Format("{0}x{1}    {2}.{3}",         //resolution    framerate
                             match.Groups[1].Value, match.Groups[2].Value,
                             match.Groups[3].Value, match.Groups[4].Value));
    }
예제 #18
0
    private void button_done_clicked(object o, EventArgs args)
    {
        Button buttonClicked = o as Button;

        if (o == null)
        {
            return;
        }

        int count = 0;

        foreach (Gtk.Button button in list_buttons_done)
        {
            if (button == buttonClicked)
            {
                LogB.Information("Clicked button done: " + count.ToString());

                Json json = new Json();
                json.UpdateTask(list_buttons_done_id[count], 1);

                //button.Sensitive = false;
                //list_buttons_start[count].Sensitive = false;
                //list_labels[count].Sensitive = false;
                list_hboxs_row[count].Sensitive = false;

                return;
            }
            count++;
        }
    }
예제 #19
0
    private void autoDetect(ChronopicAuto caNormal)
    {
        LogB.Information("starting port detection");

        string [] usbSerial = ChronopicPorts.GetPorts();

        bool first = true;

        foreach (string port in usbSerial)
        {
            if (configAutoDetect == Config.AutodetectPortEnum.DISCARDFIRST && first)
            {
                first = false;
                LogB.Warning("Discarded port = ", port);
                continue;
            }

            SerialPort sp = new SerialPort(port);

            LogB.Information("searching normal Chronopic at port: ", port);
            string readed = caNormal.Read(sp);

            if (caNormal.Found == ChronopicType.NORMAL)            //We found a normal Chronopic
            {
                if (searched == ChronopicType.NORMAL)              //normal Chronopic is what we are searching
                {
                    Detected = port;
                    return;
                }
                else
                {
                    /*
                     * else:
                     * means that we are searching for an encoder chronopic and found a normal
                     * so don't try to search for an encoder on that port, because 115200 bauds will saturate it
                     */
                    LogB.Information("our goal is to search encoder but found normal Chronopic at port: ", port);
                }
            }
            else if (searched == ChronopicType.ENCODER)
            {
                /*
                 * we are searching an encoder
                 * if we arrived here, we know is not a normal chronopic
                 * then wecan search safely for an encoder here
                 */
                ChronopicAuto caEncoder = new ChronopicAutoCheckEncoder();
                caEncoder.IsEncoder = true;                    //for the bauds.

                LogB.Information("searching encoder Chronopic at port: ", port);
                readed = caEncoder.Read(sp);
                if (caEncoder.Found == ChronopicType.ENCODER)
                {
                    Detected = port;
                    return;
                }
            }
        }
        Detected = "";
    }
예제 #20
0
    /*
     * if there are double contacts problems and first contacts are very close,
     * R algorithm gets very slow and program seems frozen
     */
    public bool IsDataOk()
    {
        List <double> speedsL  = speedAsDoubleL();
        double        speedMax = -1;
        int           trackMax = 1;
        int           count    = 1;

        foreach (double speed in speedsL)
        {
            LogB.Information("speed: " + speed.ToString());
            if (speedMax < 0)
            {
                speedMax = speed;
            }
            else if ((2 * speed) < speedMax)
            {
                errorMessage = string.Format(
                    Catalog.GetString("Track {0} ({1} m/s) is much faster than track {2} ({3} m/s)."),
                    trackMax, Math.Round(speedMax, 2), count, Math.Round(speed, 2));
                return(false);
            }
            else if (speed > speedMax)
            {
                speedMax = speed;
                trackMax = count;
            }

            count++;
        }

        errorMessage = "";
        return(true);
    }
예제 #21
0
    protected internal override string Communicate()
    {
        LogB.Information("Communicate start ...");

        Found = ChronopicAutoDetect.ChronopicType.UNDETECTED;

        char myByte;

        for (int i = 0; i < 100; i++)         //try 100 times (usually works on Linux 3-5 try, Mac 8-10, Windows don't work < 20... trying bigger numbers)
        {
            LogB.Debug("writting ...");

            sp.Write("J");

            LogB.Debug("reading ...");

            myByte = (char)sp.ReadByte();

            LogB.Debug("readed");
            if (myByte != null && myByte.ToString() != "")
            {
                LogB.Information(myByte.ToString());
            }

            if (myByte == 'J')
            {
                LogB.Information("Encoder found!");

                Found = ChronopicAutoDetect.ChronopicType.ENCODER;
                return("1");
            }
        }

        return("0");
    }
예제 #22
0
    public override void SimulateInitValues(Random randSent)
    {
        LogB.Information("From execute/jump.cs");

        rand      = randSent;    //we send the random, because if we create here, the values will be the same for each nbew instance
        simulated = true;
        simulatedTimeAccumulatedBefore = 0;
        simulatedTimeLast       = 0;
        simulatedContactTimeMin = 0.2;        //seconds
        simulatedContactTimeMax = 0.37;       //seconds
        simulatedFlightTimeMin  = 0.4;        //seconds
        simulatedFlightTimeMax  = 0.7;        //seconds

        if (hasFall)
        {
            //values of simulation will be the contactTime
            //at the first time, the second will be flightTime
            simulatedCurrentTimeIntervalsAreContact = true;
        }
        else
        {
            //values of simulation will be the flightTime
            //at the first time (and the only)
            simulatedCurrentTimeIntervalsAreContact = false;
        }
    }
예제 #23
0
    private bool findRFIDPort(List <string> l)
    {
        foreach (string p in l)
        {
            LogB.Information("portName: " + p);
            port = new SerialPort(p, 9600); //for the rfid
            port.Open();
            Thread.Sleep(3000);             //sleep to let arduino start reading

            if (port.BytesToRead > 0)
            {
                LogB.Information("portReading: " + port.ReadExisting());
            }
            //send welcome message
            port.WriteLine("Chronojump RFID");

            string str = port.ReadLine();
            LogB.Information("str: " + str);
            if (str.StartsWith("YES Chronojump RFID"))
            {
                LogB.Information("Arduino RFID found on port: " + p);
                return(true);
            }
            else
            {
                LogB.Information("Arduino RFID NOT found on port: " + p);
            }

            port.Close();
        }
        return(false);
    }
예제 #24
0
    private void on_button_portrait_clicked(object o, EventArgs args)
    {
        LogB.Information("Clicked");

        //access the button
        Button b = (Button)o;

        foreach (PersonPhotoButton ppb in list_ppb)
        {
            if (ppb.Button == b)
            {
                if (ppb.PersonID == selectedFirstClickPersonID)
                {
                    FakeButtonDone.Click();
                    close_window();
                    return;
                }

                ppb.Select(true);

                foreach (Person p in persons)
                {
                    if (p.UniqueID == ppb.PersonID)
                    {
                        assignPersonSelectedStuff(p);
                    }
                }
            }
            else if (ppb.Selected)
            {
                ppb.Select(false);
            }
        }
    }
예제 #25
0
    private static bool screenIsOn(string contents)
    {
        LogB.Information(contents);
        string line;

        using (StringReader reader = new StringReader(contents)) {
            do
            {
                line = reader.ReadLine();

                if (line == null)
                {
                    break;
                }

                if (line.StartsWith("  Monitor is On"))
                {
                    return(true);
                }
                else if (line.StartsWith("  Monitor is in Standby"))
                {
                    return(false);
                }
                else if (line.StartsWith("  Monitor is Off"))
                {
                    return(false);
                }
            } while(true);
        }
        return(true);        //by default screen is on. If detection is wrong user can touch screen
    }
    public override WebcamDeviceList GetDevices()
    {
        LogB.Information("GetDevices");
        LogB.Information(string.Format("wd_list is null: ", wd_list == null));
        string prefix = "/dev/";
        var    dir    = new DirectoryInfo(prefix);
        bool   found  = false;

        foreach (var file in dir.EnumerateFiles("video*"))
        {
            /*
             * return 0, 1, ...
             * if( file.Name.Length > 5 &&              //there's something more than "video", like "video0" or "video1", ...
             * char.IsNumber(file.Name, 5) )        //and it's a number
             * list.Add(Convert.ToInt32(file.Name[5]));             //0 or 1, or ...
             */
            //return "/dev/video0", "/dev/video1", ...
            wd_list.Add(new WebcamDevice(
                            prefix + file.Name,
                            prefix + file.Name + " (default camera)"));
            found = true;
        }
        if (!found)
        {
            wd_list.Error = Constants.CameraNotFound;
        }

        return(wd_list);
    }
예제 #27
0
    //typical constructor
    //used when we create new person
    //we don't know uniqueID
    public Person(string name, string sex, DateTime dateBorn, int race, int countryID, string description, string future1,
                  int serverUniqueID, bool dbconOpened)
    {
        name        = Util.RemoveTildeAndColon(name);
        description = Util.RemoveTildeAndColon(description);

        this.name           = name;
        this.sex            = sex;
        this.dateBorn       = dateBorn;
        this.race           = race;
        this.countryID      = countryID;
        this.description    = description;
        this.future1        = future1;
        this.serverUniqueID = serverUniqueID;         //remember don't do this on server

        //insert in the person table
        //when insert as person we don't know uniqueID
        uniqueID = -1;
        int insertedID = this.InsertAtDB(dbconOpened, Constants.PersonTable);

        //we need uniqueID for personSession
        uniqueID = insertedID;

        LogB.Information(this.ToString());
    }
    protected void on_show_repetitions_row_edit_apply(object o, EventArgs args)
    {
        int        curveID = genericWinESR.TreeviewSelectedUniqueID;
        EncoderSQL eSQL    = (EncoderSQL)SqliteEncoder.Select(
            false, curveID, 0, 0, encoderGI,
            -1, "", EncoderSQL.Eccons.ALL,
            false, true)[0];

        //if changed comment, update SQL, and update treeview
        //first remove conflictive characters
        string comment = Util.RemoveTildeAndColonAndDot(genericWinESR.EntryEditRow);

        if (comment != eSQL.description)
        {
            eSQL.description = comment;
            SqliteEncoder.Update(false, eSQL);

            //update treeview
            genericWinESR.on_edit_selected_done_update_treeview();
        }

        //if changed person, proceed
        LogB.Information("new person: " + genericWinESR.GetComboSelected);
        int newPersonID = Util.FetchID(genericWinESR.GetComboSelected);

        if (newPersonID != currentPerson.UniqueID)
        {
            EncoderSQL eSQLChangedPerson = eSQL.ChangePerson(genericWinESR.GetComboSelected);
            SqliteEncoder.Update(false, eSQLChangedPerson);

            genericWinESR.RemoveSelectedRow();
        }

        genericWinESR.ShowEditRow(false);
    }
예제 #29
0
    public static bool CallR(string script)
    {
        string        executable = UtilEncoder.RProcessBinURL();
        List <string> parameters = new List <string>();

        //A) fix script name
        if (UtilAll.IsWindows())
        {
            script = script.Replace("\\", "/");
        }

        parameters.Insert(0, "\"" + script + "\"");

        //B) tempPath
        string tempPath = Path.GetTempPath();

        if (UtilAll.IsWindows())
        {
            tempPath = tempPath.Replace("\\", "/");
        }

        parameters.Insert(1, "\"" + tempPath + "\"");

        LogB.Information("\nCalling R file ----->");

        //C) call process
        //ExecuteProcess.run (executable, parameters);
        Result execute_result = run(executable, parameters, true, true);

        //LogB.Information("Result = " + execute_result.stdout);

        LogB.Information("\n<------ Done calling R file.");
        return(execute_result.success);
    }
예제 #30
0
    void ItemToggled(int columnThis, int columnOther, object o, ToggledArgs args)
    {
        TreeIter iter;

        if (store.GetIter(out iter, new TreePath(args.Path)))
        {
            bool val = (bool)store.GetValue(iter, columnThis);
            LogB.Information(string.Format("toggled {0} with value {1}", args.Path, !val));

            if (args.Path == "0")
            {
                if (store.GetIterFirst(out iter))
                {
                    val = (bool)store.GetValue(iter, columnThis);
                    store.SetValue(iter, columnThis, !val);
                    store.SetValue(iter, columnOther, val);
                    while (store.IterNext(ref iter))
                    {
                        store.SetValue(iter, columnThis, !val);
                        store.SetValue(iter, columnOther, val);
                    }
                }
            }
            else
            {
                store.SetValue(iter, columnThis, !val);
                store.SetValue(iter, columnOther, val);
                //usnelect "all" checkboxes
                store.GetIterFirst(out iter);
                store.SetValue(iter, columnThis, false);
                store.SetValue(iter, columnOther, false);
            }
        }
    }