本文整理汇总了C#中ICameraDevice.LoadProperties方法的典型用法代码示例。如果您正苦于以下问题:C# ICameraDevice.LoadProperties方法的具体用法?C# ICameraDevice.LoadProperties怎么用?C# ICameraDevice.LoadProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICameraDevice
的用法示例。
在下文中一共展示了ICameraDevice.LoadProperties方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCommand
public void ExecuteCommand(string cmd, object param)
{
switch (cmd)
{
case WindowsCmdConsts.CameraPropertyWnd_Show:
PhotoSessionNames.Clear();
PhotoSessionNames.Add("(None)");
foreach (PhotoSession photoSession in ServiceProvider.Settings.PhotoSessions)
{
PhotoSessionNames.Add(photoSession.Name);
}
CameraPresets.Clear();
CameraPresets.Add("(None)");
foreach (var cameraPresets in ServiceProvider.Settings.CameraPresets)
{
CameraPresets.Add(cameraPresets.Name);
}
_cameraDevice = param as ICameraDevice;
if (_cameraDevice == null)
return;
CameraProperty = _cameraDevice.LoadProperties();
CameraProperty.BeginEdit();
Dispatcher.Invoke(new Action(delegate
{
Show();
Activate();
Topmost = true;
//Topmost = false;
Focus();
}));
break;
case WindowsCmdConsts.CameraPropertyWnd_Hide:
CameraProperty = null;
Hide();
break;
case CmdConsts.All_Close:
Dispatcher.Invoke(new Action(delegate
{
Hide();
Close();
}));
break;
}
}
示例2: Get
public void Get(ICameraDevice camera)
{
Add(GetFrom(camera.Mode, "Mode"));
Add(GetFrom(camera.CompressionSetting, "CompressionSetting"));
Add(GetFrom(camera.ExposureCompensation, "ExposureCompensation"));
Add(GetFrom(camera.ExposureMeteringMode, "ExposureMeteringMode"));
Add(GetFrom(camera.FNumber, "FNumber"));
Add(GetFrom(camera.IsoNumber, "IsoNumber"));
Add(GetFrom(camera.ShutterSpeed, "ShutterSpeed"));
Add(GetFrom(camera.WhiteBalance, "WhiteBalance"));
Add(GetFrom(camera.FocusMode, "FocusMode"));
Add(GetFrom(camera.LiveViewImageZoomRatio, "LiveViewImageZoomRatio"));
Add(new ValuePair {Name = "CaptureInSdRam", Value = camera.CaptureInSdRam.ToString()});
Add(new ValuePair {Name = "HostMode", Value = camera.HostMode.ToString()});
var property = camera.LoadProperties();
Add(new ValuePair { Name = "NoDownload", Value = property.NoDownload.ToString() });
if (camera.AdvancedProperties != null)
{
foreach (PropertyValue<long> propertyValue in camera.AdvancedProperties)
{
Add(GetFrom(propertyValue, propertyValue.Name));
}
}
}
示例3: DeviceManager_CameraSelected
private void DeviceManager_CameraSelected(ICameraDevice oldcameraDevice, ICameraDevice newcameraDevice)
{
if (newcameraDevice == null)
return;
Log.Debug("DeviceManager_CameraSelected 1");
var thread = new Thread(delegate()
{
CameraProperty property = newcameraDevice.LoadProperties();
// load session data only if not session attached to the selected camera
if (newcameraDevice.AttachedPhotoSession == null)
{
newcameraDevice.AttachedPhotoSession =
ServiceProvider.Settings.GetSession(property.PhotoSessionName);
}
if (newcameraDevice.AttachedPhotoSession != null)
ServiceProvider.Settings.DefaultSession =
(PhotoSession)newcameraDevice.AttachedPhotoSession;
});
thread.Start();
Log.Debug("DeviceManager_CameraSelected 2");
}
示例4: cameraDevice_CameraInitDone
private void cameraDevice_CameraInitDone(ICameraDevice cameraDevice)
{
Log.Debug("cameraDevice_CameraInitDone 1");
var property = cameraDevice.LoadProperties();
CameraPreset preset = ServiceProvider.Settings.GetPreset(property.DefaultPresetName);
// multiple canon cameras block with this settings
Console.WriteLine(ServiceProvider.DeviceManager.ConnectedDevices.Count);
if ((cameraDevice is CanonSDKBase && ServiceProvider.Settings.LoadCanonTransferMode) || !(cameraDevice is CanonSDKBase))
cameraDevice.CaptureInSdRam = property.CaptureInSdRam;
Log.Debug("cameraDevice_CameraInitDone 1a");
if (ServiceProvider.Settings.SyncCameraDateTime)
{
try
{
Log.Debug("set time 1");
cameraDevice.DateTime = DateTime.Now;
Log.Debug("set time 2");
}
catch (Exception exception)
{
Log.Error("Unable to sysnc date time", exception);
}
}
Log.Debug("cameraDevice_CameraInitDone 2");
if (preset != null)
{
var thread = new Thread(delegate()
{
try
{
Thread.Sleep(1500);
cameraDevice.WaitForCamera(5000);
preset.Set(cameraDevice);
}
catch (Exception e)
{
Log.Error("Unable to load default preset", e);
}
});
thread.Start();
}
Log.Debug("cameraDevice_CameraInitDone 3");
ServiceProvider.Analytics.CameraConnected(cameraDevice);
}
示例5: Pharse
public string Pharse(string template, PhotoSession session, ICameraDevice device, string fileName)
{
CameraProperty property = device.LoadProperties();
switch (template)
{
case "[Counter 3 digit]":
case "[Counter 4 digit]":
case "[Counter 5 digit]":
case "[Counter 6 digit]":
case "[Counter 7 digit]":
case "[Counter 8 digit]":
case "[Counter 9 digit]":
return session.Counter.ToString(new string('0', Convert.ToInt16(template.Substring(9, 1))));
case "[Series 4 digit]":
return session.Series.ToString(new string('0', 4));
case "[Camera Counter 3 digit]":
case "[Camera Counter 4 digit]":
case "[Camera Counter 5 digit]":
case "[Camera Counter 6 digit]":
case "[Camera Counter 7 digit]":
case "[Camera Counter 8 digit]":
case "[Camera Counter 9 digit]":
return property.Counter.ToString(new string('0', Convert.ToInt16(template.Substring(16, 1))));
case "[Session Name]":
return session.Name;
case "[Capture Name]":
return session.CaptureName;
case "[Exposure Compensation]":
if (device!=null && device.ExposureCompensation != null)
return device.ExposureCompensation.Value != "0" ? device.ExposureCompensation.Value : "";
return "";
case "[FNumber]":
if (device != null && device.FNumber != null)
return device.FNumber.Value ?? "";
return "";
case "[Date yyyy-MM-dd]":
return DateTime.Now.ToString("yyyy-MM-dd");
case "[Date yyyy]":
return DateTime.Now.ToString("yyyy");
case "[Date yyyy-MM]":
return DateTime.Now.ToString("yyyy-MM");
case "[Date MMM]":
return DateTime.Now.ToString("MMM");
case "[Date yyyy-MM-dd-hh-mm-ss]":
return DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss");
case "[Time hh-mm-ss]":
return DateTime.Now.ToString("hh-mm-ss");
case "[Time hh-mm]":
return DateTime.Now.ToString("hh-mm");
case "[Time hh]":
return DateTime.Now.ToString("hh");
case "[Barcode]":
return session.Barcode;
case "[File format]":
return GetType(fileName);
case "[Original Filename]":
return Path.GetFileNameWithoutExtension(fileName);
case "[Camera Name]":
return property.DeviceName.Replace(":", "_").Replace("?", "_").Replace("*", "_");
case "[Selected Tag1]":
return session.SelectedTag1 != null ? session.SelectedTag1.Value.Trim() : "";
case "[Selected Tag2]":
return session.SelectedTag2 != null ? session.SelectedTag2.Value.Trim() : "";
case "[Selected Tag3]":
return session.SelectedTag3 != null ? session.SelectedTag3.Value.Trim() : "";
case "[Selected Tag4]":
return session.SelectedTag4 != null ? session.SelectedTag4.Value.Trim() : "";
case "[Unix Time]":
var date = new DateTime(1970, 1, 1, 0, 0, 0, DateTime.Now.Kind);
var unixTimestamp = System.Convert.ToInt64((DateTime.Now - date).TotalSeconds);
return unixTimestamp.ToString();
case "[DB Row 1]":
return (session.ExternalData != null && session.ExternalData.Row1 != null)
? session.ExternalData.Row1
: "";
case "[DB Row 2]":
return (session.ExternalData != null && session.ExternalData.Row2 != null)
? session.ExternalData.Row2
: "";
case "[DB Row 3]":
return (session.ExternalData != null && session.ExternalData.Row3 != null)
? session.ExternalData.Row3
: "";
case "[DB Row 4]":
return (session.ExternalData != null && session.ExternalData.Row4 != null)
? session.ExternalData.Row4
: "";
case "[DB Row 5]":
return (session.ExternalData != null && session.ExternalData.Row5 != null)
? session.ExternalData.Row5
: "";
case "[DB Row 6]":
return (session.ExternalData != null && session.ExternalData.Row6 != null)
? session.ExternalData.Row6
: "";
case "[DB Row 7]":
return (session.ExternalData != null && session.ExternalData.Row7 != null)
? session.ExternalData.Row7
: "";
case "[DB Row 8]":
//.........这里部分代码省略.........
示例6: DeviceManager_CameraDisconnected
void DeviceManager_CameraDisconnected(ICameraDevice cameraDevice)
{
Dispatcher.BeginInvoke(new Action(() =>
{
if (!ServiceProvider.Settings.HideTrayNotifications)
{
MyNotifyIcon.HideBalloonTip();
MyNotifyIcon.ShowBalloonTip("Camera disconnected", cameraDevice.LoadProperties().DeviceName,
BalloonIcon.Info);
}
}));
}
示例7: DeviceManager_CameraDisconnected
void DeviceManager_CameraDisconnected(ICameraDevice cameraDevice)
{
Dispatcher.BeginInvoke(new Action(() =>
{
MyNotifyIcon.HideBalloonTip();
MyNotifyIcon.ShowBalloonTip("Camera disconnected", cameraDevice.LoadProperties().DeviceName,
BalloonIcon.Info);
}));
}
示例8: LiveViewViewModel
public LiveViewViewModel(ICameraDevice device)
{
CameraDevice = device;
CameraProperty = device.LoadProperties();
SimpleManualFocus = CameraDevice.GetCapability(CapabilityEnum.SimpleManualFocus);
Title = TranslationStrings.LiveViewWindowTitle + " - " + CameraProperty.DeviceName;
InitOverlay();
InitCommands();
if (ServiceProvider.Settings.DetectionType == 0)
{
_detector = new MotionDetector(
new TwoFramesDifferenceDetector(true),
new BlobCountingObjectsProcessing(
ServiceProvider.Settings.MotionBlockSize,
ServiceProvider.Settings.MotionBlockSize, true));
}
else
{
_detector = new MotionDetector(
new SimpleBackgroundModelingDetector(true, true),
new BlobCountingObjectsProcessing(
ServiceProvider.Settings.MotionBlockSize,
ServiceProvider.Settings.MotionBlockSize, true));
}
TriggerOnMotion = false;
ShowHistogram = true;
Init();
ServiceProvider.WindowsManager.Event += WindowsManagerEvent;
}
示例9: LiveViewViewModel
public LiveViewViewModel(ICameraDevice device)
{
CameraDevice = device;
CameraProperty = device.LoadProperties();
SimpleManualFocus = CameraDevice.GetCapability(CapabilityEnum.SimpleManualFocus);
InitOverlay();
InitCommands();
if (ServiceProvider.Settings.DetectionType == 0)
{
_detector = new MotionDetector(
new TwoFramesDifferenceDetector(true),
new BlobCountingObjectsProcessing(
ServiceProvider.Settings.MotionBlockSize,
ServiceProvider.Settings.MotionBlockSize, true));
}
else
{
_detector = new MotionDetector(
new SimpleBackgroundModelingDetector(true, true),
new BlobCountingObjectsProcessing(
ServiceProvider.Settings.MotionBlockSize,
ServiceProvider.Settings.MotionBlockSize, true));
}
TriggerOnMotion = false;
Init();
}
示例10: DeviceManager_CameraDisconnected
void DeviceManager_CameraDisconnected(ICameraDevice cameraDevice)
{
MyNotifyIcon.HideBalloonTip();
MyNotifyIcon.ShowBalloonTip("Camera disconnected", cameraDevice.LoadProperties().DeviceName, BalloonIcon.Info);
}
示例11: Set
public void Set(ICameraDevice camera)
{
camera.IsBusy = true;
if (!string.IsNullOrEmpty(GetValue("HostMode")))
{
bool val;
if (bool.TryParse(GetValue("HostMode"), out val))
camera.HostMode = val;
}
SetTo(camera.Mode, "Mode");
SetTo(camera.CompressionSetting, "CompressionSetting");
SetTo(camera.ExposureCompensation, "ExposureCompensation");
SetTo(camera.ExposureMeteringMode, "ExposureMeteringMode");
SetTo(camera.FNumber, "FNumber");
SetTo(camera.IsoNumber, "IsoNumber");
SetTo(camera.ShutterSpeed, "ShutterSpeed");
SetTo(camera.WhiteBalance, "WhiteBalance");
SetTo(camera.FocusMode, "FocusMode");
SetTo(camera.LiveViewImageZoomRatio, "LiveViewImageZoomRatio");
var property = camera.LoadProperties();
if (!string.IsNullOrEmpty(GetValue("CaptureInSdRam")))
{
bool val;
if (bool.TryParse(GetValue("CaptureInSdRam"), out val))
{
camera.CaptureInSdRam = val;
property.CaptureInSdRam = val;
}
}
if (!string.IsNullOrEmpty(GetValue("NoDownload")))
{
bool val;
if (bool.TryParse(GetValue("NoDownload"), out val))
{
property.NoDownload = val;
}
}
if (camera.AdvancedProperties != null)
{
foreach (PropertyValue<long> propertyValue in camera.AdvancedProperties)
{
SetTo(propertyValue, propertyValue.Name);
}
}
camera.IsBusy = false;
Verify(camera);
}
示例12: cameraDevice_CameraInitDone
private void cameraDevice_CameraInitDone(ICameraDevice cameraDevice)
{
var property = cameraDevice.LoadProperties();
CameraPreset preset = ServiceProvider.Settings.GetPreset(property.DefaultPresetName);
if (preset != null)
{
var thread = new Thread(delegate()
{
try
{
Thread.Sleep(1500);
cameraDevice.WaitForCamera(5000);
preset.Set(cameraDevice);
}
catch (Exception e)
{
Log.Error("Unable to load default preset", e);
}
});
thread.Start();
}
if (ServiceProvider.Settings.SyncCameraDateTime)
{
try
{
cameraDevice.DateTime = DateTime.Now;
}
catch (Exception exception)
{
Log.Error("Unable to sysnc date time", exception);
}
}
}