Exemple #1
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);
        }
Exemple #2
0
        /// <summary>
        /// Deserializes the <see cref="MouseOnlySetting"/> from the given xml file.
        /// </summary>
        /// <param name="filePath">Full file path to the xml settings file.</param>
        /// <returns>A <see cref="MouseOnlySetting"/> object.</returns>
        private MouseOnlySetting DeserializeSettings(string filePath)
        {
            var settings = new MouseOnlySetting();

            // Create an instance of the XmlSerializer class;
            // specify the type of object to be deserialized
            var serializer = new XmlSerializer(typeof(MouseOnlySetting));

            // If the XML document has been altered with unknown
            // nodes or attributes, handle them with the
            // UnknownNode and UnknownAttribute events.
            serializer.UnknownNode      += this.SerializerUnknownNode;
            serializer.UnknownAttribute += this.SerializerUnknownAttribute;

            try
            {
                // A FileStream is needed to read the XML document.
                var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);

                /* Use the Deserialize method to restore the object's state with
                 * data from the XML document. */
                settings = (MouseOnlySetting)serializer.Deserialize(fs);
                fs.Close();
            }
            catch (Exception ex)
            {
                InformationDialog.Show(
                    "Error occured",
                    "Deserialization of MouseOnlySettings failed with the following message: " + Environment.NewLine + ex.Message,
                    false,
                    MessageBoxIcon.Error);
            }

            return(settings);
        }
        /// <summary>
        /// This method parses the stimulus file names in the import for
        /// forbidden characters like white space, and shows a notification.
        /// </summary>
        /// <returns><strong>True</strong>, if filenames are valid,
        /// otherwise <strong>false</strong>.</returns>
        private bool CheckforValidFilenames()
        {
            int fileErrorCounter = 0;

            foreach (string filename in this.detectionSetting.TrialIDToImageAssignments.Values)
            {
                if (!IOHelpers.IsValidFilename(filename))
                {
                    fileErrorCounter++;
                }
            }

            if (fileErrorCounter > 0)
            {
                string message = "It seems that at least " + fileErrorCounter.ToString() + " stimulus filenames are not valid, "
                                 + Environment.NewLine + " because they contain white-space "
                                 + " or other unallowed characters." + Environment.NewLine
                                 + "Would you like to revise the names ?";
                if (InformationDialog.Show("Invalid filename", message, true, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Serializes the <see cref="MouseOnlySetting"/> into the given file in a xml structure.
        /// </summary>
        /// <param name="settings">The <see cref="MouseOnlySetting"/> object to serialize.</param>
        /// <param name="filePath">Full file path to the xml settings file.</param>
        private void SerializeSettings(MouseOnlySetting settings, string filePath)
        {
            // Create an instance of the XmlSerializer class;
            // specify the type of object to serialize
            var serializer = new XmlSerializer(typeof(MouseOnlySetting));

            // Serialize the TobiiSetting, and close the TextWriter.
            try
            {
                // Create an instance of StreamWriter to write text to a file.
                // The using statement also closes the StreamWriter.
                using (var writer = new StreamWriter(filePath))
                {
                    serializer.Serialize(writer, settings);
                }
            }
            catch (Exception ex)
            {
                InformationDialog.Show(
                    "Error occured",
                    "Serialization of MouseOnlySettings failed with the following message: " + Environment.NewLine + ex.Message,
                    false,
                    MessageBoxIcon.Error);
            }
        }
Exemple #5
0
        /// <summary>
        /// Return the description of the ASL last error.
        /// </summary>
        /// <param name="msg">error description</param>
        /// <returns><strong>True</strong> if there is a error message to show, otherwise
        /// <strong>false</strong>.</returns>
        private bool GetLastError(string msg)
        {
            bool   somethingShown = true;
            string errorDesc      = string.Empty;

            try
            {
                // Would be called after any other function returns an error.
                // Note : this function clears the error description
                this.aslPort.GetLastError(out errorDesc);
                if (errorDesc.Length != 0)
                {
                    ExceptionMethods.ProcessErrorMessage(msg + Environment.NewLine + errorDesc);
                }
                else
                {
                    somethingShown = false;
                }

                return(somethingShown);
            }
            catch (Exception ex)
            {
                InformationDialog.Show(
                    "GetLastError failed",
                    "ASL GetLastError failed with the following message : " + Environment.NewLine + ex.Message,
                    false,
                    MessageBoxIcon.Error);

                return(somethingShown);
            }
        }
        private void LaunchInformationDialog(string sourceName)
        {
            try
            {
                if (informationDialog == null)
                {
                    informationDialog = new InformationDialog
                    {
                        Height = 500,
                        Width  = 400
                    };
                    informationDialog.Closed += (o, args) =>
                    {
                        informationDialog = null;
                    };
                    informationDialog.Closing += (o, args) =>
                    {
                    };
                }

                informationDialog.Height = 500;
                informationDialog.Width  = 400;

                var filePath = AppDomain.CurrentDomain.BaseDirectory + @"HelpFiles\" + sourceName + ".html";
                var helpFile = File.ReadAllText(filePath);

                informationDialog.HelpInfo.NavigateToString(helpFile);
                informationDialog.Launch();
            }
            catch (Exception ex)
            {
                LogErrorMessage(ex);
            }
        }
Exemple #7
0
        /// <summary>
        /// This method shows an dialog to ask for saving settings,
        /// and returns true if successful and false, if saving has been cancelled.
        /// </summary>
        /// <returns><strong>True</strong> if successful and <strong>false</strong>,
        /// if saving has been cancelled.</returns>
        private bool SaveAndDisposeDocument()
        {
            Properties.Settings.Default.Save();

            if (Document.ActiveDocument != null)
            {
                if (Document.ActiveDocument.Modified)
                {
                    string message = "This document has been modified. "
                                     + Environment.NewLine +
                                     "Do you want to save ?";
                    switch (InformationDialog.Show("Save document ?", message, true, MessageBoxIcon.Question))
                    {
                    case DialogResult.Yes:
                        this.SaveExperimentToFile();
                        break;

                    case DialogResult.No:
                        break;

                    case DialogResult.Cancel:
                        return(false);
                    }
                }

                RecentFilesList.List.Add(Document.ActiveDocument.ExperimentSettings.DocumentFilename);

                // CleanUpDocument
                this.CleanUpDocument();
            }

            return(true);
        }
        /// <summary>
        /// This method writes the current assemply version
        /// into the <see cref="OgamaVersion"/> property.
        /// </summary>
        /// <returns><strong>True</strong> if version of opened file
        /// is less or equal to the ogama application version
        /// that is opening it, otherwise <strong>false</strong></returns>
        public bool UpdateVersion()
        {
            Version current = Assembly.GetExecutingAssembly().GetName().Version;

            if (this.OgamaVersion > current)
            {
                // Opening an experiment file made with a newer ogama version
                string message = "You are trying to open an experiment file that has "
                                 + "been created or saved with a never version of OGAMA: V" +
                                 this.OgamaVersion.ToString(4) + Environment.NewLine +
                                 "This could damage your experiment. " +
                                 "Please use the recent version of OGAMA by doing an update." +
                                 Environment.NewLine + "OGAMA will now close this experiment for " +
                                 "safety reasons." +
                                 Environment.NewLine + Environment.NewLine +
                                 "Hitting cancel or no will try to ignore this problem.";
                DialogResult result = InformationDialog.Show(
                    "Opening experiment with an old version  of OGAMA.",
                    message,
                    true,
                    MessageBoxIcon.Warning);
                switch (result)
                {
                case DialogResult.Cancel:
                case DialogResult.No:
                    break;

                case DialogResult.Yes:
                    return(false);
                }
            }

            this.OgamaVersion = current;
            return(true);
        }
        ///////////////////////////////////////////////////////////////////////////////
        // Small helping Methods                                                     //
        ///////////////////////////////////////////////////////////////////////////////
        #region HELPER

        /// <summary>
        /// This method checks for correct parsing
        /// and returns false if no columns are found in the import file.
        /// </summary>
        /// <returns><strong>True</strong> if successful, otherwise
        /// <strong>false</strong>.</returns>
        private bool ValidateParsing()
        {
            if (this.asciiSetting.ColumnHeaders.Count == 0)
            {
                string message = "Under the given parsing conditions no data column could be read ..." +
                                 Environment.NewLine + "Please try again with other settings until the preview table " +
                                 "shows the import file in a correct manner.";
                InformationDialog.Show("No data column found ...", message, false, MessageBoxIcon.Warning);
                return(false);
            }

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

            foreach (string header in this.asciiSetting.ColumnHeaders)
            {
                if (test.Contains(header))
                {
                    string message = "The import columns should have unique column headers." + Environment.NewLine +
                                     "The column header: '" + header + "' is not unique." + Environment.NewLine +
                                     "Please go back and change by clicking on the header.";
                    InformationDialog.Show("Duplicated column name ...", message, false, MessageBoxIcon.Warning);
                    return(false);
                }

                test.Add(header);
            }

            return(true);
        }
Exemple #10
0
        /// <summary>
        /// <see cref="XmlSerializer.UnknownNode"/> event handler for
        ///   the <see cref="XmlSerializer"/>, that raises
        ///   a error message box when getting an unknown node in the
        ///   xml settings file.
        /// </summary>
        /// <param name="sender">
        /// Source of the event.
        /// </param>
        /// <param name="e">
        /// A <see cref="XmlNodeEventArgs"/> that contains the event data.
        /// </param>
        protected void SerializerUnknownNode(object sender, XmlNodeEventArgs e)
        {
            string message = "Unknown Node:" + e.Name + "\t" + e.Text + Environment.NewLine + " in tracker settings file."
                             + Environment.NewLine + "I try to ignore it.";

            InformationDialog.Show("XML error", message, false, MessageBoxIcon.Information);
        }
Exemple #11
0
 public void ReprocessWorkQueueItem(ServerEntityKey itemKey)
 {
     if (itemKey != null)
     {
         Model.WorkQueue item       = Model.WorkQueue.Load(itemKey);
         var             controller = new WorkQueueController();
         try
         {
             if (controller.ReprocessWorkQueueItem(item))
             {
                 InformationDialog.Message     = SR.ReprocessOK;
                 InformationDialog.MessageType = MessageBox.MessageTypeEnum.INFORMATION;
                 InformationDialog.Show();
             }
             else
             {
                 InformationDialog.Message     = SR.ReprocessFailed;
                 InformationDialog.MessageType = MessageBox.MessageTypeEnum.ERROR;
                 InformationDialog.Show();
             }
         }
         catch (InvalidStudyStateOperationException ex)
         {
             ShowErrorMessage(ex.Message);
         }
     }
 }
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var connection = selection.GetConnectionOfFirstItem();

            if (connection != null && !connection.Session.IsLocalSuperuser && !Registry.DontSudo &&
                connection.Session.Roles.All(r => r.name_label != Role.MR_ROLE_POOL_ADMIN))
            {
                var currentRoles = connection.Session.Roles;
                currentRoles.Sort();

                var msg = string.Format(Messages.ROTATE_POOL_SECRET_RBAC_RESTRICTION, currentRoles[0].FriendlyName(),
                                        Role.FriendlyName(Role.MR_ROLE_POOL_ADMIN));

                using (var dlg = new ErrorDialog(msg))
                    dlg.ShowDialog(Parent);

                return;
            }

            if (Properties.Settings.Default.RemindChangePassword)
            {
                using (var dlg = new InformationDialog(Messages.ROTATE_POOL_SECRET_REMIND_CHANGE_PASSWORD)
                {
                    ShowCheckbox = true, CheckboxCaption = Messages.DO_NOT_SHOW_THIS_MESSAGE
                })
                {
                    dlg.ShowDialog(Parent);
                    Properties.Settings.Default.RemindChangePassword = !dlg.IsCheckBoxChecked;
                }
            }

            new DelegatedAsyncAction(connection, Messages.ROTATE_POOL_SECRET_TITLE,
                                     Messages.ROTATE_POOL_SECRET_TITLE, Messages.COMPLETED,
                                     Pool.rotate_secret, "pool.rotate_secret").RunAsync();
        }
Exemple #13
0
        /// <summary>
        ///   This method shows a dialog, that gives the option
        ///   to use a import settings file during import.
        /// </summary>
        /// <remarks>
        ///   This functionality is extremely useful, when multiple log
        ///   files of the same type should be imported.
        /// </remarks>
        private static void AskforUsingSettingsFile()
        {
            DialogResult result = InformationDialog.Show(
                "Use settings ?",
                "Would you like to use a settings file ?",
                true,
                MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                var ofdOpenSettings = new OpenFileDialog
                {
                    DefaultExt  = "ois",
                    FileName    = "*.ois",
                    FilterIndex = 1,
                    //InitialDirectory = Properties.Settings.Default.ImportSettingsPath,
                    Filter = "Ogama import settings files|*.ois",
                    Title  = "Please select import settings file ..."
                };
                if (ofdOpenSettings.ShowDialog() == DialogResult.OK)
                {
                    string settingsFilename = ofdOpenSettings.FileName;
                    DeserializeSettings(settingsFilename);
                    detectionSetting.SubjectName   = "Subject1";
                    detectionSetting.SavedSettings = true;
                }
            }
        }
Exemple #14
0
        public Task Information(IDialogData dialogData)
        {
            var dialog = new InformationDialog {
                DataContext = new InformationViewModel(dialogData)
            };

            return(DialogHost.Show(dialog, _identifier));
        }
 private void ShowMustRebootBox()
 {
     if (!MainWindowCommandInterface.RunInAutomatedTestMode)
     {
         using (var dlg = new InformationDialog(Messages.NEW_DVD_DRIVE_REBOOT_TOOLS))
             dlg.ShowDialog(Parent);
     }
 }
Exemple #16
0
        /// <summary>
        /// <see cref="XmlSerializer.UnknownAttribute"/> event handler for
        ///   the <see cref="XmlSerializer"/>, that raises
        ///   a error message box when getting an unknown attribute in the
        ///   xml settings file.
        /// </summary>
        /// <param name="sender">
        /// Source of the event.
        /// </param>
        /// <param name="e">
        /// A <see cref="XmlAttributeEventArgs"/> that contains the event data.
        /// </param>
        protected void SerializerUnknownAttribute(object sender, XmlAttributeEventArgs e)
        {
            XmlAttribute attr    = e.Attr;
            string       message = "Unknown attribute " + attr.Name + "='" + attr.Value + "'" + Environment.NewLine
                                   + " in tracker settings file." + Environment.NewLine + "I try to ignore it.";

            InformationDialog.Show("Unknown attribute", message, false, MessageBoxIcon.Information);
        }
        /// <summary>
        /// This method parses the xml file for a slide layout of Ogama V1
        /// and updates them to the current format.
        /// </summary>
        /// <param name="reader">The <see cref="XmlReader"/> with the file to parse.</param>
        /// <param name="slideSerializer">The <see cref="XmlSerializer"/> for deserializing slide nodes.</param>
        protected void ParseOgamaV1Slideshow(XmlReader reader, XmlSerializer slideSerializer)
        {
            string message = "You are opening an OGAMA 1.X experiment." + Environment.NewLine + Environment.NewLine +
                             "The experiment file along with the database need to be converted to the new Ogama 2 format." +
                             Environment.NewLine +
                             "PLEASE NOTE: Be sure to have a backup copy of the whole experiment along with the database before doing this conversion !" +
                             " (Zip or copy the whole experiment folder.)" +
                             Environment.NewLine +
                             "The possibility is not ruled out, that the conversion fails and your experiment data " +
                             "is lost." + Environment.NewLine + Environment.NewLine +
                             "Can we start with the conversion now ?";
            DialogResult result = InformationDialog.Show("Upgrade experiment to new version ?", message, true, MessageBoxIcon.Question);

            switch (result)
            {
            case DialogResult.Cancel:
            case DialogResult.No:
                throw new WarningException("Upgrading cancelled due to user request");

            case DialogResult.Yes:
                break;
            }

            // Go through all slides in the serialized List<Slide>
            while (reader.Name == "Slide")
            {
                Slide actualSlide = (Slide)slideSerializer.Deserialize(reader);

                // Remove fill flag for images, because in V1 it was used
                // to indicate the drawing of the image, but in V2
                // It indicates a transparent fill over the image.
                foreach (VGElement element in actualSlide.VGStimuli)
                {
                    if (element is VGImage)
                    {
                        element.ShapeDrawAction |= ~ShapeDrawAction.Fill;
                    }

                    if (element is VGText)
                    {
                        element.ShapeDrawAction |= ~ShapeDrawAction.Edge;
                    }

                    if ((int)element.ShapeDrawAction < 0)
                    {
                        element.ShapeDrawAction = ShapeDrawAction.None;
                    }
                }

                var slideshow = this as Slideshow;

                // Add node
                var slideNode = new SlideshowTreeNode(actualSlide.Name);
                slideNode.Name  = slideshow.GetUnusedNodeID();
                slideNode.Slide = actualSlide;
                slideshow.Nodes.Add(slideNode);
            }
        }
Exemple #18
0
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler                                                              //
        ///////////////////////////////////////////////////////////////////////////////
        #region EVENTHANDLER
        #endregion //EVENTHANDLER

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

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

        /// <summary>
        /// Raw Data Event Handler. Throws a GazeDataChanged-Event.
        /// </summary>
        /// <remarks>La structure des données GazeData est déclarée dans le fichier Recording\GazeData.cs
        /// Le type GazeDataChangedEventArgs, dérivant de EventArgs, encapsulant ces
        ///      informations est la classe Common\CustomEventArgs\GazeDataChangedEventArgs.cs
        /// La déclaration du delegate d'évènement GazeDataChangedEventHandler est faite dans le
        /// fichier Common\CustomEventArgs\GazeDataChangedEventArgs.cs
        /// La déclaration de l'évènement GazeDataChanged,
        /// la création de la méthode protégée, OnGazeDataChanged,
        /// destinée à "publier" l'évènement
        /// et l'abonnement à l'évènement
        /// sont faits dans la classe abstraite Recording\TrackerBase\Tracker.cs
        /// Le gestionnaire de l'évènement, la méthode associée à l'évènement,
        /// ITracker_GazeDataChanged est créée dans la classe RecordModule.cs
        /// L'évènement est signalé à la fin de cette méthode</remarks>
        private void aslRawDataReceived()
        {
            // object [] items; Erreur impossible de convertir de 'out object[]' en 'out System.Array'
            // [MarshalAs(UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_VARIANT)] System.Array items;
            float diam = 0;

            try
            {
                this.aslPort.GetScaledData(
                    out this.items,
                    out this.itemCount,
                    out this.available);

                if (Convert.ToByte(this.items.GetValue(0)) == 0) // if Status = normal
                {
                    // All items value are never null
                    // newGazeData.PupilDiaX = Convert.ToSingle(items.GetValue(1));
                    diam = Convert.ToSingle(this.items.GetValue(1));

                    // Save current timestamp
                    this.setCurrentTime();

                    // Get gazeTimestamp in milliseconds.
                    this.newGazeData.Time = this.LastTimeStamp;

                    // Set pupil diameter in mm
                    this.newGazeData.PupilDiaX = diam * this.PupilScaleFactor;
                    this.newGazeData.PupilDiaY = this.newGazeData.PupilDiaX;

                    // Calculate values between 0..1
                    this.newGazeData.GazePosX = Convert.ToSingle(this.items.GetValue(3));
                    this.newGazeData.GazePosY = Convert.ToSingle(this.items.GetValue(4));
                    this.newGazeData.GazePosX = this.newGazeData.GazePosX / this.MaxHorizontal;
                    this.newGazeData.GazePosY = this.newGazeData.GazePosY / this.MaxVertical;

                    // raise the event
                    this.OnGazeDataChanged(new GazeDataChangedEventArgs(this.newGazeData));
                }
                else
                {
                    InformationDialog.Show(
                        "Error occured",
                        "ASL GetScaledData failed with the following error number : " + this.items.GetValue(0),
                        false,
                        MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                if (!this.GetLastError("ASL GetDataRecord failed "))
                {
                    ExceptionMethods.ProcessErrorMessage("ASL GetDataRecord failed " + ex.Message);
                }

                this.CleanUp();
            }
        } // end of aslRawDataReceived()
        /// <summary>
        /// Starts calibration.
        /// </summary>
        /// <param name="isRecalibrating">
        /// whether to use recalibration or not.
        /// </param>
        /// <returns>
        /// <strong>True</strong> if calibration succeded, otherwise
        ///   <strong>false</strong>.
        /// </returns>
        public override bool Calibrate(bool isRecalibrating)
        {
            try
            {
                // Should hide TrackStatusDlg
                if (this.dlgTrackStatus != null)
                {
                    this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent;
                    this.ShowOnSecondaryScreenButton.Text      = "Show on presentation screen";
                    this.dlgTrackStatus.Close();
                }

                var pointCount = 9;

                switch (this.theEyeTribeSettings.CalibrationPointCount)
                {
                case TheEyeTribeCalibrationPoints.Nine:
                    pointCount = 9;
                    break;

                case TheEyeTribeCalibrationPoints.Twelve:
                    pointCount = 12;
                    break;

                case TheEyeTribeCalibrationPoints.Sixteen:
                    pointCount = 16;
                    break;
                }

                // Start a new calibration procedure
                var calRunner = new CalibrationRunner(
                    PresentationScreen.GetPresentationScreen(),
                    PresentationScreen.GetPresentationBounds().Size,
                    pointCount);
                calRunner.BackgroundColor    = new System.Windows.Media.SolidColorBrush(ToMediaColor(this.theEyeTribeSettings.CalibrationBackgroundColor));
                calRunner.HelpVisibility     = this.theEyeTribeSettings.DisplayHelp ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
                calRunner.PointColor         = new System.Windows.Media.SolidColorBrush(ToMediaColor(this.theEyeTribeSettings.CalibrationPointColor));
                calRunner.PointRecordingTime = this.theEyeTribeSettings.PointDisplayTime;

                calRunner.Start(); // blocks until complete
                calRunner.OnResult += calRunner_OnResult;
            }
            catch (Exception ex)
            {
                InformationDialog.Show(
                    "Calibration failed",
                    "TheEyeTribe calibration failed with the following message: " + Environment.NewLine + ex.Message,
                    false,
                    MessageBoxIcon.Error);

                this.CleanUp();
                return(false);
            }

            return(true);
        }
        private void ScanForSRs(SR.SRTypes type)
        {
            var srs = new List <SR.SRInfo>();

            switch (type)
            {
            case SR.SRTypes.lvmohba:
                var devices = FiberChannelScan();
                if (devices != null && devices.Count > 0)
                {
                    foreach (FibreChannelDevice device in devices)
                    {
                        string deviceId    = string.IsNullOrEmpty(device.SCSIid) ? device.Path : device.SCSIid;
                        var    metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmohba, deviceId,
                                                              new Dictionary <string, string> {
                            { SCSIID, device.SCSIid }
                        });
                        if (metadataSrs != null && metadataSrs.Count > 0)
                        {
                            srs.AddRange(metadataSrs);
                        }
                    }
                }
                AddScanResultsToDataGridView(srs, SR.SRTypes.lvmohba);
                break;

            case SR.SRTypes.lvmoiscsi:
                using (var dialog = new IscsiDeviceConfigDialog(Connection))
                {
                    if (dialog.ShowDialog(this) == DialogResult.OK)
                    {
                        Dictionary <String, String> dconf = dialog.DeviceConfig;
                        string deviceId = string.IsNullOrEmpty(dconf[SCSIID]) ? dconf[LUNSERIAL] : dconf[SCSIID];

                        var metadataSrs = ScanDeviceForSRs(SR.SRTypes.lvmoiscsi, deviceId, dconf);
                        if (metadataSrs != null && metadataSrs.Count > 0)
                        {
                            srs.AddRange(metadataSrs);
                        }
                    }
                    else
                    {
                        // if the user cancels the dialog there is no need to show the "no SRs found" pop-up
                        return;
                    }
                }
                AddScanResultsToDataGridView(srs, SR.SRTypes.lvmoiscsi);
                break;
            }

            if (srs.Count == 0)
            {
                using (var dlg = new InformationDialog(Messages.DR_WIZARD_STORAGEPAGE_SCAN_RESULT_NONE))
                    dlg.ShowDialog(this);
            }
        }
Exemple #21
0
 private void ShowCanBeResumedInfo()
 {
     using (var dialog = new InformationDialog(Messages.ROLLING_UPGRADE_CAN_RESUME_UPGRADE)
     {
         WindowTitle = Messages.ROLLING_POOL_UPGRADE
     })
     {
         dialog.ShowDialog(Program.MainWindow);
     }
 }
Exemple #22
0
 private void ShowHotPlugError()
 {
     using (var dlg = new InformationDialog(Messages.VIF_HOTPLUG_FAILED_MESSAGE)
     {
         WindowTitle = Messages.VIF_HOTPLUG_FAILED_TITLE
     })
     {
         dlg.ShowDialog(Program.MainWindow);
     }
 }
Exemple #23
0
        /// <summary>
        /// Saves the current slides collection to a OGAMA slideshow file.
        /// </summary>
        /// <param name="filePath">Path to slideshow file.</param>
        /// <returns><strong>True</strong> if successful,
        /// otherwise <strong>false</strong>.</returns>
        private DialogResult SaveSlideshowToFile(string filePath)
        {
            try
            {
                if (this.trvSlideshow.Nodes[0].Nodes.Count == 0)
                {
                    return(DialogResult.Cancel);
                }

                using (TextWriter writer = new StreamWriter(filePath))
                {
                    string message = "Would you like to export the whole slideshow ?" +
                                     Environment.NewLine + "Otherwise only the selected tree node will be exported";
                    DialogResult result = InformationDialog.Show("Save whole slideshow ?", message, true, MessageBoxIcon.Question);

                    switch (result)
                    {
                    case DialogResult.Cancel:
                        return(DialogResult.Cancel);

                    case DialogResult.No:
                        // Create an instance of the XmlSerializer class;
                        // specify the type of object to serialize
                        XmlSerializer     serializer  = new XmlSerializer(typeof(SlideshowTreeNode));
                        SlideshowTreeNode currentNode = this.slideshow;
                        if (this.trvSlideshow.SelectedNodes.Count > 0)
                        {
                            currentNode = (SlideshowTreeNode)this.trvSlideshow.SelectedNodes[0];
                        }

                        // Serialize the Nodes
                        serializer.Serialize(writer, currentNode);
                        break;

                    case DialogResult.Yes:
                        // Create an instance of the XmlSerializer class;
                        // specify the type of object to serialize
                        serializer = new XmlSerializer(typeof(Slideshow));
                        Slideshow currentSlideshow = this.slideshow;

                        // Serialize the Nodes
                        serializer.Serialize(writer, currentSlideshow);
                        return(DialogResult.OK);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionMethods.HandleException(ex);

                return(DialogResult.Abort);
            }

            return(DialogResult.OK);
        }
Exemple #24
0
        protected override Actions.AsyncAction CreateAction(out bool cancelled)
        {
            Program.Invoke(Program.MainWindow, () =>
            {
                using (var dlg = new InformationDialog(_longMessage))
                    dlg.ShowDialog();
            });

            cancelled = true;
            return(null);
        }
Exemple #25
0
 private void Action_ShowUserInstruction(string message)
 {
     Program.Invoke(Program.MainWindow, () =>
     {
         if (!Program.RunInAutomatedTestMode)
         {
             using (var dlg = new InformationDialog(message))
                 dlg.ShowDialog(Program.MainWindow);
         }
     });
 }
Exemple #26
0
        /// <summary>
        /// Starts calibration.
        /// </summary>
        /// <param name="isRecalibrating">
        /// whether to use recalibration or not.
        /// </param>
        /// <returns>
        /// <strong>True</strong> if calibration succeded, otherwise
        ///   <strong>false</strong>.
        /// </returns>
        public override bool Calibrate(bool isRecalibrating)
        {
            try
            {
                var runner = new TobiiCalibrationRunner();

                try
                {
                    // Should hide TrackStatusDlg
                    if (this.dlgTrackStatus != null)
                    {
                        this.ShowOnSecondaryScreenButton.BackColor = Color.Transparent;
                        this.ShowOnSecondaryScreenButton.Text      = "Show on presentation screen";
                        this.dlgTrackStatus.Close();
                    }

                    // Start a new calibration procedure
                    Calibration result = runner.RunCalibration(connectedTracker);

                    // Show a calibration plot if everything went OK
                    if (result != null)
                    {
                        this.tobiiCalibPlot.Initialize(result.Plot);
                        this.ShowCalibPlot();
                    }
                    else
                    {
                        MessageBox.Show("Not enough data to create a calibration (or calibration aborted).");
                    }
                }
                catch (EyetrackerException ee)
                {
                    MessageBox.Show(
                        "Failed to calibrate. Got exception " + ee,
                        "Calibration Failed",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                InformationDialog.Show(
                    "Calibration failed",
                    "Tobii calibration failed with the following message: " + Environment.NewLine + ex.Message,
                    false,
                    MessageBoxIcon.Error);

                this.CleanUp();
                return(false);
            }

            return(true);
        }
 /// <summary>
 /// Called when the connection state changed.
 /// </summary>
 /// <param name="isConnected">If set to <c>true</c> the tracker is connected.</param>
 public void OnConnectionStateChanged(bool isConnected)
 {
     if (!isConnected)
     {
         InformationDialog.Show(
             "Tracker connection lost.",
             "The connection to the eye tribe tracker was lost. Please reconnect.",
             false,
             MessageBoxIcon.Exclamation);
         this.CleanUp();
     }
 }
        /// <summary>
        /// Event handler for a lost pool connection
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void wlbReportView1_PoolConnectionLost(object sender, EventArgs e)
        {
            using (var dlg = new InformationDialog(String.Format(Messages.WLB_REPORT_POOL_CONNECTION_LOST, _pool.Name()))
            {
                WindowTitle = Messages.WLBREPORT_POOL_CONNECTION_LOST_CAPTION
            })
            {
                dlg.ShowDialog(this);
            }

            this.Close();
            this.Dispose();
        }
        public static void ShowInformationBox(this FrameworkElement source, string message, string caption = null)
        {
            var dialog = new InformationDialog()
            {
                Message = message,
                Owner   = Window.GetWindow(source)
            };

            if (caption == null)
            {
                dialog.Title = Lang.GetText(App.Name);
            }

            dialog.ShowDialog();
        }
 /// <summary>
 ///   Stops tracking.
 /// </summary>
 public override void Stop()
 {
     try
     {
         this.isTracking = false;
     }
     catch (Exception ex)
     {
         InformationDialog.Show(
             "Stop failed",
             "TheEyeTribe stop tracking failed with the following message: " + Environment.NewLine + ex.Message,
             false,
             MessageBoxIcon.Error);
     }
 }
 private void Load()
 {
     if (System.IO.File.Exists("config.txt"))
     {
         try
         {
             string[] lines = System.IO.File.ReadAllText("config.txt").Split('\n');
             this.user = lines[0].Trim();
             this.rootFolder = lines[1].Trim();
             this.loaded = true;
             return;
         }
         catch (Exception) { }
     }
     InformationDialog d = new InformationDialog();
     d.ShowDialog();
     this.user = d.User;
     this.rootFolder = d.RootPath;
     this.loaded = true;
     this.Save();
 }