コード例 #1
0
ファイル: MainForm.cs プロジェクト: CGX-GROUP/DotSpatial
 void Devices_DeviceDetectionAttemptFailed(object sender, DeviceDetectionExceptionEventArgs e)
 {
     BeginInvoke(new MethodInvoker(delegate()
     {
         foreach (ListViewItem item in devicesListView.Items)
         {
             if (object.ReferenceEquals(item.Tag, e.Device))
             {
                 item.SubItems[1].Text = e.Exception.Message;
                 item.ToolTipText      = e.Exception.Message;
                 item.ImageIndex       = 1;
             }
         }
         devicesListView.Refresh();
     }));
 }
コード例 #2
0
        private void Devices_DeviceDetectionAttemptFailed(object sender, DeviceDetectionExceptionEventArgs e)
        {
            /* This event gets raised any time an attempt to test a device for GPS data has failed.
             * Failures can occur for many reasons.  The device may be powered off or the device may not
             * qualify for testing at all.  Some devices such as computers will not be tested.
             *
             * When a failure occurs, the device is colored red (or yellow), and its icon is changed.
             */
            BeginInvoke(new MethodInvoker(delegate()
            {
                // Look through the listview for the device
                foreach (ListViewItem item in devicesListView.Items)
                {
                    /* The Tag property stores a Device object.  Check to see if the
                     * device matches the device which just failed.  Do we have a match?
                     */
                    if (object.ReferenceEquals(item.Tag, e.Device))
                    {
                        // Yes.  The device failed, but has it ever been successfully detected before?
                        if (e.Device.SuccessfulDetectionCount > 0)
                        {
                            /* It has been detected, so it's a GPS device.  It's just not working right now.
                             * Change the icon to a "warning" and color it yellow.
                             */
                            item.ImageIndex = 3;
                            item.ForeColor  = Color.DarkGoldenrod;
                        }
                        else
                        {
                            // The device has never been confirmed as a GPS device.  Color it red.
                            item.ImageIndex = 2;
                            item.ForeColor  = Color.Red;
                        }

                        // Set the third column of the listview item to the error message
                        item.SubItems[2].Text = e.Exception.Message;

                        // Update the log with the message
                        Log(e.Device.Name + ": " + e.Exception.Message);
                        return;
                    }
                }
            }));
        }
コード例 #3
0
ファイル: Diagnostics.cs プロジェクト: CGX-GROUP/DotSpatial
 static void Devices_DeviceDetectionAttemptFailed(object sender, DeviceDetectionExceptionEventArgs e)
 {
     Log("WARNING   " + DateTime.Now.ToLongTimeString() + ": " + e.Device.Name + " has failed detection: " + e.Exception.Message);
 }
コード例 #4
0
 /// <summary>
 /// Handles the DeviceDetectionAttemptFailed event of the Devices control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="DotSpatial.Positioning.DeviceDetectionExceptionEventArgs"/> instance containing the event data.</param>
 private void Devices_DeviceDetectionAttemptFailed(object sender, DeviceDetectionExceptionEventArgs e)
 {
     log.Warn("Device detection failed: " + e.Device.Name, e.Exception);
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: DIVEROVIEDO/DotSpatial
 void Devices_DeviceDetectionAttemptFailed(object sender, DeviceDetectionExceptionEventArgs e)
 {
     BeginInvoke(new MethodInvoker(delegate()
     {
         foreach (ListViewItem item in devicesListView.Items)
         {
             if (object.ReferenceEquals(item.Tag, e.Device))
             {
                 item.SubItems[1].Text = e.Exception.Message;
                 item.ToolTipText = e.Exception.Message;
                 item.ImageIndex = 1;
             }
         }
         devicesListView.Refresh();
     }));
 }