本文整理汇总了C#中Key类的典型用法代码示例。如果您正苦于以下问题:C# Key类的具体用法?C# Key怎么用?C# Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Key类属于命名空间,在下文中一共展示了Key类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ControlHandle
public override void ControlHandle(Key k)
{
switch (k)
{
case Key.Up:
if (option > 0) option--;
if (topRow > option) topRow--;
break;
case Key.Down:
if (option < Materiatory.MATERIATORY_SIZE - 1) option++;
if (topRow < option - rows + 1) topRow++;
break;
case Key.X:
if (trashing)
{
MenuState.MateriaScreen.ChangeControl(MenuState.MateriaArrange);
}
else
{
MenuState.MateriaScreen.ChangeToDefaultControl();
}
trashing = false;
break;
case Key.Circle:
if (Trashing)
{
MenuState.MateriaScreen.ChangeControl(MenuState.MateriaPrompt);
break;
}
MateriaOrb neworb = MenuState.Party.Materiatory.Get(option);
MateriaOrb oldorb;
switch (MenuState.MateriaTop.OptionY)
{
case 0:
oldorb = MenuState.Party.Selected.Weapon.Slots[MenuState.MateriaTop.OptionX];
if (oldorb != null)
oldorb.Detach(MenuState.Party.Selected);
MenuState.Party.Materiatory.Put(oldorb, option);
if (neworb != null)
neworb.Attach(MenuState.Party.Selected);
MenuState.Party.Selected.Weapon.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
MenuState.MateriaScreen.ChangeToDefaultControl();
break;
case 1:
oldorb = MenuState.Party.Selected.Armor.Slots[MenuState.MateriaTop.OptionX];
if (oldorb != null)
oldorb.Detach(MenuState.Party.Selected);
MenuState.Party.Materiatory.Put(oldorb, option);
if (neworb != null)
neworb.Attach(MenuState.Party.Selected);
MenuState.Party.Selected.Armor.AttachMateria(neworb, MenuState.MateriaTop.OptionX);
MenuState.MateriaScreen.ChangeToDefaultControl();
break;
default: break;
}
break;
default:
break;
}
}
示例2: WasKeyReleased
public bool WasKeyReleased(Key key)
{
var previouseMouseButtonState = _previousKeyboardState[key];
var currentMouseButtonState = _currentKeyboardState[key];
return previouseMouseButtonState && !currentMouseButtonState;
}
示例3: RefreshData
void RefreshData()
{
_Key = null;
_Group = null;
groupKey.Visible = false;
}
示例4: CreateKeyEventArgs
protected static KeyEventArgs CreateKeyEventArgs(
Key key,
ModifierKeys modKeys = ModifierKeys.None)
{
var device = new MockKeyboardDevice(InputManager.Current) { ModifierKeysImpl = modKeys };
return device.CreateKeyEventArgs(key, modKeys);
}
示例5: ColumnName
public void ColumnName()
{
var x = new Key();
Assert.IsNull(x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.IsNull(x.Column);
x = new Key { ColumnFamily = "CF" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.AreEqual("CF", x.Column);
x = new Key { ColumnFamily = "CF", ColumnQualifier = "CQ" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.AreEqual("CQ", x.ColumnQualifier);
Assert.AreEqual("CF:CQ", x.Column);
x = new Key { Column = "CF" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.IsNull(x.ColumnQualifier);
Assert.AreEqual("CF", x.Column);
x = new Key { Column = "CF:CQ" };
Assert.AreEqual("CF", x.ColumnFamily);
Assert.AreEqual("CQ", x.ColumnQualifier);
Assert.AreEqual("CF:CQ", x.Column);
}
示例6: KeyUp
public void KeyUp(Key key)
{
if (key == Key.Space)
{
SpaceCraft.SetThrottle(0);
SpaceCraft.Stage();
}
if (key == Key.X)
{
SpaceCraft.SetThrottle(0);
}
if (key == Key.Z)
{
SpaceCraft.SetThrottle(100);
}
if (key == Key.Q && !IsRetrograde)
{
IsPrograde = !IsPrograde;
}
if (key == Key.W && !IsPrograde)
{
IsRetrograde = !IsRetrograde;
}
}
示例7: KeyboardState
public KeyboardState( params Key [] keys )
: this()
{
PressedKeys = new Key [ keys.Length ];
for ( int i = 0; i < keys.Length; i++ )
PressedKeys [ i ] = keys [ i ];
}
示例8: TryGetToken
public override bool TryGetToken(EndpointAddress target, EndpointAddress issuer, out GenericXmlSecurityToken cachedToken)
{
if (target == null)
{
throw new ArgumentNullException("target");
}
cachedToken = null;
lock (thisLock)
{
GenericXmlSecurityToken tmp;
Key key = new Key(target.Uri, issuer == null ? null : issuer.Uri);
if (this.cache.TryGetValue(key, out tmp))
{
// if the cached token is going to expire soon, remove it from the cache and return a cache miss
if (tmp.ValidTo < DateTime.UtcNow + TimeSpan.FromMinutes(1))
{
this.cache.Remove(key);
OnTokenRemoved(key);
}
else
{
cachedToken = tmp;
}
}
}
return (cachedToken != null);
}
示例9: IconButton
public IconButton(IGameWindow window, Camera<OrthographicProjection> camera, Vector2 position, IRenderable renderable, Key? hotkey = null)
: base(window, camera, position)
{
Renderable = renderable;
IsSelected = false;
Hotkey = hotkey;
}
示例10: DomainEvent
public DomainEvent()
{
//AggregateRootId = aggregateRootId;
//EventVersion = version;
EventState = EventState.Sequence;
Key = new Key { KeyName = this.GetType().Name };
}
示例11: NesVSUnisystemDIPKeyboardConnection
public NesVSUnisystemDIPKeyboardConnection(IntPtr handle, IInputSettingsVSUnisystemDIP settings)
{
DirectInput di = new DirectInput();
keyboard = new Keyboard(di);
keyboard.SetCooperativeLevel(handle, CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);
if (settings.CreditServiceButton != "")
CreditServiceButton = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditServiceButton);
if (settings.DIPSwitch1 != "")
DIPSwitch1 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch1);
if (settings.DIPSwitch2 != "")
DIPSwitch2 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch2);
if (settings.DIPSwitch3 != "")
DIPSwitch3 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch3);
if (settings.DIPSwitch4 != "")
DIPSwitch4 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch4);
if (settings.DIPSwitch5 != "")
DIPSwitch5 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch5);
if (settings.DIPSwitch6 != "")
DIPSwitch6 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch6);
if (settings.DIPSwitch7 != "")
DIPSwitch7 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch7);
if (settings.DIPSwitch8 != "")
DIPSwitch8 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch8);
if (settings.CreditLeftCoinSlot != "")
CreditLeftCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditLeftCoinSlot);
if (settings.CreditRightCoinSlot != "")
CreditRightCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditRightCoinSlot);
NesEmu.EMUShutdown += NesEmu_EMUShutdown;
}
示例12: KeyEventArgs
public KeyEventArgs (KeyboardDevice keyboard, PresentationSource inputSource,
int timestamp, Key key)
: base (keyboard, timestamp)
{
this.inputSource = inputSource;
this.key = key;
}
示例13: The_Corresponding_Relationship_Should_Also_Have_The_Column_Removed
public void The_Corresponding_Relationship_Should_Also_Have_The_Column_Removed()
{
// Create database and relationships
Database db = RelationshipDatabaseLoader.GetDb();
Relationship relationship = db.Tables[1].Relationships[0];
Assert.That(relationship.PrimaryKey, Is.SameAs(db.Tables[0].Keys[0]));
Assert.That(relationship.ForeignKey, Is.SameAs(db.Tables[1].Keys[0]));
Assert.That(relationship.PrimaryKey.Columns[0].Name, Is.EqualTo("Column1"));
Assert.That(relationship.PrimaryKey.Columns[1].Name, Is.EqualTo("Column2"));
IKey originalKey = db.Tables[1].Keys[0];
IKey newKey = new Key(originalKey.Name, originalKey.Keytype);
newKey.Parent = new Table("Table2");
newKey.Parent.AddColumn(new Column("Column2"));
newKey.Description = "new description";
newKey.AddColumn("Column2");
KeyChangeOperation op = new KeyChangeOperation(db.Tables[1].Keys[0], newKey);
op.RunOperation();
op.RunSecondStep();
// Make sure the relationship is still the same, and has the same references.
Relationship relationship2 = db.Tables[1].Relationships[0];
Assert.That(relationship2, Is.SameAs(relationship));
Assert.That(relationship2.PrimaryKey, Is.SameAs(db.Tables[0].Keys[0]));
Assert.That(relationship2.ForeignKey, Is.SameAs(db.Tables[1].Keys[0]));
Assert.That(relationship2.PrimaryKey.Columns, Has.Count(2));
Assert.That(relationship2.ForeignKey.Columns, Has.Count(1));
Assert.That(relationship2.ForeignKey.Columns[0].Name, Is.EqualTo("Column2"));
}
示例14: PlayerViewModel
public PlayerViewModel(string name, Key key, int allowedShots)
{
Name = name;
Key = key;
AllowedShots = allowedShots;
scores = new Dictionary<string, int>();
}
示例15: AThresholdGesture
/// <summary>
///
/// </summary>
/// <param name="jointType"></param>
/// <param name="threshold"></param>
/// <param name="comparator"></param>
/// <param name="name"></param>
/// <param name="key"></param>
protected AThresholdGesture(JointType jointType, double threshold, ThresholdComparator comparator, string name, Key key)
: base(name, key)
{
this.jointType = jointType;
this.threshold = threshold;
this.comparator = comparator;
}