Exemplo n.º 1
0
        /// <summary>
        /// Raises a ogama styled message dialog.
        /// </summary>
        /// <param name="title">A <see cref="string"/> with the title to display.</param>
        /// <param name="message">A <see cref="string"/> with the message to display.</param>
        public static void ProcessMessage(string title, string message)
        {
            // Show message dialog
            var newDlg = new InformationDialog(title, message, false, MessageBoxIcon.Information);

            newDlg.ShowDialog();
        }
Exemplo n.º 2
0
    /// <summary>
    /// The <see cref="Control.Click"/> event handler for the
    ///   <see cref="Button"/> <see cref="launchButton"/>.
    ///   Launches the haytham tracker application and
    ///   enables connect button.
    /// </summary>
    /// <param name="sender">
    /// Source of the event.
    /// </param>
    /// <param name="e">
    /// An empty <see cref="EventArgs"/>.
    /// </param>
    private void LaunchButtonClick(object sender, EventArgs e)
    {
      if (!this.IsHaythamApplicationRunning())
      {
        var programFilesFolder = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86);
        string haythamPath = Path.Combine(programFilesFolder, Path.Combine("Haytham", "Haytham.exe"));
        Process.Start(haythamPath);
      }
      else
      {
        var dialog = new InformationDialog(
          "Haytham is already running.",
          string.Format("An instance of haytham tracker is already running on this computer. Ogama will try to connect to this instance."),
          false,
          MessageBoxIcon.Information);
        dialog.ShowDialog();
      }

      ThreadSafe.EnableDisableButton(this.ConnectButton, true);
    }
Exemplo n.º 3
0
    /// <summary>
    /// Overridden <see cref="Control.Click"/> event handler for the
    ///   <see cref="Button"/> RecordButton.
    ///   Checks for valid calibration and tracking data then starts base call.
    /// </summary>
    /// <param name="sender">
    /// Source of the event.
    /// </param>
    /// <param name="e">
    /// An empty <see cref="EventArgs"/>.
    /// </param>
    protected override void BtnRecordClick(object sender, EventArgs e)
    {
      if (!this.clientStatus.HasFlag(HaythamStatus.IsCalibrated))
      {
        var inform = new InformationDialog(
          "Calibration required",
          "Please calibrate first using the user interface of the haytham tracker application.",
          false,
          MessageBoxIcon.Warning);
        inform.ShowDialog();
        return;
      }

      //if (!this.clientStatus.HasFlag(HaythamStatus.IsStreaming))
      //{
      //  var inform = new InformationDialog(
      //    "Streaming required",
      //    "Please start the data stream of the haytham tracker by turning on the data server in the network tab of the haytham tracker application.",
      //    false,
      //    MessageBoxIcon.Warning);
      //  inform.ShowDialog();
      //  return;
      //}

      base.BtnRecordClick(sender, e);
    }
Exemplo n.º 4
0
        ///////////////////////////////////////////////////////////////////////////////
        // Defining Properties                                                       //
        ///////////////////////////////////////////////////////////////////////////////
        #region PROPERTIES
        #endregion //PROPERTIES

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region WINDOWSEVENTHANDLER
        #endregion //WINDOWSEVENTHANDLER

        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for Custom Defined Events                                    //
        ///////////////////////////////////////////////////////////////////////////////
        #region CUSTOMEVENTHANDLER
        #endregion //CUSTOMEVENTHANDLER

        #endregion //EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Methods and Eventhandling for Background tasks                            //
        ///////////////////////////////////////////////////////////////////////////////
        #region BACKGROUNDWORKER
        #endregion //BACKGROUNDWORKER

        ///////////////////////////////////////////////////////////////////////////////
        // Inherited methods                                                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region OVERRIDES
        #endregion //OVERRIDES

        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// Displays an ogama styled message box with specified text, caption, buttons, and icon.
        /// </summary>
        /// <param name="caption">The text to display in the title of the message box. </param>
        /// <param name="message">The text to display in the message box.</param>
        /// <param name="isYesNoCancel"><strong>True</strong> when yes no cancel buttons should be shown,
        /// otherwise <strong>false</strong> only OK button is shown.</param>
        /// <param name="icon">One of the <see cref="MessageBoxIcon"/> values that specifies which icon to display in the message box.</param>
        /// <returns>One of the <see cref="DialogResult"/> values.</returns>
        public static DialogResult Show(string caption, string message, bool isYesNoCancel, MessageBoxIcon icon)
        {
            var dlg = new InformationDialog(caption, message, isYesNoCancel, icon);

            return(dlg.ShowDialog());
        }
Exemplo n.º 5
0
    ///////////////////////////////////////////////////////////////////////////////
    // Defining Properties                                                       //
    ///////////////////////////////////////////////////////////////////////////////
    #region PROPERTIES
    #endregion //PROPERTIES

    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler                                                              //
    ///////////////////////////////////////////////////////////////////////////////
    #region EVENTS

    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
    ///////////////////////////////////////////////////////////////////////////////
    #region WINDOWSEVENTHANDLER
    #endregion //WINDOWSEVENTHANDLER

    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////
    #region CUSTOMEVENTHANDLER
    #endregion //CUSTOMEVENTHANDLER

    #endregion //EVENTS

    ///////////////////////////////////////////////////////////////////////////////
    // Methods and Eventhandling for Background tasks                            //
    ///////////////////////////////////////////////////////////////////////////////
    #region BACKGROUNDWORKER
    #endregion //BACKGROUNDWORKER

    ///////////////////////////////////////////////////////////////////////////////
    // Inherited methods                                                         //
    ///////////////////////////////////////////////////////////////////////////////
    #region OVERRIDES
    #endregion //OVERRIDES

    ///////////////////////////////////////////////////////////////////////////////
    // Methods for doing main class job                                          //
    ///////////////////////////////////////////////////////////////////////////////
    #region METHODS

    /// <summary>
    /// Displays an ogama styled message box with specified text, caption, buttons, and icon. 
    /// </summary>
    /// <param name="caption">The text to display in the title of the message box. </param>
    /// <param name="message">The text to display in the message box.</param>
    /// <param name="isYesNoCancel"><strong>True</strong> when yes no cancel buttons should be shown,
    /// otherwise <strong>false</strong> only OK button is shown.</param>
    /// <param name="icon">One of the <see cref="MessageBoxIcon"/> values that specifies which icon to display in the message box.</param>
    /// <returns>One of the <see cref="DialogResult"/> values.</returns>
    public static DialogResult Show(string caption, string message, bool isYesNoCancel, MessageBoxIcon icon)
    {
      var dlg = new InformationDialog(caption, message, isYesNoCancel, icon);
      return dlg.ShowDialog();
    }
Exemplo n.º 6
0
 /// <summary>
 /// Raises a ogama styled message dialog.
 /// </summary>
 /// <param name="title">A <see cref="string"/> with the title to display.</param>
 /// <param name="message">A <see cref="string"/> with the message to display.</param>
 public static void ProcessMessage(string title, string message)
 {
   // Show message dialog
   var newDlg = new InformationDialog(title, message, false, MessageBoxIcon.Information);
   newDlg.ShowDialog();
 }
Exemplo n.º 7
0
    /// <summary>
    /// The <see cref="DataGridView.UserDeletingRow"/> event handler for the
    /// <see cref="DataGridView"/> <see cref="dgvSubjects"/>.
    /// User deleted row in main table, 
    /// so delete raw data and tables in database for the selected subject.
    /// Sets wait cursor, because it may last a while.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">A <see cref="DataGridViewRowCancelEventArgs"/> with the event data.</param>
    private void dgvSubjects_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
    {
      try
      {
        string subject = Convert.ToString(e.Row.Cells["colSubjectsSubjectName"].Value);
        if (subject != string.Empty)
        {
          InformationDialog question = new InformationDialog(
            "Delete subject ?",
            "Do you really want to delete the recording and videos for subject '" + subject + "'",
            true,
            MessageBoxIcon.Question);
          switch (question.ShowDialog())
          {
            case DialogResult.Cancel:
            case DialogResult.No:
              e.Cancel = true;
              return;
            case DialogResult.Yes:
              break;
          }

          this.Cursor = Cursors.WaitCursor;

          // Update other changes
          this.UpdateDatabase();

          this.isUpdatingData = true;

          // Delete raw data table
          Queries.DeleteRawDataTableInDB(subject);
          this.bsoRawdata.DataSource = null;

          // Delete trial events for subject
          int result = Document.ActiveDocument.DocDataSet.TrialEventsAdapter.DeleteBySubjectName(subject);
          result = Document.ActiveDocument.DocDataSet.TrialEventsAdapter.Fill(Document.ActiveDocument.DocDataSet.TrialEvents);

          // Delete trials for subject
          result = Document.ActiveDocument.DocDataSet.TrialsAdapter.DeleteBySubjectName(subject);
          result = Document.ActiveDocument.DocDataSet.TrialsAdapter.Fill(Document.ActiveDocument.DocDataSet.Trials);

          // Delete fixations for subject
          result = Document.ActiveDocument.DocDataSet.GazeFixationsAdapter.DeleteBySubject(subject);
          result = Document.ActiveDocument.DocDataSet.GazeFixationsAdapter.Fill(Document.ActiveDocument.DocDataSet.GazeFixations);
          result = Document.ActiveDocument.DocDataSet.MouseFixationsAdapter.DeleteBySubject(subject);
          result = Document.ActiveDocument.DocDataSet.MouseFixationsAdapter.Fill(Document.ActiveDocument.DocDataSet.MouseFixations);

          // Delete subject parameters for subject
          result = Document.ActiveDocument.DocDataSet.SubjectParametersAdapter.DeleteBySubjectName(subject);
          result = Document.ActiveDocument.DocDataSet.SubjectParametersAdapter.Fill(Document.ActiveDocument.DocDataSet.SubjectParameters);

          // Delete user video file.
          DirectoryInfo info = new DirectoryInfo(Document.ActiveDocument.ExperimentSettings.ThumbsPath);
          foreach (FileInfo videoFile in info.GetFiles(subject + "*"))
          {
            if (videoFile.Exists)
            {
              File.Delete(videoFile.FullName);
            }
          }

          this.isUpdatingData = false;

          // Database update is done 
          // when closing or on explicit saving with button.
        }
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleException(ex);
      }
      finally
      {
        this.Cursor = Cursors.Default;
      }
    }
Exemplo n.º 8
0
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler                                                              //
    ///////////////////////////////////////////////////////////////////////////////
    #region EVENTS

    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for UI, Menu, Buttons, Toolbars etc.                         //
    ///////////////////////////////////////////////////////////////////////////////
    #region WINDOWSEVENTHANDLER

    /// <summary>
    /// The <see cref="Control.Click"/> event handler for the
    /// <see cref="Button"/> <see cref="launchButton"/>.
    /// Launches the gazetracker application and
    /// enables connect button.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">An empty <see cref="EventArgs"/>.</param>
    private void LaunchButtonClick(object sender, EventArgs e)
    {
      if (!this.IsGazeTrackerApplicationRunning())
      {
        var gazetrackerPath = Path.Combine(
          Application.StartupPath, "GTApplication.exe");
        Process.Start(gazetrackerPath);
      }
      else
      {
        var dialog = new InformationDialog(
          "Gazetracker is already running.",
          string.Format("An instance of gazetracker is already running on this computer. Ogama will try to connect to this instance."),
            false,
            MessageBoxIcon.Information);
        dialog.ShowDialog();
      }

      ThreadSafe.EnableDisableButton(this.ConnectButton, true);
    }