本文整理汇总了C#中Mode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Mode.ToString方法的具体用法?C# Mode.ToString怎么用?C# Mode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mode
的用法示例。
在下文中一共展示了Mode.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SymDiffExtractVerb
public SymDiffExtractVerb(BoogieAsmVerifyVerb basmVerb, Mode mode)
{
this.basmVerb = basmVerb;
this.basmIn = basmVerb.outputFile();
this.mode = mode;
this.abstractId = new AbstractId(this.GetType().Name, version, this.basmIn.ToString(), concrete: mode.ToString());
}
示例2: ExtractAddress
public static IEnumerable<string> ExtractAddress(string s, Mode mode)
{
switch (mode)
{
case Mode.Classic: return classicAddressReg.GetMatches(s);
case Mode.WithIn: return inAddressReg.GetMatches(s);
default: throw new ArgumentException(mode.ToString());
}
}
示例3: Add
public void Add(Mode mode)
{
if (_modes.Contains(mode))
throw new Exception("Attempted to add mode " + mode.ToString() + ", already in mode queue.");
lock (_mode_lock_obj)
{
_modes.Add(mode);
}
//self.modes.sort(lambda x, y: y.priority - x.priority)
mode.mode_started();
if (mode == _modes[0])
mode.mode_topmost();
}
示例4: GetCharCountIndicatorSet
/// <summary>
/// Gets the char count indicator set.
/// </summary>
/// <param name="mode">The mode.</param>
/// <returns></returns>
/// <remarks>ISO/IEC 18004:2000 Table 3 Page 18</remarks>
public static int[] GetCharCountIndicatorSet(Mode mode)
{
switch (mode)
{
case Mode.Numeric:
return new[] {10, 12, 14};
case Mode.Alphanumeric:
return new[] {9, 11, 13};
case Mode.EightBitByte:
return new[] {8, 16, 16};
case Mode.Kanji:
return new[] {8, 10, 12};
default:
throw new InvalidOperationException(string.Format("Unexpected Mode: {0}", mode.ToString()));
}
}
示例5: isModeEncodeValid
public static bool isModeEncodeValid(Mode mode, string encoding, string content)
{
switch(mode)
{
case Mode.Numeric:
return NumericCheck(content);
case Mode.Alphanumeric:
return AlphaNumCheck(content);
case Mode.EightBitByte:
return EightBitByteCheck(encoding, content);
case Mode.Kanji:
return KanjiCheck(content);
default:
throw new InvalidOperationException(string.Format("System does not contain mode: {0}", mode.ToString()));
}
}
示例6: TerrainDisplay
public TerrainDisplay(TerrainTile[,] tiles)
{
mode = Mode.Erase;
this.tilesBak = (TerrainTile[,])tiles.Clone();
this.tiles = tiles;
ClientSize = new Size(800, 800);
BackColor = Color.Blue;
WindowState = FormWindowState.Maximized;
panel = new Panel()
{
Dock = DockStyle.Fill,
AutoScroll = true,
Controls =
{
(pic = new PictureBox()
{
Image = bmp = RenderColorBmp(tiles),
SizeMode = PictureBoxSizeMode.AutoSize,
})
}
};
panel.HorizontalScroll.Enabled = true;
panel.VerticalScroll.Enabled = true;
panel.HorizontalScroll.Visible = true;
panel.VerticalScroll.Visible = true;
Controls.Add(panel);
pic2 = new PictureBox()
{
Image = bmp,
Width = 250,
Height = 250,
SizeMode = PictureBoxSizeMode.Zoom
};
Controls.Add(pic2);
pic2.BringToFront();
Text = mode.ToString();
pic.MouseMove += new MouseEventHandler(pic_MouseMove);
pic.MouseDoubleClick += new MouseEventHandler(pic_MouseDoubleClick);
}
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
_actionMode = WebUtil.GetActionMode(this);
if (!IsPostBack)
{
//Init Data
//Init Controls Data before do query
if (_actionMode == Mode.New)
{
EnumUtil.BindEnumData2ListControl<DictionaryItemType>(rdlItemType, false, DictionaryItemType.Group);
this.rdlItemType.SelectedValue = DictionaryItemType.Group.ToString();
}
if (_actionMode == Mode.AddChild || _actionMode == Mode.New)
{
EnumUtil.BindEnumData2ListControl<DictionaryItemType>(rdlItemType, false, DictionaryItemType.Boolean, DictionaryItemType.Numric, DictionaryItemType.String);
this.rdlItemType.SelectedValue = DictionaryItemType.String.ToString();
}
using (_session = new Session())
{
this.trGroupCode.Visible = false;
if (_actionMode == Mode.Edit)
{
LoadData();
}
else if(_actionMode == Mode.AddChild)
{
AddChild();
}
logger.Info("操作类型" + _actionMode.ToString());
}
}
if (Request["return"] != null)
{
this.toolbarup["Return"].NavigateUrl = Request["return"];
this.toolbarbottom["Return"].NavigateUrl = Request["return"];
}
}
示例8: WriteRead
/// <summary>
/// Sends control signal to the specific Arduino and retrieves response bytes.
/// </summary>
/// <param name="_Room">Room to which data to be send</param>
/// <param name="ControlMode">Select specific control mode. Refer control mode at: https:\//www.hackster.io/AnuragVasanwala/home-automation</param>
/// <param name="Pin">Pin to be set. ONLY VALID FOR MODE-2</param>
/// <param name="PinValue">Value to be set. ONLY VALID FOR MODE-2</param>
/// <returns>Returns fourteen response byte. Refer response byte scheme at: https:\//www.hackster.io/AnuragVasanwala/home-automation</returns>
public static async System.Threading.Tasks.Task<byte[]> WriteRead(Room _Room, Mode ControlMode, byte Pin = 0, byte PinValue = 0)
{
while (Lock!=false)
{
}
Lock = true;
// Create response byte array of fourteen
byte[] Response = new byte[14];
try
{
// Initialize I2C
var Settings = new I2cConnectionSettings(_Room.I2C_Slave_Address);
Settings.BusSpeed = I2cBusSpeed.StandardMode;
if (AQS == null || DIS == null)
{
AQS = I2cDevice.GetDeviceSelector("I2C1");
DIS = await DeviceInformation.FindAllAsync(AQS);
}
using (I2cDevice Device = await I2cDevice.FromIdAsync(DIS[0].Id, Settings))
{
Device.Write(new byte[] { byte.Parse(ControlMode.ToString().Replace("Mode", "")), Pin, PinValue });
Device.Read(Response);
}
}
catch (Exception)
{
// SUPPRESS ERROR AND RETURN EMPTY RESPONSE ARRAY
}
Lock = false;
return Response;
}
示例9: MakeCodeFile
public static void MakeCodeFile(int id, string code, int language_id, Mode mode)
{
if (!File.Exists(Program.TempPath + @"\" + id + @"\" + FileNames[language_id].Replace("{Name}", mode.ToString())))
File.WriteAllText(Program.TempPath + @"\" + id + @"\" + FileNames[language_id].Replace("{Name}", mode.ToString()), code);
}
示例10: CatchAxes
/// <summary>
/// The Axe Catching Logic
/// </summary>
/// <param name="mode">
/// The Mode
/// </param>
private void CatchAxes(Mode mode)
{
var modeName = mode.ToString().ToLowerInvariant();
if (this.axesList.Any())
{
if (!this.Menu.Item("com.iseries.draven." + modeName + ".catch" + modeName).GetValue<bool>())
{
return;
}
// Starting Axe Catching Logic
var closestAxe =
this.axesList.FindAll(
axe =>
axe.IsValid && this.IsSafe(axe.Position)
&& (axe.CanBeReachedNormal || (this.CanCastW() && axe.CanBeReachedWithW && mode == Mode.Combo))
&& (axe.Position.Distance(Game.CursorPos)
<= this.Menu.Item("com.iseries.draven.misc.catchrange").GetValue<Slider>().Value))
.OrderBy(axe => axe.Position.Distance(Game.CursorPos))
.ThenBy(axe => axe.Position.Distance(ObjectManager.Player.ServerPosition))
.FirstOrDefault();
if (closestAxe != null && !closestAxe.IsBeingCaught)
{
if (
closestAxe.Position.CountAlliesInRange(
this.Menu.Item("com.iseries.draven.misc.safedistance").GetValue<Slider>().Value) + 1
>= closestAxe.Position.CountEnemiesInRange(
this.Menu.Item("com.iseries.draven.misc.safedistance").GetValue<Slider>().Value))
{
if (!closestAxe.CanBeReachedNormal && closestAxe.CanBeReachedWithW)
{
if (this.CanCastW() && !this.HasWBuff())
{
this.spells[SpellSlot.W].Cast();
}
}
// Allies >= Enemies. Catching axe.
if (Variables.Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.None)
{
ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, closestAxe.Position);
}
else
{
if (closestAxe.Position.Distance(Game.CursorPos) > 15f)
{
Variables.Orbwalker.SetOrbwalkingPoint(
mode != Mode.Farm
? closestAxe.Position.Extend(Game.CursorPos, 15f)
: closestAxe.Position);
}
else
{
Variables.Orbwalker.SetOrbwalkingPoint(closestAxe.Position);
}
}
}
}
else
{
Variables.Orbwalker.SetOrbwalkingPoint(Game.CursorPos);
}
}
}
示例11: Display
private void Display(Mode m, Color c, State s, Types t) {
string mstr = m.ToString();
string cstr = c.ToString();
string sstr = s.ToString();
string tstr = t.ToString();
}
示例12: SwitchModeInEmail
public void SwitchModeInEmail(Mode mode)
{
switch (mode)
{
case Mode.Edit:
UIUtil.DefaultProvider.WaitForDisplayAndClick("ctl00_cphDialog_ucEmail_ucContent_radEdit", LocateBy.Id);
UIUtil.DefaultProvider.WaitForAJAXRequest();
break;
case Mode.Html:
UIUtil.DefaultProvider.WaitForDisplayAndClick("ctl00_cphDialog_ucEmail_ucContent_radHtml", LocateBy.Id);
UIUtil.DefaultProvider.WaitForAJAXRequest();
break;
case Mode.Preview:
UIUtil.DefaultProvider.WaitForDisplayAndClick("ctl00_cphDialog_ucEmail_ucContent_radPreview", LocateBy.Id);
UIUtil.DefaultProvider.WaitForAJAXRequest();
break;
default:
throw new ArgumentException(string.Format("No such mode: {0}", mode.ToString()));
}
}
示例13: receiver_DataReceived
static void receiver_DataReceived(object sender, Comms.DataArgs e)
{
try
{
Dictionary<Comms.CommandEncoding.CommandFields, short> state = Comms.CommandEncoding.Encoder.Decode(e.Data);
if (useAutonomy)
{
// Read mode
if (state.ContainsKey(CommandFields.Mode))
if ((Mode)state[CommandFields.Mode] != Mode.Null)
{
// Reset timer
stopwatch.Restart();
// Switch mode
mode = (Mode)state[CommandFields.Mode];
Console.WriteLine("Switched to: " + mode.ToString());
}
// Enqueue state if not autonomous
switch (mode)
{
case Mode.Manual:
// Stop autonomy if active
if (autonomy.Started)
autonomy.Stop();
// Enqueue current state from controller
stateQueue.Enqueue(state);
break;
case Mode.Autonomous:
// Do nothing
break;
case Mode.BinLowerMacro:
if (!feedback.BinLowerSwitchDepressed)
{
// Check limit switch
state[CommandFields.LeftBucketActuator] = -1000;
state[CommandFields.RightBucketActuator] = -1000;
}
else
{
mode = Mode.Manual;
}
// Enqueue current state from controller
stateQueue.Enqueue(state);
break;
case Mode.BinRaiseMacro:
if (!feedback.BinUpperSwitchDepressed)
{
// Check limit switch
state[CommandFields.LeftBucketActuator] = 1000;
state[CommandFields.RightBucketActuator] = 1000;
}
else
{
mode = Mode.Manual;
}
// Enqueue current state from controller
stateQueue.Enqueue(state);
break;
case Mode.CollectScoopMacro:
if (!feedback.BinUpperSwitchDepressed)
{
// Move actuators in and raise scoop
state[CommandFields.BucketPitch] = -1000;
state[CommandFields.BucketPivot] = 1000;
stopwatch.Restart();
}
else if (stopwatch.ElapsedMilliseconds < 700)
{
state[CommandFields.TranslationalVelocity] = 1000;
}
else
{
mode = Mode.Manual;
}
// Enqueue current state from controller
stateQueue.Enqueue(state);
break;
case Mode.DockRobotMacro:
// Calcuate orientation error
double orientationError = feedback.RearProximityLeft - feedback.RearProximityRight;
// Check orientation, TODO: un-hard-code
if (orientationError > 30)
{
double gain = 1.0; // TODO: tune this
state[CommandFields.RotationalVelocity] = (short)(orientationError * gain);
state[CommandFields.TranslationalVelocity] = 0;
}
else
{
// Calculate average distance
double distanceError = (feedback.RearProximityLeft + feedback.RearProximityRight) / 2.0d;
// Check distance error, TODO
//.........这里部分代码省略.........
示例14: GetHitChance
public static HitChance GetHitChance(this Spell spell, Mode mode)
{
try
{
return
(HitChance)
(Config.Talon.Item(
"apollo.talon." + mode.ToString().ToLower() + "." + SpellName(spell) + ".pre")
.GetValue<StringList>()
.SelectedIndex + 3);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
return HitChance.High;
}
示例15: toggleMode
/**
* Toggles the current mode from Active to Passive and vice versa
*/
public void toggleMode()
{
// Toggles the current mode from active to passive or vice versa
currMode = currMode.Equals(Mode.Passive) ? Mode.Active : Mode.Passive;
Console.WriteLine("Connection mode set to " + currMode.ToString());
}