Exemple #1
0
void ProfileWizard::OnDetectPixelSize(wxCommandEvent& evt)
{
    GuideCamera *camera = GuideCamera::Factory(m_SelectedCamera);
    double devPixelSize = 0;
    try
    {
        wxBusyCursor busy;
        if (!camera)
            throw _("Could not initialize camera");
        ShowStatus(_("Connecting to camera..."));
        bool err = camera->Connect(GuideCamera::DEFAULT_CAMERA_ID);
        ShowStatus(wxEmptyString);
        if (err)
            throw _("Could not connect to camera");
        if (camera->GetDevicePixelSize(&devPixelSize) || devPixelSize == 0)
            throw (_("Camera driver cannot report pixel size"));
        m_pPixelSize->SetValue(devPixelSize);
        wxSpinDoubleEvent dummy;
        OnPixelSizeChange(dummy);
    }
    catch (const wxString& msg)
    {
        wxMessageBox(msg + _(". Please enter the correct un-binned pixel size from the camera documentation or vendor web site."), _("Detect Pixel Size"));
        m_pPixelSize->SetValue(0.);
    }

    if (camera)
    {
        if (camera->Connected)
            if (camera->Disconnect())
                Debug.AddLine("Camera disconnect failed!");
        delete camera;
    }
}
void ProfileWizard::OnDetectPixelSize(wxCommandEvent& evt)
{
    GuideCamera *camera = GuideCamera::Factory(m_SelectedCamera);
    try
    {
        wxBusyCursor busy;
        if (!camera)
            throw _("Could not initialize camera");
        ShowStatus(_("Connecting to camera..."));
        bool err = camera->Connect();
        ShowStatus(wxEmptyString);
        if (err)
            throw _("Could not connect to camera");
        m_pPixelSize->SetValue(camera->PixelSize);
        wxSpinDoubleEvent dummy;
        OnPixelSizeChange(dummy);
    }
    catch (const wxString& msg)
    {
        wxMessageBox(msg, _("Detect Pixel Size"));
    }

    if (camera)
    {
        if (camera->Connected)
            if (camera->Disconnect())
                Debug.AddLine("Camera disconnect failed!");
        delete camera;
    }
}