本文整理汇总了C#中Selection类的典型用法代码示例。如果您正苦于以下问题:C# Selection类的具体用法?C# Selection怎么用?C# Selection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Selection类属于命名空间,在下文中一共展示了Selection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainMenu
public MainMenu(Rectangle windowSize, KeyboardState newKeyboardState, MouseState newMouseState)
{
windowWidth = windowSize.Width;
windowHeight = windowSize.Height;
keyboardState = newKeyboardState;
mousestate = newMouseState;
selection = Selection.Play;
wallpaper = new Sprite(new Rectangle(0, 0, windowWidth, windowHeight), windowSize);
wallpaperText = new Sprite(new Rectangle(0, 0, windowWidth, windowHeight), windowSize);
nuages = new Sprite(new Rectangle(0, 0, windowWidth * 3, windowHeight), windowSize);
nuages.Direction = new Vector2(-1, 0);
nuages.Vitesse = 0.1f; // 1f = 1000 px/sec
mouse = new AnimatedSprite(new Rectangle(-100, -100, 80, 100), windowSize, 8, 4, 40);
relativeAmplitudeVibrationSelection = (float)amplitudeVibrationSelection / (float)(windowHeight + windowWidth);
sprites = new List<AnimatedSprite>();
menuItems = new Dictionary<Selection, Sprite>();
menuItems.Add(Selection.Play, new Sprite(new Rectangle(112, 423, 124, 55), windowSize, "menu/textPlay"));
menuItems.Add(Selection.Extra, new Sprite(new Rectangle(191, 480, 124, 55), windowSize, "menu/textExtra"));
menuItems.Add(Selection.Options, new Sprite(new Rectangle(394, 470, 135, 55), windowSize, "menu/textOptions"));
menuItems.Add(Selection.Credit, new Sprite(new Rectangle(562, 400, 124, 55), windowSize, "menu/textCredit"));
menuItems.Add(Selection.Exit, new Sprite(new Rectangle(675, 480, 101, 55), windowSize, "menu/textExit"));
Fire = new ParticleEngine(new Rectangle(0,windowSize.Height,windowSize.Width,0));
Fire.SetSpeedRange(0.2f, 2f, 90, 40);
Fire.SetLifeTimeRange(20, 90);
Fire.SetScaleRange(0.2f, 1.4f);
Cursor = new ParticleEngine(new Rectangle());
Cursor.SetSpeedRange(0.2f, 1.6f, -45, 25);
Cursor.SetAngularSpeedRange(0, 3);
Cursor.SetLifeTimeRange(20, 50);
Cursor.SetScaleRange(0.2f, 1.4f);
Cursor.SetColorRange(0, 255, 0, 255, 0, 255, 0, 20);
}
示例2: Execute
/// <summary>
/// Replace the text of the selection with the answer to the calculation
/// </summary>
/// <param Name="selection">The current selection, used as input, and modified for the output</param>
/// <param Name="argument">Anything added after the command Name, used as input</param>
public void Execute(Selection selection, string[] arguments)
{
//Attempt to perform the calculation
try { selection.Text = PerformCalculation(selection.Text); }
//If it fails, raise an error to the user
catch { new Error(String.Format(@"Sum'{0}' is not formatted correctly", selection.Text), Camera); }
}
示例3: Calendar
public Calendar()
{
InitializeComponent();
ItemContextMenu = new ContextMenu();
MenuItem Block = new MenuItem();
Block.Header = "Block";
Block.Click += new RoutedEventHandler(MenuBlock_Click);
ItemContextMenu = new ContextMenu();
MenuItem UnBlock = new MenuItem();
UnBlock.Header = "Unblock";
UnBlock.Click += new RoutedEventHandler(MenuUnBlock_Click);
MenuItem Delete = new MenuItem();
Delete.Header = "Delete";
Delete.Click += new RoutedEventHandler(MenuDelete_Click);
ItemContextMenu.Items.Add(Block);
ItemContextMenu.Items.Add(UnBlock);
ItemContextMenu.Items.Add(Delete);
oSel = new Selection(this);
DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
dispatcherTimer.Start();
oRefresh();
}
示例4: YoutubeWidget
public YoutubeWidget(string source,
Selection selection)
: this(source)
{
this.mSelection = selection;
HttpService = new HttpService();
}
示例5: SaveLoadScreen
/// <summary>
/// Create a new Load/Save Screen.
/// </summary>
/// <param name="NextState">Depending whether the game is loading or saving.
/// If the game is loading, then the it is the state the game will go to if the operation is cancelled.
/// If the game is saving, this state will be reached regardless.</param>
/// <param name="SaveMode">True for saving, false for loading.</param>
public SaveLoadScreen(State.State NextState, bool SaveMode)
{
this.NextState = NextState;
this.SaveMode = SaveMode;
if (SaveMode)
{
LogsSelection = new Selection(50, 130, new string[] {
"1: ", "2: ", "3: ", "4: ", "5: ", "6: ", "7: ", "8: ", "Cancel"});
}
else
{
LogsSelection = new Selection(50, 130, new string[] {
"1: ", "2: ", "3: ", "4: ", "5: ", "6: ", "7: ", "8: ", "Autosave", "Cancel"});
}
for (int i = 0; i < 8; i++)
{
if (Properties.Settings.Default.Logs[i] == "0")
{
LogsSelection.Choices[i] += "-";
}
else
{
LogsSelection.Choices[i] += Properties.Settings.Default.Logs[i];
}
}
}
示例6: UseItem
public Composite UseItem(Selection<bool> reqs = null)
{
return new Decorator(ret => reqs == null || reqs(ret),
new Action(delegate
{
if (_timer.IsRunning && _timer.Elapsed.TotalSeconds < CoolDown)
return RunStatus.Failure;
if (!_timer.IsRunning)
_timer.Start();
foreach (var o in BuddyTor.Me.InventoryEquipment)
{
if (o.Name.Contains(ItemName))
{
o.Use();
o.Interact();
_timer.Stop();
_timer.Reset();
_timer.Start();
return RunStatus.Success;
}
}
return RunStatus.Failure;
}));
}
示例7: TryExtendSelectionToComments
static Selection TryExtendSelectionToComments(IDocument document, Selection selection, IList<ISpecial> commentsBlankLines)
{
var extendedToComments = ExtendSelectionToComments(document, selection, commentsBlankLines);
if (extendedToComments != null)
return extendedToComments;
return selection;
}
示例8: PreSelection
public virtual Selection PreSelection(SelectionManager sm, Selection sel)
{
if ( !sel.IsEmpty && !sel.Start.Node.Equals(node) )
return new Selection(SelectionManager.CreateSelectionPoint(node, false));
return sel;
}
示例9: ObjectsPropertiesVM
// Constructor
#region Constructor
public ObjectsPropertiesVM()
{
Selection = new Selection();
Selection.PropertyChanged += Selection_SelectionSetChanged;
//_canSelectFirstNodes = true;
}
示例10: RelateInfo
/// <summary>
/// Represents the Relationship Class information
/// </summary>
/// <param name="featureLayer"></param>
/// <param name="selection"></param>
public RelateInfo(FeatureLayer featureLayer, Selection selection)
{
_featureLayer = featureLayer;
_selection = selection;
_featureClassName = _featureLayer.GetFeatureClass().GetName();
}
示例11: ToSelection
internal Selection ToSelection()
{
Selection s = new Selection();
if (this.Pane != PaneValues.TopLeft) s.Pane = this.Pane;
if (this.ActiveCell.Length > 0 && !this.ActiveCell.Equals("A1", StringComparison.OrdinalIgnoreCase))
{
s.ActiveCell = this.ActiveCell;
}
if (this.ActiveCellId != 0) s.ActiveCellId = this.ActiveCellId;
if (this.SequenceOfReferences.Count > 0)
{
if (this.SequenceOfReferences.Count == 1)
{
// not equal to A1
if (this.SequenceOfReferences[0].StartRowIndex != 1
|| this.SequenceOfReferences[0].StartColumnIndex != 1
|| this.SequenceOfReferences[0].EndRowIndex != 1
|| this.SequenceOfReferences[0].EndColumnIndex != 1)
{
s.SequenceOfReferences = SLTool.TranslateCellPointRangeToSeqRef(this.SequenceOfReferences);
}
}
else
{
s.SequenceOfReferences = SLTool.TranslateCellPointRangeToSeqRef(this.SequenceOfReferences);
}
}
return s;
}
示例12: Buff
public static Composite Buff(string spell, Selection<bool> reqs = null)
{
return
new Decorator(
ret => (reqs == null || reqs(ret)) && !Me.HasBuff(spell),
Cast(spell, ret => Me, ret => true));
}
示例13: MainMenu
public MainMenu(Rectangle windowSize, KeyboardState newKeyboardState, MouseState newMouseState)
{
windowWidth = windowSize.Width;
windowHeight = windowSize.Height;
keyboardState = newKeyboardState;
mousestate = newMouseState;
selection = Selection.Play;
wallpaper = new Sprite(new Rectangle(0, 0, windowWidth, windowHeight), windowSize);
wallpaperText = new Sprite(new Rectangle(0, 0, windowWidth, windowHeight), windowSize);
nuages = new Sprite(new Rectangle(0, 0, windowWidth * 3, windowHeight), windowSize);
nuages.Direction = new Vector2(-1, 0);
nuages.Vitesse = 0.1f; // 1f = 1000 px/sec
mouse = new ParticleEngine(windowSize, new DecimalRectangle(-200, -200, 0, 0), new Vector3(1, 10, 10),
new List<string>() { "particle/star"}, 10, 0.1f, 2f, -45f, 15f, 0f, 180f, -1f, 1f, 10f, 150f);
mouse.SetColorRange(0, 100, 0, 30, 0, 30);
relativeAmplitudeVibrationSelection = (float)amplitudeVibrationSelection / (float)(windowHeight + windowWidth);
sprites = new List<AnimatedSprite>();
menuItems = new Dictionary<Selection, Sprite>();
menuItems.Add(Selection.Play, new Sprite(new Rectangle(112, 423, 124, 55), windowSize, "menu/textPlay"));
menuItems.Add(Selection.Extra, new Sprite(new Rectangle(191, 480, 124, 55), windowSize, "menu/textExtra"));
menuItems.Add(Selection.Options, new Sprite(new Rectangle(394, 470, 135, 55), windowSize, "menu/textOptions"));
menuItems.Add(Selection.Credit, new Sprite(new Rectangle(562, 400, 124, 55), windowSize, "menu/textCredit"));
menuItems.Add(Selection.Exit, new Sprite(new Rectangle(675, 480, 101, 55), windowSize, "menu/textExit"));
}
示例14: Init
protected override void Init ()
{
var listView = new ListView ();
var selection = new Selection ();
listView.SetBinding (ListView.ItemsSourceProperty, "Items");
listView.ItemTemplate = new DataTemplate (() => {
var cell = new SwitchCell ();
cell.SetBinding (SwitchCell.TextProperty, "Name");
cell.SetBinding (SwitchCell.OnProperty, "IsSelected", BindingMode.TwoWay);
return cell;
});
var instructions = new Label {
FontSize = 16,
Text =
"The label at the bottom should equal the number of switches which are in the 'on' position. Flip some of the switches. If the number at the bottom does not equal the number of 'on' switches, the test has failed."
};
var label = new Label { FontSize = 24 };
label.SetBinding (Label.TextProperty, "SelectedCount");
Content = new StackLayout {
VerticalOptions = LayoutOptions.Fill,
Children = {
instructions,
listView,
label
}
};
BindingContext = selection;
}
示例15: Execute
/// <summary>
/// Replace the current selection'sections text color with the color specified in the argument
/// </summary>
/// <param Name="selection">The selection to modify</param>
/// <param Name="argument">The argument provided to the command</param>
public override void Execute(Selection selection, string[] arguments)
{
//Detect which color the user wanted
Color? color = GetColor(arguments);
//If there was a valid color and a valid selection, apply the color to the selection
if (color != null && selection != null) { MergeAndApply(selection, color: color); }
}