Example #1
0
 private void UpdateFormatList()
 {
     _pendingFormat       = null;
     isUpdatingFormatList = true;
     cbFormats.BeginUpdate();
     cbFormats.Items.Clear();
     try
     {
         if (_camera != null)
         {
             foreach (NMediaFormat format in _camera.GetFormats())
             {
                 cbFormats.Items.Add(format);
             }
             NMediaFormat currentFormat = _camera.GetCurrentFormat();
             if (currentFormat != null)
             {
                 int index = cbFormats.Items.IndexOf(currentFormat);
                 if (index == -1)
                 {
                     cbFormats.Items.Add(currentFormat);
                 }
                 cbFormats.SelectedItem = currentFormat;
             }
         }
     }
     finally
     {
         cbFormats.EndUpdate();
         cbFormats.Enabled    = cbFormats.Items.Count > 0;
         isUpdatingFormatList = false;
     }
 }