本文整理汇总了C#中OperationMode类的典型用法代码示例。如果您正苦于以下问题:C# OperationMode类的具体用法?C# OperationMode怎么用?C# OperationMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OperationMode类属于命名空间,在下文中一共展示了OperationMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnNavigatedTo
protected override async void OnNavigatedTo( NavigationEventArgs e )
{
base.OnNavigatedTo( e );
this.operationMode = OperationMode.Preview;
this.speaker = new Speaker();
if( GpioDeviceBase.IsAvailable )
{
this.led = new Led( 6 );
this.led.TurnOn();
this.pushButton = new PushButton( 16 );
this.pushButton.Pushed += this.OnPushButtonPushed;
this.pnlButtons.Visibility = Visibility.Collapsed;
}
this.camera = new Camera();
await this.camera.InitializeAsync();
this.previewElement.Source = this.camera.CaptureManager;
await this.camera.CaptureManager.StartPreviewAsync();
}
示例2: FaceTracker
/// <summary>
/// Initializes a new instance of the FaceTracker class from a reference of the Kinect device.
/// <param name="sensor">Reference to kinect sensor instance</param>
/// </summary>
public FaceTracker(KinectSensor sensor)
{
if (sensor == null) {
throw new ArgumentNullException("sensor");
}
if (!sensor.ColorStream.IsEnabled) {
throw new InvalidOperationException("Color stream is not enabled yet.");
}
if (!sensor.DepthStream.IsEnabled) {
throw new InvalidOperationException("Depth stream is not enabled yet.");
}
this.operationMode = OperationMode.Kinect;
this.coordinateMapper = sensor.CoordinateMapper;
this.initializationColorImageFormat = sensor.ColorStream.Format;
this.initializationDepthImageFormat = sensor.DepthStream.Format;
var newColorCameraConfig = new CameraConfig(
(uint)sensor.ColorStream.FrameWidth,
(uint)sensor.ColorStream.FrameHeight,
sensor.ColorStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT8_B8G8R8X8);
var newDepthCameraConfig = new CameraConfig(
(uint)sensor.DepthStream.FrameWidth,
(uint)sensor.DepthStream.FrameHeight,
sensor.DepthStream.NominalFocalLengthInPixels,
FaceTrackingImageFormat.FTIMAGEFORMAT_UINT16_D13P3);
this.Initialize(newColorCameraConfig, newDepthCameraConfig, IntPtr.Zero, IntPtr.Zero, this.DepthToColorCallback);
}
示例3: Insert
/// <summary>
/// 插入一个节点
/// </summary>
/// <param name="locationType">这里locationType.LocationDepth表示想要插入的位置</param>
/// <param name="mode">插入的方式,有初始化、前插、后插三种</param>
/// <returns></returns>
public static bool Insert(Locationtype locationType, OperationMode mode)
{
try
{
ISQLExecutor executor = ConfigurationHelper.Instance.CreateNewSQLExecutor() as ISQLExecutor;
bool isPosExist = executor.Exist(typeof(Locationtype), "[email protected]", new List<object>() { locationType.LocationDepth });
if (executor == null)
{
return false;
}
int effectrow = 0;
switch(mode)
{
case OperationMode.Initial:
if (isPosExist)
{
return false;
}
// 初始化,深度肯定为0
locationType.LocationDepth = 0;
effectrow = executor.Insert(typeof(Locationtype), new List<object>() { locationType });
break;
case OperationMode.InsertAfter:
if (!isPosExist)
{
return false;
}
executor.ExecuteNonQuery(ConfigurationHelper.Instance.SqlDictionary["ResetAllBeforeInsert"],
new List<object>() { locationType.LocationDepth });
locationType.LocationDepth += 1;
effectrow = executor.Insert(typeof(Locationtype), new List<object>() { locationType });
break;
case OperationMode.InsertBefore:
if (!isPosExist)
{
return false;
}
executor.ExecuteNonQuery(ConfigurationHelper.Instance.SqlDictionary["ResetAllBeforeInsert"],
new List<object>() { locationType.LocationDepth - 1 });
effectrow = executor.Insert(typeof(Locationtype), new List<object>() { locationType });
break;
default:
break;
}
if (effectrow > 0)
{
return true;
}
}
catch
{
return false;
}
return false;
}
示例4: WorldSector
public WorldSector(int index_x, int index_y, int lower_boundary_x, int upper_boundary_x, int lower_boundary_y, int upper_boundary_y)
{
this.index_x = index_x;
this.index_y = index_y;
this.lower_boundary_x = lower_boundary_x;
this.upper_boundary_x = upper_boundary_x;
this.lower_boundary_y = lower_boundary_y;
this.upper_boundary_y = upper_boundary_y;
mode = OperationMode.OUT_OF_CHARACTER_RANGE;
Contained_Objects = new GObject_Sector_RefList (new Vector2(index_x, index_y));
}
示例5: VisitStringInclusionMethod
private Expression VisitStringInclusionMethod(MethodCallExpression node, OperationMode operationMode)
{
OperationMode oldState = _operationMode;
_operationMode = operationMode;
this.Visit(node.Object);
this.CurrentOperation.Append("(");
this.Visit(node.Arguments[0]);
this.CurrentOperation.Append(")");
_operationMode = oldState;
return node;
}
示例6: PerformOperationOnList
public void PerformOperationOnList(OperationMode mode)
{
int position;
bool isFound;
switch (mode)
{
case OperationMode.Input:
InputList();
break;
case OperationMode.Insert:
Insert();
break;
case OperationMode.Search:
Console.Write("Please enter an item to search: ");
int itemToSearch = int.Parse(Console.ReadLine());
isFound = Search(itemToSearch, out position);
if (isFound)
{
Console.WriteLine("Item found at {0} position", position);
}
else
{
Console.WriteLine("Item can not be found");
}
break;
case OperationMode.Delete:
Delete();
break;
case OperationMode.Display:
Display();
break;
case OperationMode.Quit:
break;
default:
Console.WriteLine("Please enter a valid option");
break;
}
}
示例7: SelectedOnGUI
public override void SelectedOnGUI() {
mode = OperationMode.Normal;
if(AllowToolUtility.ControlIsHeld) mode = OperationMode.Constrained;
if(AllowToolUtility.AltIsHeld) mode = OperationMode.AllOfDef;
addToSelection = AllowToolUtility.ShiftIsHeld;
if (mode == OperationMode.Constrained) {
if (constraintsNeedReindexing) UpdateSelectionConstraints();
var label = "MassSelect_nowSelecting".Translate(cachedConstraintReadout);
DrawMouseAttachedLabel(label);
} else if (mode == OperationMode.AllOfDef) {
if (Event.current.type == EventType.Repaint) {
var target = TryGetItemOrPawnUnderCursor();
string label = target == null ? "MassSelect_needTarget".Translate() : "MassSelect_targetHover".Translate(target.def.label.CapitalizeFirst());
DrawMouseAttachedLabel(label);
}
}
}
示例8: readXml
protected void readXml(string fileName) {
StreamReader sr = new StreamReader(fileName);
XmlDocument doc = new XmlDocument();
doc.LoadXml(sr.ReadToEnd());
sr.Close();
XmlNode node = null;
foreach (XmlNode n in doc.ChildNodes) {
if (n.Name == "instances") {
_dataSetName = n.Attributes[0].Value;
_dataSourceName = n.Attributes[1].Value;
if (n.Attributes[2].Value == "text")
_media = MediaType.Text;
else if (n.Attributes[2].Value == "image")
_media = MediaType.Image;
else if (n.Attributes[2].Value == "video")
_media = MediaType.Video;
else if (n.Attributes[2].Value == "audio")
_media = MediaType.Audio;
if (n.Attributes[3].Value == "learn")
_opMode = OperationMode.Learn;
else if (n.Attributes[3].Value == "validate")
_opMode = OperationMode.Validate;
else if (n.Attributes[3].Value == "classify")
_opMode = OperationMode.Classify;
if (n.Attributes[4].Value == "batch")
_procMode = ProcessMode.Batch;
else if (n.Attributes[4].Value == "online")
_procMode = ProcessMode.Batch;
node = n;
break;
}
}
//parse the IOs
foreach (XmlNode n in node.ChildNodes) {
if (n.Name == "input") {
_sc.InputConditioners.Add(new ScaleAndOffset(
double.Parse(n.Attributes[1].Value),
double.Parse(n.Attributes[2].Value)));
} else if (n.Name == "output") {
_sc.OutputConditioners.Add(new ScaleAndOffset(
double.Parse(n.Attributes[1].Value),
double.Parse(n.Attributes[2].Value)));
}
}
}
示例9: Encrypt
/// <summary>
/// Encrypts bytes with the specified key and IV.
/// </summary>
public static Byte[] Encrypt(Byte[] key, Byte[] bytes, OperationMode mode, Byte[] iv)
{
Check(key, bytes);
RijndaelManaged aes = new RijndaelManaged();
if (iv != null) aes.IV = iv;
aes.Mode = (CipherMode)mode;
aes.Padding = PaddingMode.None;
if (key.Length == 24) aes.KeySize = 192;
else if (key.Length == 32) aes.KeySize = 256;
else aes.KeySize = 128; // Defaults to 128
aes.BlockSize = 128; aes.Key = key;
ICryptoTransform ict = aes.CreateEncryptor();
MemoryStream mStream = new MemoryStream();
CryptoStream cStream = new CryptoStream(mStream, ict, CryptoStreamMode.Write);
cStream.Write(bytes, 0, bytes.Length);
cStream.FlushFinalBlock();
mStream.Close(); cStream.Close();
return mStream.ToArray();
}
示例10: GetLock
public static bool GetLock(Object obj, OperationMode operationMode = OperationMode.Normal)
{
bool shouldGetLock = true;
if (onHierarchyAllowGetLock != null) shouldGetLock = onHierarchyAllowGetLock(obj);
if (shouldGetLock)
{
bool success = GetLock(obj.GetAssetPath(), operationMode);
if (success && onHierarchyGetLock != null) onHierarchyGetLock(obj);
return success;
}
return false;
}
示例11: CreateMonitor
/// <summary>
/// Create new monitor for requests depending on the operation mode
/// </summary>
/// <param name="requests">
/// The requests.
/// </param>
/// <param name="operationMode">
/// The operation Mode.
/// </param>
/// <returns>
/// The <see cref="FareRequestMonitor"/>.
/// </returns>
internal FareRequestMonitor CreateMonitor(List<FareMonitorRequest> requests, OperationMode operationMode)
{
if (requests == null || requests.Count < 1)
{
return null;
}
FareRequestMonitor newMon = null;
FareMonitorEvents monitorEvents = null;
if (operationMode == OperationMode.LiveMonitor)
{
newMon = new LiveFareMonitor(this._liveFareStorage, new TaskbarFlightNotifier(), WebFareBrowserControlFactory.Instance);
monitorEvents = this.Events[OperationMode.LiveMonitor];
}
else
{
if (operationMode == OperationMode.ShowFare)
{
newMon = new FareRequestMonitor(WebFareBrowserControlFactory.Instance);
monitorEvents = this.Events[OperationMode.ShowFare];
}
else if (operationMode == OperationMode.GetFareAndSave)
{
newMon = new FareExportMonitor(
AppContext.MonitorEnvironment.ArchiveManager,
WebFareBrowserControlFactory.Instance,
this.View.AutoSync);
monitorEvents = this.Events[OperationMode.GetFareAndSave];
}
else
{
throw new ApplicationException("Unsupported opearation mode: " + operationMode);
}
}
monitorEvents.Attach(newMon);
newMon.Enqueue(requests);
return newMon;
}
示例12: Monitor
/// <summary>
/// Start new fare scan and return the monitor responsible for the new requests
/// </summary>
/// <param name="mode">
/// The mode.
/// </param>
/// <returns>
/// The <see cref="FareRequestMonitor"/>.
/// </returns>
internal FareRequestMonitor Monitor(OperationMode mode)
{
FareRequestMonitor newMon = null;
try
{
// Validate the location of the journey
if (this.View.Departure.Equals(this.View.Destination))
{
this.View.Show(
"Departure location and destination cannot be the same:" + Environment.NewLine + this.View.Departure,
"Invalid Route",
MessageBoxIcon.Exclamation);
return null;
}
// Get list of new requests for the monitor
var newRequests = this.GetRequests();
if (newRequests.Count > 0)
{
newMon = this.CreateMonitor(newRequests, mode);
if (mode != OperationMode.LiveMonitor)
{
this._monitors.Clear(newMon.GetType());
}
AppContext.Logger.InfoFormat("{0}: Starting monitor for {1} new requests", this.GetType().Name, newRequests.Count);
this._monitors.Start(newMon);
}
else
{
string period = this.View.MinDuration == this.View.MaxDuration
? this.View.MinDuration.ToString(CultureInfo.InvariantCulture)
: this.View.MinDuration.ToString(CultureInfo.InvariantCulture) + " and "
+ this.View.MaxDuration.ToString(CultureInfo.InvariantCulture);
string message =
string.Format(
@"There is no travel date which satisfies the filter condition for the stay duration between {0} days (You selected travel period {1})!
Double-check the filter conditions and make sure that not all travel dates are in the past",
period,
StringUtil.GetPeriodString(this.View.DepartureDate, this.View.ReturnDate));
AppContext.Logger.Debug(message);
AppContext.ProgressCallback.Inform(null, message, "Invalid parameters", NotificationType.Exclamation);
}
}
catch (Exception ex)
{
AppContext.ProgressCallback.Inform(this.View, "Failed to start monitors: " + ex.Message, "Check Fares", NotificationType.Error);
AppContext.Logger.Error("Failed to start monitors: " + ex);
}
finally
{
this.View.SetScanner(true);
}
return newMon;
}
示例13: GetLock
public bool GetLock(IEnumerable<string> assets, OperationMode mode)
{
dataCarrier.assets = assets.ToList();
return true;
}
示例14: LoadFrom
//.........这里部分代码省略.........
DeadMessageDuration = (long)long.Parse(config.appSettings[DeadMsgkey]);
}
catch { }
try
{
DependencyInjectionEnabled = (bool)bool.Parse(config.appSettings[DepInjkey]);
}
catch { }
try
{
UddiEnabled = (bool)bool.Parse(config.appSettings[UddiEnabledKey]);
}
catch { }
try
{
DNSEnabled = (bool)bool.Parse(config.appSettings[DNSEnabledKey]);
}
catch { }
try
{
ServiceUnavailableBehavior = (UnavailableBehavior)Enum.Parse(typeof(UnavailableBehavior), config.appSettings[AgentBevKey]);
}
catch { }
try
{
DCSretrycount = Int32.Parse(config.appSettings[DCSlretrykey]);
}
catch { }
try
{
PCSretrycount = Int32.Parse(config.appSettings[PCSlretrykey]);
}
catch { }
try
{
DiscoveryInterval = Int32.Parse(config.appSettings[discoveryInterval]);
}
catch { }
try
{
UddiInquiryUrl = (config.appSettings[UddiURLKey]);
}
catch { }
try
{
UddiSecurityUrl = (config.appSettings[UddiSecUrlKey]);
}
catch { }
try
{
UddiAuthRequired = bool.Parse(config.appSettings[UddiAuthKey]);
}
catch { }
try
{
UddiUsername = (config.appSettings[UddiUsernameKey]);
}
catch { }
try
{
UddiEncryptedPassword = (config.appSettings[UddipwdKey]);
}
catch { }
try
{
UddiDCSLookup = (config.appSettings[UddiDCSkey]);
}
catch { }
try
{
UddiPCSLookup = (config.appSettings[UddiPCSkey]);
}
catch { }
try
{
_uddifindType = (UddiFindType)Enum.Parse(typeof(UddiFindType), (config.appSettings[UddiFindTypekey]));
}
catch { }
try
{
operatingmode = (OperationMode)Enum.Parse(typeof(OperationMode), (config.appSettings[operatingModeKey]));
}
catch { }
try
{
PersistLocation = (config.appSettings[PersistKey]);
}
catch { }
}
catch (Exception)
{
}
}
示例15: operationModeToString
private static string operationModeToString(OperationMode mode)
{
if(mode == Ice.OperationMode.Normal)
{
return "::Ice::Normal";
}
if(mode == Ice.OperationMode.Nonmutating)
{
return "::Ice::Nonmutating";
}
if(mode == Ice.OperationMode.Idempotent)
{
return "::Ice::Idempotent";
}
return "???";
}