Debug() public static method

public static Debug ( string message ) : void
message string
return void
Example #1
0
    //from main gui to change SelectedPerson or from this class
    public void Update(ArrayList persons, Person currentPerson)
    {
        this.persons   = persons;
        SelectedPerson = currentPerson;
        viewport_person_name_show_paint();

        notebook.CurrentPage = 0;

        LogB.Debug("Removing table");
        table1.Visible = false;
        removeTable();

        LogB.Debug("Recreating table");
        createTable();
        table1.Visible   = true;
        table1.Sensitive = true;
        button_manage_persons.Sensitive = true;
        hbox_up_down_close.Sensitive    = true;

        if (currentPerson != null)
        {
            assignPersonSelectedStuff(currentPerson);
        }

        if (!person_select_window.Visible)
        {
            person_select_window.Visible = true;
        }
    }
Example #2
0
    protected bool isRunning()
    {
        LogB.Debug("calling isRunning()");
        if (p == null)
        {
            LogB.Debug("p == null");
            return(false);
        }

        /*
         * LogB.Debug("print processes");
         * Process [] pids = Process.GetProcesses();
         * foreach (Process myPid in pids)
         *      LogB.Information(myPid.ToString());
         */

        LogB.Debug(string.Format("last pid id {0}", p.Id));


        //if(isRunningThisProcess("Rscript") || isRunningThisProcess("*R*"))
        if (isRunningThisProcess(p.Id))
        {
            return(true);
        }

        return(false);
    }
Example #3
0
    public bool StartOrContinue(EncoderStruct es)
    {
        status = Status.RUNNING;

        this.es = es;

        //options change at every capture. So do at continueProcess and startProcess
        writeOptionsFile();

        bool ok = true;

        if (ExecuteProcess.IsRunning(p) && ExecuteProcess.IsResponsive(p))
        {
            LogB.Debug("calling continue");
            ok = continueProcess();
        }
        else
        {
            LogB.Debug("calling start");
            ok = startProcess();
            LogB.Debug("StartedOk: " + ok.ToString());
        }

        status = Status.DONE;

        return(ok);
    }
Example #4
0
    private static bool treeviewSelectRow(Gtk.TreeView tv, Gtk.TreeStore store, int rowNum, bool scrollToRow)
    {
        if (rowNum == -1)
        {
            return(false);
        }

        //set the selected
        int      count = 0;
        TreeIter iter;
        bool     iterOk = store.GetIterFirst(out iter);

        while (iterOk)
        {
            if (count == rowNum)
            {
                //1 select row
                tv.Selection.SelectIter(iter);

                //2 scroll to that row
                if (scrollToRow)
                {
                    TreePath path = store.GetPath(iter);
                    LogB.Debug(path.ToString());
                    tv.ScrollToCell(path, tv.Columns[0], true, 0, 0);
                }

                return(true);
            }

            count++;
            store.IterNext(ref iter);
        }
        return(false);
    }
Example #5
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");
    }
Example #6
0
    private void readForceValues()
    {
        LogB.Debug("readed start mark Ok");
        List <int> dataRow = new List <int>();

        //read time, four bytes
        int t0 = sp.ReadByte();         //least significative
        int t1 = sp.ReadByte();         //most significative
        int t2 = sp.ReadByte();         //most significative
        int t3 = sp.ReadByte();         //most significative

        dataRow.Add(Convert.ToInt32(
                        Math.Pow(256, 3) * t3 +
                        Math.Pow(256, 2) * t2 +
                        Math.Pow(256, 1) * t1 +
                        Math.Pow(256, 0) * t0));

        //read data, four sensors, 2 bytes each
        for (int i = 0; i < 4; i++)
        {
            int b0 = sp.ReadByte();             //least significative
            int b1 = sp.ReadByte();             //most significative

            int readedNum = 256 * b1 + b0;
            //care for negative values
            if (readedNum > 32768)
            {
                readedNum = -1 * (65536 - readedNum);
            }

            dataRow.Add(readedNum);
        }

        printDataRow(dataRow);
    }
Example #7
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);
    }
Example #8
0
    public static void TreeviewScrollToLastRow(Gtk.TreeView tv, Gtk.ListStore store, int nrows)
    {
        TreeIter iter   = new TreeIter();
        bool     iterOk = store.GetIterFirst(out iter);

        if (!iterOk)
        {
            return;
        }

        for (int i = 0; i < (nrows - 1); i++)
        {
            iterOk = tv.Model.IterNext(ref iter);
        }

        if (!iterOk)
        {
            return;
        }

        TreePath path = store.GetPath(iter);

        LogB.Debug(path.ToString());
        tv.ScrollToCell(path, tv.Columns[0], true, 0, 0);
    }
Example #9
0
    //this is called on AutoDetect
    static public ChronopicWindow Create(Chronopic cpDetected, ArrayList myCpd, string myEncoderPort, bool recreate, bool volumeOn)
    {
        LogB.Debug("enter create");
        if (ChronopicWindowBox != null && recreate)
        {
            ChronopicWindowBox.chronopic_window.Hide();
        }
        if (ChronopicWindowBox == null || recreate)
        {
            ChronopicWindowBox = new ChronopicWindow(cpDetected, myCpd);
        }

        LogB.Information("create cp is null? " + (ChronopicWindowBox.cp == null).ToString());

        //don't show until View is called
        //ChronopicWindowBox.chronopic_window.Show ();

        ChronopicWindowBox.volumeOn = volumeOn;

        ChronopicWindowBox.setEncoderPort(myEncoderPort);

        ChronopicWindowBox.fakeWindowDone = new Gtk.Button();
        //ChronopicWindowBox.fakeWindowReload = new Gtk.Button();

        return(ChronopicWindowBox);
    }
Example #10
0
    void on_button_rfid_start_clicked(object o, EventArgs args)
    {
        string script_path = Util.GetRFIDCaptureScript();

        if (!File.Exists(script_path))
        {
            LogB.Debug("ExecuteProcess does not exist parameter: " + script_path);
            label_rfid.Text = "Error starting rfid capture";
            return;
        }

        string filePath = Util.GetRFIDCapturedFile();

        Util.FileDelete(filePath);


        // ---- start process ----
        //
        // on Windows will be different, but at the moment RFID is only supported on Linux (Raspberrys)
        // On Linux and OSX we execute Python and we pass the path to the script as a first argument

        string executable = "python";                 // TODO: check if ReadChronojump.py works on Python 2 and Python 3

        List <string> parameters = new List <string> ();

        // first argument of the Python: the path to the script
        parameters.Insert(0, script_path);


        processRFIDcapture = new Process();
        bool calledOk = ExecuteProcess.RunAtBackground(processRFIDcapture, executable, parameters);

        if (calledOk)
        {
            button_rfid_start.Sensitive = false;
            label_rfid.Text             = "...";
        }
        else
        {
            label_rfid.Text = "Error starting rfid capture";
        }

        // ----- process is launched

        //create a new FileSystemWatcher and set its properties.
        FileSystemWatcher watcher = new FileSystemWatcher();

        watcher.Path   = Path.GetDirectoryName(filePath);
        watcher.Filter = Path.GetFileName(filePath);

        //add event handlers.
        watcher.Changed += new FileSystemEventHandler(rfid_watcher_changed);

        //start watching
        watcher.EnableRaisingEvents = true;

        //also perform an initial search
        rfid_read();
    }
Example #11
0
    // Executes file_name without creating a Window and without using the shell
    // with the parameters. Waits that it finishes it. Returns the stdout and stderr.
    private static Result runDo(string file_name, List <string> parameters)
    {
        Process          process          = new Process();
        ProcessStartInfo processStartInfo = new ProcessStartInfo();

        processStartInfo.FileName = file_name;

        string parameters_string = "";

        foreach (string parameter in parameters)
        {
            parameters_string += CommandLineEncoder.EncodeArgText(parameter) + " ";
        }

        processStartInfo.Arguments = parameters_string;

        LogB.Debug("ExecuteProcess FileName: " + processStartInfo.FileName);
        LogB.Debug("ExecuteProcess Arguments: " + processStartInfo.Arguments);

        processStartInfo.CreateNoWindow         = true;
        processStartInfo.UseShellExecute        = false;
        processStartInfo.RedirectStandardInput  = false;
        processStartInfo.RedirectStandardError  = true;
        processStartInfo.RedirectStandardOutput = true;

        process.StartInfo = processStartInfo;

        try {
            process.Start();
        }
        catch (Exception e) {
            string errorMessage = String.Format(Catalog.GetString("Cannot start:\n" +
                                                                  "{0}\n" +
                                                                  "with the parameters:" +
                                                                  "{1}\n" +
                                                                  "Exception:\n" +
                                                                  "{2}"),
                                                processStartInfo.FileName, parameters_string, e.Message);
            LogB.Warning(errorMessage);
            return(new Result("", "", Result.ERROR_CANT_START, errorMessage));
        }

        string stdout = process.StandardOutput.ReadToEnd().TrimEnd('\n');
        string stderr = process.StandardError.ReadToEnd().TrimEnd('\n');

        process.WaitForExit();

        if (stderr != "")
        {
            LogB.Warning(String.Format("Executed: {0} Parameters: {1} Stdout: {2} Stderr: {3}", processStartInfo.FileName, parameters_string, stdout, stderr));
        }

        int exitCode = process.ExitCode;

        return(new Result(stdout, stderr, exitCode));
    }
Example #12
0
    public void Test()
    {
        UID = new List <int> {
            0, 0, 0, 0
        };
        LogB.Debug(UIDToInt().ToString());

        UID = new List <int> {
            255, 255, 255, 255
        };
        LogB.Debug(UIDToInt().ToString());
    }
Example #13
0
    public void Update(ArrayList persons)
    {
        this.persons = persons;

        LogB.Debug("Removing table");
        table1.Visible = false;
        removeTable();

        LogB.Debug("Recreating table");
        createTable();
        table1.Visible = true;
    }
Example #14
0
    private static Chronopic.Plataforma platformState;          //on (in platform), off (jumping), or unknow

    private void connectNormal(string myPort)
    {
        LogB.Debug("connectNormal start");

        chronopicInit = new ChronopicInit();

        string message = "";
        bool   success = false;

        connectedNormalChronopic = chronopicInit.Do(1, out cpDoing, out sp, platformState, myPort, out message, out success);
        LogB.Information(message);
        LogB.Debug("connectNormal end");
    }
Example #15
0
    //on 1.5.0 on mac, does not crash on splashwin but sometimes it does not disappear the splash
    //hide splashWin
    //TODO: rewrite all the splashWin flow here and on chronojump.cs
    static public void Hide()
    {
        LogB.Debug("splash_window hide start ");
        if (SplashWindowBox.splash_window != null)
        {
            LogB.Debug("splash_window hide != null");

            SplashWindowBox.splash_window.Visible = false;

            LogB.Debug("splash_window hide hidden");
        }
        LogB.Debug("splash_window hide end");
    }
Example #16
0
    public ChronopicWindow(Chronopic cpDetected, ArrayList myCpd)
    {
        LogB.Debug("constructor");

        Glade.XML gxml;
        gxml = Glade.XML.FromAssembly(Util.GetGladePath() + "chronojump.glade", "chronopic_window", "chronojump");
        gxml.Autoconnect(this);

        cpd = myCpd;

        if (cpDetected != null)
        {
            cp = cpDetected;
            sp = new SerialPort(((ChronopicPortData)cpd[0]).Port);
        }

        UtilGtk.IconWindow(chronopic_window);

        if (UtilAll.IsWindows())
        {
            isWindows = true;
        }
        else
        {
            isWindows = false;
        }

        setDefaultValues();

        chronopicInit = new ChronopicInit();

        //Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "chronopic_128.png");
        //chronopic_image.Pixbuf = pixbuf;

        /*
         * Pixbuf pixbuf;
         * pixbuf = new Pixbuf (null, Util.GetImagePath(true) + Constants.FileNameContactPlatformModular);
         * image_contact_modular.Pixbuf = pixbuf;
         * pixbuf = new Pixbuf (null, Util.GetImagePath(true) + Constants.FileNameInfrared);
         * image_infrared.Pixbuf = pixbuf;
         */

        /*
         * if(chronopicPort1 != Constants.ChronopicDefaultPortWindows &&
         *              (chronopicPort1 != Constants.ChronopicDefaultPortLinux && File.Exists(chronopicPort1))
         * ) {
         *      ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Do you want to connect to Chronopic now?"), "", "");
         *      confirmWin.Button_accept.Clicked += new EventHandler(chronopicAtStart);
         * }
         */
    }
Example #17
0
    protected override bool startProcess()
    {
        //If output file is not given, R will try to write in the running folder
        //in which we may haven't got permissions

        string pBin = pBinURL();

        pinfo = new ProcessStartInfo();

        //on Windows we need the \"str\" to call without problems in path with spaces
        //pinfo.Arguments = "\"" + "passToR.R" + "\" " + optionsFile;
        pinfo.Arguments = "\"" + UtilEncoder.GetEncoderScriptCallCaptureNoRdotNet() + "\" " + optionsFile;

        LogB.Information("Arguments:", pinfo.Arguments);
        LogB.Information("--- 1 --- " + optionsFile.ToString() + " ---");
        LogB.Information("--- 2 --- " + pinfo.Arguments.ToString() + " ---");

        pinfo.FileName = pBin;

        pinfo.CreateNoWindow        = true;
        pinfo.UseShellExecute       = false;
        pinfo.RedirectStandardInput = true;
        pinfo.RedirectStandardError = true;
        //pinfo.RedirectStandardOutput = true;


        try {
            p           = new Process();
            p.StartInfo = pinfo;

            p.ErrorDataReceived += new DataReceivedEventHandler(readingError);

            p.Start();

            // Start asynchronous read of the output.
            // Caution: This has to be called after Start
            //p.BeginOutputReadLine();
            p.BeginErrorReadLine();


            LogB.Debug("D");

            LogB.Debug(string.Format("this pid id : {0}", p.Id));
        } catch {
            Console.WriteLine("catched at runEncoderCaptureNoRDotNetStart");
            return(false);
        }

        return(true);
    }
Example #18
0
    /*
     * run a process on the background, eg: read rfid.
     * don't call WaitForExit(), kill it on Chronojump exit
     * returns false if there are problems calling it
     */
    public static bool RunAtBackground(Process process, string file_name, List <string> parameters)
    {
        if (!File.Exists(parameters[0]))
        {
            LogB.Debug("ExecuteProcess does not exist parameter: " + parameters[0]);
            return(false);
        }

        ProcessStartInfo processStartInfo = new ProcessStartInfo();

        processStartInfo.FileName = file_name;

        string parameters_string = "";

        foreach (string parameter in parameters)
        {
            parameters_string += CommandLineEncoder.EncodeArgText(parameter) + " ";
        }

        processStartInfo.Arguments = parameters_string;

        LogB.Debug("ExecuteProcess FileName: " + processStartInfo.FileName);
        LogB.Debug("ExecuteProcess Arguments: " + processStartInfo.Arguments);

        processStartInfo.CreateNoWindow         = true;
        processStartInfo.UseShellExecute        = false;
        processStartInfo.RedirectStandardInput  = false;
        processStartInfo.RedirectStandardError  = true;
        processStartInfo.RedirectStandardOutput = true;

        process.StartInfo = processStartInfo;

        try {
            process.Start();
        }
        catch (Exception e) {
            string errorMessage = String.Format(Catalog.GetString("Cannot start:\n" +
                                                                  "{0}\n" +
                                                                  "with the parameters:" +
                                                                  "{1}\n" +
                                                                  "Exception:\n" +
                                                                  "{2}"),
                                                processStartInfo.FileName, parameters_string, e.Message);
            LogB.Warning(errorMessage);
            return(false);
        }

        return(true);
    }
Example #19
0
    public int ChangeMultitestFirmware(int debounceChange)
    {
        LogB.Information("change_multitest_firmware 3 a");
        try {
            //write change
            ChronopicAuto ca = new ChronopicAutoChangeDebounce();
            ca.Write(sp, debounceChange);

            //read if ok
            string ms      = "";
            bool   success = false;
            int    tryNum  = 7;         //try to connect seven times
            do
            {
                ca = new ChronopicAutoCheckDebounce();
                ms = ca.Read(sp);

                if (ms.Length == 0)
                {
                    LogB.Error("multitest firmware. ms is null");
                }
                else if (ms[0] == '-')                //is negative
                {
                    LogB.Error("multitest firmware. ms = " + ms);
                }
                else
                {
                    success = true;
                }
                tryNum--;
            } while (!success && tryNum > 0);

            LogB.Debug("multitest firmware. ms = " + ms);

            if (ms == "50 ms")
            {
                return(50);
            }
            else if (ms == "10 ms")
            {
                return(10);
            }
        } catch {
            LogB.Error("Could not change debounce");
        }

        return(-1);
    }
Example #20
0
    private void simulateDriverProblem()
    {
        //testing a fault in drivers
        int  count = 0;
        bool crash = true;

        while (crash)
        {
            count++;
            if (count >= 40000)
            {
                LogB.Debug(" at simulateDriverProblem\n ");
                count = 0;
            }
        }
    }
Example #21
0
 public void SendEndProcess()
 {
     if (ExecuteProcess.IsRunning(p))
     {
         LogB.Debug("Closing R script");
         try {
             p.StandardInput.WriteLine("Q");
         } catch {
             LogB.Warning("Seems stdin write gots broken");
         }
     }
     else
     {
         LogB.Debug("R script is not working. Don't need to close.");
     }
 }
Example #22
0
    private void detectNormal()
    {
        //simulateDriverProblem(); //uncomment to check cancel, info buttons behaviour

        ChronopicAutoDetect cad =
            new ChronopicAutoDetect(ChronopicAutoDetect.ChronopicType.NORMAL, configAutoDetect);

        Detected = cad.Detected;

        if (Detected != null && Detected != "")
        {
            needToChangeProgressbarText = true;
            connectNormal(Detected);
        }
        LogB.Debug("detectNormal ended");
    }
Example #23
0
    private static bool pulseGTKServer()
    {
        if (!thread.IsAlive)
        {
            sessionUploadWin.UploadFinished();
            LogB.Information("dying");
            return(false);
        }

        if (serverSessionError)
        {
            new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Error uploading session to server"));
            return(false);
        }

        //need to do this, if not it crashes because chronopicWin gets died by thread ending
        sessionUploadWin = SessionUploadWindow.Show(app1);

        if (countPersons == 0)
        {
            sessionUploadWin.PulseProgressbar();
        }

        //activity on pulsebar
        sessionUploadWin.UpdatePulsebar();

        if (needUpdateServerSession && !updatingServerSession)
        {
            //prevent that FillData is called again with same data
            updatingServerSession = true;

            //update progressBar
            sessionUploadWin.UpdateProgressbar(
                Util.DivideSafeFraction(++countPersons, progressBarPersonsNum));

            //fill data
            sessionUploadWin.FillData(sessionUploadPersonData);

            //not need to update until there's more data coming from the other thread
            updatingServerSession   = false;
            needUpdateServerSession = false;
        }

        Thread.Sleep(50);
        LogB.Debug(thread.ThreadState.ToString());
        return(true);
    }
Example #24
0
    public void SQLInsert(int signalID)
    {
        //save triggers to file (if any)
        if (l == null || l.Count == 0)
        {
            return;
        }

        //update triggers with encoderSignalUniqueID
        foreach (Trigger trigger in l)
        {
            trigger.ModeID = signalID;
        }

        LogB.Debug("runEncoderCaptureCsharp SQL inserting triggers");
        SqliteTrigger.InsertList(false, l);
    }
Example #25
0
    protected bool isRunning()
    {
        LogB.Debug("calling isRunning()");
        if (p == null)
        {
            LogB.Debug("p == null");
            return(false);
        }
        else
        {
            if (isRunningThisProcess(p))
            {
                return(true);
            }
        }

        return(false);
    }
Example #26
0
    /*
     * //better method than below
     * //https://stackoverflow.com/a/262291
     * public static bool IsRunning2old (Process process, string executable)
     * {
     *      Process[] pNameArray = Process.GetProcessesByName(Util.GetLastPartOfPath(process.ProcessName));
     *      if (pNameArray.Length == 0)
     *              return false;
     *
     *      foreach(Process p in pNameArray)
     *              if(p.Id == process.Id)
     *                      return true;
     *
     *      return false;
     * }
     */

    //This seems is not working with ffmpeg capture, try method obove
    public static bool IsRunning(Process process)
    {
        LogB.Debug("calling Process.IsRunning()");
        if (process == null)
        {
            LogB.Debug("process == null");
            return(false);
        }
        else
        {
            if (isRunningThisProcess(process))
            {
                return(true);
            }
        }

        return(false);
    }
Example #27
0
    private bool readRowMark()
    {
        if (sp.ReadByte() != 255)
        {
            return(false);
        }

        LogB.Debug("reading mark... 255,");
        for (int j = 0; j < 3; j++)
        {
            if (sp.ReadByte() != 255)
            {
                return(false);
            }
        }

        return(true);
    }
Example #28
0
    /*
     * run a process on the background, eg: read rfid.
     * don't call WaitForExit(), kill it on Chronojump exit
     * returns false if there are problems calling it
     */
    public static bool RunAtBackground(ref Process process, string file_name, List <string> parameters,
                                       bool createNoWindow, bool useShellExecute, bool redirectInput, bool redirectOutput, bool redirectStderr)
    {
        ProcessStartInfo processStartInfo = new ProcessStartInfo();

        processStartInfo.FileName = file_name;

        string parameters_string = "";

        foreach (string parameter in parameters)
        {
            parameters_string += CommandLineEncoder.EncodeArgText(parameter) + " ";
        }

        processStartInfo.Arguments = parameters_string;

        LogB.Debug("ExecuteProcess FileName: " + processStartInfo.FileName);
        LogB.Debug("ExecuteProcess Arguments: " + processStartInfo.Arguments);

        processStartInfo.CreateNoWindow         = createNoWindow;
        processStartInfo.UseShellExecute        = useShellExecute;
        processStartInfo.RedirectStandardInput  = redirectInput;        //note UseShellExecute has to be false to be able to redirect
        processStartInfo.RedirectStandardError  = redirectOutput;
        processStartInfo.RedirectStandardOutput = redirectStderr;

        process.StartInfo = processStartInfo;

        try {
            process.Start();
        }
        catch (Exception e) {
            string errorMessage = String.Format(Catalog.GetString("Cannot start:\n" +
                                                                  "{0}\n" +
                                                                  "with the parameters:" +
                                                                  "{1}\n" +
                                                                  "Exception:\n" +
                                                                  "{2}"),
                                                processStartInfo.FileName, parameters_string, e.Message);
            LogB.Warning(errorMessage);
            return(false);
        }

        return(true);
    }
Example #29
0
    /*
     * this will read what's in the serial port until time out
     */
    private void flushByTimeOut()
    {
        byte[] buffer = new byte[256];

        //try, catch done because mono-1.2.3 throws an exception when there's a timeout
        //http://bugzilla.gnome.org/show_bug.cgi?id=420520
        bool timeOut = false;

        do
        {
            try{
                sp.Read(buffer, 0, 256);
                LogB.Debug(" spReaded ");
            } catch {
                LogB.Warning(" catchedTimeOut ");
                timeOut = true;
            }
        } while(!timeOut);
    }
Example #30
0
    //data is an ArrayList of strings[], each string [] is a row, each of its strings is a column
    public void SetTreeview(string [] columnsString, bool addCheckbox,
                            ArrayList data, ArrayList myNonSensitiveRows, Constants.ContextMenu contextMenu,
                            bool activateRowAcceptsWindow //this param makes button_accept the window if 'enter' on a row or double click
                            )
    {
        //adjust window to be bigger
        generic_window.Resizable = true;
        scrolled_window_treeview.WidthRequest  = 550;
        scrolled_window_treeview.HeightRequest = 250;

        store          = getStore(columnsString.Length, addCheckbox);
        treeview.Model = store;
        prepareHeaders(columnsString, addCheckbox);
        treeview.HeadersClickable = false;

        nonSensitiveRows = myNonSensitiveRows;

        LogB.Debug("aaaaaaaaaaaaaaaa1");
        foreach (string [] line in data)
        {
            store.AppendValues(line);
            //Log.WriteLine(Util.StringArrayToString(line,"\n"));
        }
        LogB.Debug("aaaaaaaaaaaaaaaa2");

        genericWinContextMenu         = contextMenu;
        this.activateRowAcceptsWindow = activateRowAcceptsWindow;

        treeview.CursorChanged += on_treeview_cursor_changed;
        if (contextMenu == Constants.ContextMenu.EDITDELETE)
        {
            button_row_edit              = new Gtk.Button();
            button_row_delete            = new Gtk.Button();
            treeview.ButtonReleaseEvent -= on_treeview_button_release_event;
            treeview.ButtonReleaseEvent += on_treeview_button_release_event;
        }
        else if (contextMenu == Constants.ContextMenu.DELETE)
        {
            button_row_delete            = new Gtk.Button();
            treeview.ButtonReleaseEvent -= on_treeview_button_release_event;
            treeview.ButtonReleaseEvent += on_treeview_button_release_event;
        }
    }