コード例 #1
0
ファイル: event.cs プロジェクト: kleopatra999/chronojump
    protected bool PulseGTK()
    {
        onTimer();

        //thread is (in jump, as an example), started in Manage:
        //thread = new Thread(new ThreadStart(waitEvent));
        //GLib.Idle.Add (new GLib.IdleHandler (PulseGTK));
        //thread.Start();
        //
        //when waitEvent it's done (with success, for example)
        //then thread is dead

        if (!thread.IsAlive || cancel)
        {
            LogB.ThreadEnding();
            fakeButtonThreadDyed.Click();

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

        Thread.Sleep(50);
        //LogB.Debug(thread.ThreadState.ToString());
        return(true);
    }
コード例 #2
0
 void OnOperandEntryActivated(object o, EventArgs args)
 {
     if (DoOperationButton.Sensitive == true)
     {
         DoOperationButton.Click();
     }
 }
コード例 #3
0
    void on_button_close_clicked(object o, EventArgs args)
    {
        if (connecting)
        {
            button_cancel.Click();
        }

        LogB.Information("CLOSE");
        fakeWindowDone.Click();
        ChronopicWindowBox.chronopic_window.Hide();
    }
コード例 #4
0
 void OnEntryActivated(object o, EventArgs args)
 {
     if (SelectButton.Sensitive == true)
     {
         SelectButton.Click();
     }
 }
コード例 #5
0
 void OnOffsetEntryActivated(object o, EventArgs args)
 {
     if (GotoOffsetButton.Sensitive == true)
     {
         GotoOffsetButton.Click();
     }
 }
コード例 #6
0
    void on_calendar1_day_selected(object obj, EventArgs args)
    {
        /*
         * when dialog starts, calendar1.Date = dateInitial changes date
         * and raises this and it's too early
         */
        if (!signalsActive)
        {
            return;
        }

        try {
            Calendar activatedCalendar = (Calendar)obj;
            myDateTime = activatedCalendar.Date;

            //raise a signal
            fakeButtonDateChanged.Click();
        }
        catch {
            /*
             * when dialog starts, calendar1.Date = dateInitial changes date
             * and raises this and it's too early
             */
        }
    }
コード例 #7
0
ファイル: FindReplacePlugin.cs プロジェクト: switsys/bless
 void OnReplacePatternEntryActivated(object o, EventArgs args)
 {
     if (ReplaceButton.Sensitive == true)
     {
         ReplaceButton.Click();
     }
 }
コード例 #8
0
ファイル: FindReplacePlugin.cs プロジェクト: switsys/bless
 void OnSearchPatternEntryActivated(object o, EventArgs args)
 {
     if (FindNextButton.Sensitive == true)
     {
         FindNextButton.Click();
     }
 }
コード例 #9
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);
            }
        }
    }
コード例 #10
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);
    }
コード例 #11
0
    protected void on_delete_selected_jump_delete_event(object o, DeleteEventArgs args)
    {
        //ConfirmWindowBox.confirm_window.Hide();
        //ConfirmWindowBox = null;

        //better raise this signal, and then can be controlled equal if it's cancel or delete
        button_cancel.Click();
    }
コード例 #12
0
    void on_delete_event(object o, DeleteEventArgs args)
    {
        //RepetitiveConditionsWindowBox.repetitive_conditions.Hide();
        //RepetitiveConditionsWindowBox = null;

        button_close.Click();
        args.RetVal = true;
    }
コード例 #13
0
ファイル: error.cs プロジェクト: davidfombella/chronojump
    void on_delete_window_event(object o, DeleteEventArgs args)
    {
        /*
         * ErrorWindowBox.error_window.Hide();
         * ErrorWindowBox = null;
         */

        //need this for continue execution on chronojump startup. See src/chronojump.cs
        button_accept.Click();
    }
コード例 #14
0
ファイル: statType.cs プロジェクト: davidfombella/chronojump
 private void on_fake_button_no_rows_selected_clicked(object o, EventArgs args)
 {
     LogB.Information("fakeButtonNoRowsSelected in statType.cs");
     //only raise another click if this is not a report. This new click will update things in gui/stats.cs
     //this fakeButtons are not initialized in the coming-from-report-statType-constructor
     if (!toReport)
     {
         fakeButtonNoRowsSelected.Click();
     }
 }
コード例 #15
0
    private void on_edit_selected_clicked(object o, EventArgs args)
    {
        TreeModel model;
        TreeIter  iter = new TreeIter();

        treeview.Selection.GetSelected(out model, out iter);
        entry_edit_row.Text = (string)model.GetValue(iter, commentColumn);

        button_row_edit.Click();
    }
コード例 #16
0
    protected void on_delete_event(object o, DeleteEventArgs args)
    {
        if (capturing)
        {
            button_encoder_capture_inertial_cancel.Click();
        }

        button_close.Click();

        args.RetVal = true;
    }
コード例 #17
0
    protected void on_delete_event(object o, DeleteEventArgs args)
    {
        args.RetVal = true;

        if (capturing)
        {
            button_encoder_capture_inertial_cancel.Click();
        }

        EncoderConfigurationWindowBox.encoder_configuration.Hide();
        EncoderConfigurationWindowBox = null;
    }
コード例 #18
0
 protected override bool OnKeyPressEvent(Gdk.EventKey e)
 {
     if (e.Key == Gdk.Key.Escape)
     {
         CloseButton.Click();
         return(true);
     }
     else
     {
         return(base.OnKeyPressEvent(e));
     }
 }
コード例 #19
0
    private void on_button_next_clicked(object o, EventArgs args)
    {
        if (notebook_main.CurrentPage == 0)
        {
            if (radio_load.Active)
            {
                loadDo();                 //this also defines the 'mode' variable
            }
            else
            {
                mode = ExecuteAuto.ModeTypes.BY_PERSONS;
                if (radio_by_tests.Active)
                {
                    mode = ExecuteAuto.ModeTypes.BY_TESTS;
                }
                else if (radio_by_sets.Active)
                {
                    mode = ExecuteAuto.ModeTypes.BY_SETS;
                }

                //next button will be sensitive when first test is added
                button_next.Sensitive = false;
            }

            showSeriesStuff(mode == ExecuteAuto.ModeTypes.BY_SETS);
            notebook_main.NextPage();
        }
        else if (notebook_main.CurrentPage == 1)
        {
            ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
                sessionID,
                false);                         //means: do not returnPersonAndPSlist
            orderedData = ExecuteAuto.CreateOrder(mode, persons,
                                                  treeviewSerie1Array, treeviewSerie2Array, treeviewSerie3Array);

            createTreeviewResult(mode == ExecuteAuto.ModeTypes.BY_SETS);
            fillTreeviewResult();

            button_next.Label = Catalog.GetString("Accept");
            if (orderedData.Count == 0)
            {
                button_next.Sensitive = false;
            }

            notebook_main.NextPage();
        }
        else                          // notebook_main.CurrentPage == 2
        {
            FakeButtonAccept.Click(); //signal to read orderedData
        }
    }
コード例 #20
0
    protected bool PulseGTK()
    {
        if (quitNow)
        {
            return(false);
        }

        //if( ( needEndSplashWin && pingEnd )
        //		|| ! thread.IsAlive) {
        if (needEndSplashWin || !thread.IsAlive)
        {
            LogB.ThreadEnding();
            fakeSplashButton.Click();

            LogB.Information("splash window ending here");
            LogB.ThreadEnded();
            return(false);
        }
        //need to do this, if not it crashes because chronopicWin gets died by thread ending
        splashWin = SplashWindow.Show();
        //Log.WriteLine("splash");

        if (updatingDB)
        {
            splashWin.ShowProgressbar("updating");
            splashWin.UpdateLabel(splashMessage + " " + Sqlite.PrintConversionText());

            splashWin.UpdateProgressbar("version", Sqlite.PrintConversionVersion());
            splashWin.UpdateProgressbar("rate", Sqlite.PrintConversionRate());
            splashWin.UpdateProgressbar("subrate", Sqlite.PrintConversionSubRate());
        }
        else if (creatingDB)
        {
            splashWin.ShowProgressbar("creating");
            splashWin.UpdateProgressbar("version", Sqlite.PrintCreation());

            //splashWin.UpdateProgressbar("rate", Sqlite.PrintConversionRate());
            splashWin.UpdateProgressbar("subrate", Sqlite.PrintConversionSubRate());
        }

        if (needUpdateSplashMessage)
        {
            splashWin.UpdateLabel(splashMessage);
            needUpdateSplashMessage = false;
        }


        Thread.Sleep(50);
        //Log.Write(" (PulseGTK:" + thread.ThreadState.ToString() + ") ");
        return(true);
    }
コード例 #21
0
ファイル: event.cs プロジェクト: kleopatra999/chronojump
    //from confirm_window cancel button (thread has not started)
    //this is NOT called when a event has started and user click on "Cancel"
    protected void cancel_event_before_start(object o, EventArgs args)
    {
        cancel           = true;
        totallyCancelled = true;
        //app1.EventEnded();
        fakeButtonEventEnded.Click();

        //event will be raised, and managed in chronojump.cs
        fakeButtonFinished.Click();

        //event will be raised, and managed in chronojump.cs
        //calls sensitiveGuiEventDone()
        fakeButtonThreadDyed.Click();
    }
コード例 #22
0
ファイル: chronopic2016.cs プロジェクト: ylatuya/chronojump-1
    private void connectContactsRealEnd()
    {
        if (SuccededConnectContactsRealThread)
        {
            LogB.Information("Success at Connecting real!");
        }
        else
        {
            LogB.Warning("Failure at Connecting real!");
        }

        hideAndNull();

        FakeButtonContactsRealDone.Click();
    }
コード例 #23
0
    protected void on_button_delete_type_accepted(object o, EventArgs args)
    {
        deleteTestLine();

        button_deleted_test.Click();

        TreeModel model;
        TreeIter  iter;

        if (treeview_more.Selection.GetSelected(out model, out iter))
        {
            store.Remove(ref iter);
        }

        button_delete_type.Sensitive = false;
    }
コード例 #24
0
    private void finishWizard()
    {
        if (radio_start_contacts.Active || radio_start_both.Active)
        {
            PortContacts = readSelectedRadioButton(radio_contacts1, radio_contacts2,
                                                   radio_contacts3, radio_contacts4, radio_contacts5);
        }

        if (radio_start_encoder.Active || radio_start_both.Active)
        {
            PortEncoder = readSelectedRadioButton(radio_encoder1, radio_encoder2,
                                                  radio_encoder3, radio_encoder4, radio_encoder5);
        }

        //exiting using finish (next) button
        FakeButtonChronopicWizardFinished.Click();
    }
コード例 #25
0
    protected bool PulseGTK()
    {
        if (needUpdateChronopicWin || !thread.IsAlive)
        {
            LogB.ThreadEnding();
            fakeConnectionButton.Click();
            pulseEnd();

            LogB.ThreadEnded();
            return(false);
        }
        //need to do this, if not it crashes because chronopicConnectionWin gets died by thread ending
        //chronopicConnectionWin = ChronopicConnection.Show();
        //chronopicConnectionWin.Pulse();
        progressbar.Pulse();

        Thread.Sleep(50);
        LogB.Debug(thread.ThreadState.ToString());
        return(true);
    }
コード例 #26
0
    void on_button_import_configuration_clicked(object o, EventArgs args)
    {
        fc = new Gtk.FileChooserDialog(Catalog.GetString("Import configuration file"),
                                       preferences_win,
                                       FileChooserAction.Open,
                                       Catalog.GetString("Cancel"), ResponseType.Cancel,
                                       Catalog.GetString("Import"), ResponseType.Accept
                                       );

        fc.Filter = new FileFilter();
        //it can handle future archives like: chronojump_config_SOME_VENDOR.txt
        //and it will be copied to chronojump_config.txt
        fc.Filter.AddPattern("chronojump_config*.txt");

        bool success = false;

        if (fc.Run() == (int)ResponseType.Accept)
        {
            try {
                File.Copy(fc.Filename, UtilAll.GetConfigFileName(), true);
                LogB.Information("Imported configuration");

                //will launch configInit() from gui/chronojump.cs
                FakeButtonImported.Click();

                success = true;
            } catch {
                LogB.Warning("Catched! Configuration cannot be imported");
                new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Error importing data."));
            }
        }
        //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
        fc.Destroy();

        if (success)
        {
            new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Successfully imported."));
        }
    }
コード例 #27
0
        public void Show(ObjectValue val)
        {
            value       = val;
            visualizers = new List <ValueVisualizer> (DebuggingService.GetValueVisualizers(val));
            visualizers.Sort((v1, v2) => string.Compare(v1.Name, v2.Name, StringComparison.CurrentCultureIgnoreCase));
            buttons = new List <ToggleButton> ();

            Gtk.Button defaultVis = null;

            for (int i = 0; i < visualizers.Count; i++)
            {
                var button = new ToggleButton();
                button.Label    = visualizers [i].Name;
                button.Toggled += OnComboVisualizersChanged;
                if (visualizers [i].IsDefaultVisualizer(val))
                {
                    defaultVis = button;
                }
                hbox1.PackStart(button, false, false, 0);
                buttons.Add(button);
                button.CanFocus = false;
                button.Show();
            }

            if (defaultVis != null)
            {
                defaultVis.Click();
            }
            else if (buttons.Count > 0)
            {
                buttons [0].Click();
            }

            if (val.IsReadOnly || !visualizers.Any(v => v.CanEdit(val)))
            {
                buttonCancel.Label = Gtk.Stock.Close;
                buttonSave.Hide();
            }
        }
コード例 #28
0
		public NoteRenameDialog (IList<Note> notes, string oldTitle, Note renamedNote) :
			base (Catalog.GetString ("Rename Note Links?"), renamedNote.Window, 0)
		{
			this.DefaultResponse = ResponseType.Cancel;
			this.BorderWidth = 10;

			var renameButton = (Button)
				AddButton (Catalog.GetString ("_Rename Links"),
				           ResponseType.Yes);
			var dontRenameButton = (Button)
				AddButton (Catalog.GetString ("_Don't Rename Links"),
				           ResponseType.No);

			this.notes = notes;
			notesModel = new Gtk.TreeStore (typeof (bool), typeof (string), typeof (Note));
			foreach (var note in notes)
				notesModel.AppendValues (true, note.Title, note);

			var labelText = Catalog.GetString ("Rename links in other notes from \"<span underline=\"single\">{0}</span>\" " +
			                                   "to \"<span underline=\"single\">{1}</span>\"?\n\n" +
			                                   "If you do not rename the links, " +
			                                   "they will no longer link to anything.");
			var label = new Label ();
			label.UseMarkup = true;
			label.Markup = String.Format (labelText,
			                              GLib.Markup.EscapeText (oldTitle),
			                              GLib.Markup.EscapeText (renamedNote.Title));
			label.LineWrap = true;
			ContentArea.PackStart (label, false, true, 5);

			var notesView = new TreeView (notesModel);
			notesView.SetSizeRequest (-1, 200);
			var toggleCell = new CellRendererToggle ();
			toggleCell.Activatable = true;
			var column = new TreeViewColumn (Catalog.GetString ("Rename Links"),
			                                 toggleCell, "active", 0);
			column.SortColumnId = 0;
			column.Resizable = true;
			notesView.AppendColumn (column);
			toggleCell.Toggled += (o, args) => {
				TreeIter iter;
				if (!notesModel.GetIterFromString (out iter, args.Path))
					return;
				bool val = (bool) notesModel.GetValue (iter, 0);
				notesModel.SetValue (iter, 0, !val);
			};
			column = new TreeViewColumn (Catalog.GetString ("Note Title"),
			                             new CellRendererText (), "text", 1);
			column.SortColumnId = 1;
			column.Resizable = true;
			notesView.AppendColumn (column);

			notesView.RowActivated += (o, args) => {
				TreeIter iter;
				if (!notesModel.GetIter (out iter, args.Path))
					return;
				Note note = (Note) notesModel.GetValue (iter, 2);
				if (note != null) {
					note.Window.Present ();
					NoteFindBar find = note.Window.Find;
					find.ShowAll ();
					find.Visible = true;
					find.SearchText = "\"" + oldTitle + "\"";
				}
			};

			var notesBox = new VBox (false, 5);
			var selectAllButton = new Button ();
			// Translators: This button causes all notes in the list to be selected
			selectAllButton.Label = Catalog.GetString ("Select All");
			selectAllButton.Clicked += (o, e) => {
				notesModel.Foreach ((model, path, iter) => {
					notesModel.SetValue (iter, 0, true);
					return false;
				});
			};
			var selectNoneButton = new Button ();
			// Translators: This button causes all notes in the list to be unselected
			selectNoneButton.Label = Catalog.GetString ("Select None");
			selectNoneButton.Clicked += (o, e) => {
				notesModel.Foreach ((model, path, iter) => {
					notesModel.SetValue (iter, 0, false);
					return false;
				});
			};
			var notesButtonBox = new HButtonBox ();
			notesButtonBox.Add (selectNoneButton);
			notesButtonBox.Add (selectAllButton);
			notesButtonBox.Spacing = 5;
			notesButtonBox.LayoutStyle = ButtonBoxStyle.End;
			var notesScroll = new ScrolledWindow ();
			notesScroll.Add (notesView);
			notesBox.PackStart (notesScroll, true, true, 0);
			notesBox.PackStart (notesButtonBox, false, true, 0);

			var advancedExpander = new Expander (Catalog.GetString ("Ad_vanced"));
			var expandBox = new VBox ();
			expandBox.PackStart (notesBox, true, true, 0);
			alwaysShowDlgRadio = new RadioButton (Catalog.GetString ("Always show this _window"));
			alwaysShowDlgRadio.Clicked += (o, e) => {
				selectAllButton.Click ();
				notesBox.Sensitive = true;
				renameButton.Sensitive = true;
				dontRenameButton.Sensitive = true;
			};
			neverRenameRadio = new RadioButton (alwaysShowDlgRadio,
			                                    Catalog.GetString ("Never rename _links"));
			neverRenameRadio.Clicked += (o, e) => {
				selectNoneButton.Click ();
				notesBox.Sensitive = false;
				renameButton.Sensitive = false;
				dontRenameButton.Sensitive = true;
			};
			alwaysRenameRadio = new RadioButton (alwaysShowDlgRadio,
			                                     Catalog.GetString ("Alwa_ys rename links"));
			alwaysRenameRadio.Clicked += (o, e) => {
				selectAllButton.Click ();
				notesBox.Sensitive = false;
				renameButton.Sensitive = true;
				dontRenameButton.Sensitive = false;
			};
			expandBox.PackStart (alwaysShowDlgRadio, false, true, 0);
			expandBox.PackStart (neverRenameRadio, false, true, 0);
			expandBox.PackStart (alwaysRenameRadio, false, true, 0);
			advancedExpander.Add (expandBox);
			ContentArea.PackStart (advancedExpander, true, true, 5);

			advancedExpander.Activated += (o, e) =>
				this.Resizable = advancedExpander.Expanded;

			this.Focus = dontRenameButton;
			ContentArea.ShowAll ();
		}
コード例 #29
0
ファイル: staticWindows.cs プロジェクト: Kedrigern/scrabble
        public static void CheckWordDialog(object sender, EventArgs e)
        {
            var lab = new Gtk.Label("Zadejte slovo: ");
            var ent = new Gtk.Entry();
            var but = new Gtk.Button("OK");
            var div = new Gtk.HBox(false, 1 );
            div.PackStart( lab );
            div.Add( ent );
            div.PackEnd( but );
            var checkWin = new Gtk.Window( Gtk.WindowType.Popup );
            checkWin.Add ( div );
            checkWin.BorderWidth = 0;
            checkWin.Modal = true;
            checkWin.CanFocus = true;
            checkWin.SetPosition( WindowPosition.Mouse );
            checkWin.ShowAll();
            ent.Activated += delegate {
                but.Click();
            };
            but.Clicked += delegate {
                checkWin.HideAll();

                if( game.dictionary.Content( ent.Text ) ) {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                            game.Window,
                            DialogFlags.DestroyWithParent,
                            MessageType.Info,
                            ButtonsType.Close,
                            "Slovo \""+ent.Text+"\" <b>je</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                else {
                    Gtk.MessageDialog ans = new Gtk.MessageDialog(
                            game.Window,
                            DialogFlags.DestroyWithParent,
                            MessageType.Info,
                            ButtonsType.Close,
                            "Slovo \""+ent.Text+"\" <b>není</b> ve slovníku"
                        );
                    ans.Run();
                    ans.Destroy();
                }
                checkWin.Dispose();
                checkWin.Destroy();
            };

            checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch( args.Event.Key ) {
                case Gdk.Key.Escape:
                    checkWin.HideAll();
                    checkWin.Dispose();
                    checkWin.Destroy();
                    break;
                case Gdk.Key.ISO_Enter:
                    but.Click();
                    break;
                }
            };
        }
コード例 #30
0
    protected void on_button_accept_clicked(object o, EventArgs args)
    {
        eval.Name      = entry_name.Text.ToString();
        eval.Email     = entry_email.Text.ToString();
        eval.DateBorn  = dateTime;
        eval.CountryID = Convert.ToInt32(
            Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries));

        eval.Comments = textview_comments.Buffer.Text;

        if (radio_cp_undef.Active)
        {
            eval.Chronometer = Constants.UndefinedDefault;
        }
        else if (radio_cp1.Active)
        {
            eval.Chronometer = Constants.ChronometerCp1;
        }
        else if (radio_cp2.Active)
        {
            eval.Chronometer = Constants.ChronometerCp2;
        }
        else if (radio_cp3.Active)
        {
            eval.Chronometer = Constants.ChronometerCp3;
        }
        else
        {
            eval.Chronometer = entry_cp_other.Text.ToString();
        }


        if (radio_device_undef.Active)
        {
            eval.Device = Constants.UndefinedDefault;
        }
        else if (radio_contact_steel.Active)
        {
            eval.Device = Constants.DeviceContactSteel;
        }
        else if (radio_contact_modular.Active)
        {
            eval.Device = Constants.DeviceContactCircuit;
        }
        else if (radio_infrared.Active)
        {
            eval.Device = Constants.DeviceInfrared;
        }
        else
        {
            eval.Device = entry_device_other.Text.ToString();
        }


        changed = false;
        if (creating)
        {
            eval.InsertAtDB(false);
            changed = true;
        }
        else
        {
            //1st see if there are changes
            if (eval.Equals(evalBefore))
            {
                //nothing changed
                //
                //new DialogMessage(Constants.MessageTypes.INFO, "nothing changed.\n");
            }
            else
            {
                //changed
                eval.Update(false);
                changed = true;
            }
        }

        fakeButtonAccept.Click();

        EvaluatorWindowBox.evaluator_window.Hide();
        EvaluatorWindowBox = null;
    }
コード例 #31
0
ファイル: RFID.cs プロジェクト: davidfombella/chronojump
    public void Start()
    {
        /*
         * don't use getPorts that list all the ports
         * use chronopicRegister.Rfid portName
         */
        //List<string> l = getPorts(false);
        //LogB.Information("getPorts");

        //List<string> l = new List<string>();
        //l.Add(portName);

        string lastRFID = "";
        string str      = "";

        LogB.Information("portName: " + portName);
        port = new SerialPort(portName, 9600);         //for the rfid
        port.Open();

        LogB.Information("AT RFID.cs");
        while (!stop)
        {
            //str = port.ReadLine(); //don't use this because gets waiting some stop signal
            str = "";
            try {
                if (port.BytesToRead > 0)
                {
                    str = port.ReadExisting();
                }
            } catch (System.IO.IOException) {
                LogB.Information("Catched reading RFID!");
                fakeButtonDisconnected.Click();
                return;
            }

            if (str != "")
            {
                LogB.Information("No trim str" + str);

                //get only the first line and trim it
                if (str.IndexOf(Environment.NewLine) > 0)
                {
                    str = str.Substring(0, str.IndexOf(Environment.NewLine)).Trim();
                }

                LogB.Information("Yes one line and trim str" + str);

                //this first line should have a 's' and 'e' (mark of 's'tart and 'e'nd of rfid)
                if (str.IndexOf('s') == 0 && str[str.Length - 1] == 'e')
                {
                    str = str.Substring(1, str.Length - 2);

                    if (str != lastRFID)
                    {
                        Captured = str;

                        //Firing the event
                        fakeButtonChange.Click();

                        /*
                         * EventHandler handler = ChangedEvent;
                         * if (handler != null)
                         * handler(this, new EventArgs());
                         */
                        lastRFID = str;
                    }
                    else
                    {
                        //Firing the event
                        fakeButtonReopenDialog.Click();
                    }
                }
            }
            Thread.Sleep(200);
        }
        LogB.Information("AT RFID.cs: STOPPED");
        port.Close();
    }
コード例 #32
0
 private void on_delete_selected_clicked(object o, EventArgs args)
 {
     //activate button to manage on gui/encoder.cs in order to delete from SQL
     button_row_delete.Click();
 }