本文整理汇总了C#中Frame类的典型用法代码示例。如果您正苦于以下问题:C# Frame类的具体用法?C# Frame怎么用?C# Frame使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Frame类属于命名空间,在下文中一共展示了Frame类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: spare_should_close_frame
public void spare_should_close_frame()
{
var frame = new Frame();
frame.Roll('1');
frame.Roll('/');
Assert.AreEqual(false, frame.IsOpen);
}
示例2: Init
public void Init(Frame frame)
{
mFrame = frame;
mFrame.Changed += new Action<Frame, EventArgs>(mWindow_Changed);
foreach (var screen in Screen.AllScreens) {
monitorPulldown.Items.Add(screen);
if (screen.DeviceName.Equals(frame.Monitor.DeviceName))
monitorPulldown.SelectedItem = screen;
}
if (frame.Output != null) {
Control panel = frame.Output.ControlPanel;
panel.Dock = DockStyle.Fill;
TabPage tab = new TabPage();
tab.Name = "outputTab";
tab.Text = "Output";
tab.Controls.Add(panel);
mainTab.Controls.Add(tab);
}
mWindow_Changed(frame, null);
}
示例3: AddPage
public static void AddPage(TabControl tabControl, string tapName, Page page, bool maxSize = true)
{
if (maxSize)
{
page.Width = double.NaN;
page.Height = double.NaN;
page.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
page.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
}
Frame frame = new Frame();
if (maxSize)
{
frame.Width = double.NaN;
frame.Height = double.NaN;
frame.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
frame.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;
}
frame.Content = page;
TabItem tabItem = new TabItem();
tabItem.Header = tapName;
tabItem.Content = frame;
tabControl.Items.Add(tabItem);
}
示例4: OnViewChanged
protected override void OnViewChanged(Frame sourceFrame) {
base.OnViewChanged(sourceFrame);
var xafApplication = Application as IAfterViewShown;
if ((xafApplication != null) && (View != null)) {
xafApplication.OnAfterViewShown(this, sourceFrame);
}
}
示例5: OnFrame
public override void OnFrame(Controller controller)
{
// Get the most recent frame and report some basic information
Frame frame = controller.Frame();
if (!frame.Hands.IsEmpty)
{
if ((DateTime.Now - checkedTime) > new TimeSpan(0, 0, 0, 0, 500))
{
// 500ミリ秒ごとに前回位置との差分を求める
// 移動量がしきい値を超えていたらイベントとして認識するする
if (this.checkedFrame != null)
{
Vector diff = frame.Hands[0].Translation(this.checkedFrame);
//SafeWriteLine("X移動量: " + diff.x);
if (diff.x > 150)
{
SafeWriteLine("右フリックしました! :" + diff.x);
}
if (diff.x < -150)
{
SafeWriteLine("左フリックしました! :" + diff.x);
}
}
this.checkedTime = DateTime.Now;
this.checkedFrame = frame;
}
}
}
示例6: CheckSingleHandGestures
private static void CheckSingleHandGestures(Frame frame, Action<IEnumerable<Result>> fireNewMotions)
{
var grabbedHands = frame.Hands.Where(hand => hand.GrabStrength > 0.7);
var pinchedHands = frame.Hands.Where(hand => hand.PinchStrength > 0.7);
var results = grabbedHands.Select(FromHand);
fireNewMotions(results.Concat(pinchedHands.Select(FromHand)));
}
示例7: UpdateGrabStatus
void UpdateGrabStatus(Frame frame)
{
ExtendedHand collidingHand = null;
if (latestCollision != null)
{
if (leftHand.BelongsToCollision(latestCollision))
{
collidingHand = leftHand;
}
else if (rightHand.BelongsToCollision(latestCollision))
{
collidingHand = rightHand;
}
if (collidingHand != null &&
collidingHand.tracking &&
collidingHand.grabbedObject == null &&
collidingHand.GetLeapHand(frame).GrabStrength >= 0.6)
{
GetGrabbed(collidingHand, latestCollision.gameObject);
}
latestCollision = null;
}
}
示例8: Main
static void Main(string[] args)
{
float[] frame1origin = new float[] { 0, 0, 0 };
float[] frame1XDirection = new float[] { 1, 0, 0 };
float[] frame1YDirection = new float[] { 0, 1, 0 };
Console.WriteLine(frame1YDirection[0] + " " + frame1YDirection[1] + " " + frame1YDirection[2]);
float[] frame1ZDirection = new float[] { 0, 0, 1 };
Frame frame1 = new Frame(frame1origin, frame1XDirection, frame1YDirection, frame1ZDirection);
Console.WriteLine("\nWriting frame1.vtp...");
// adjust path
frame1.Write(@"c:\vtk\vtkdata-5.8.0\Data\frame1.vtp");
float[] frame2origin = new float[] { 0, 0, 0 };
float[] frame2XDirection = new float[] { .707f, .707f, 0 };
float[] frame2YDirection = new float[] { -.707f, .707f, 0 };
float[] frame2ZDirection = new float[] { 0, 0, 1 };
Frame frame2 = new Frame(frame2origin, frame2XDirection, frame2YDirection, frame2ZDirection);
Console.WriteLine("\nWriting frame2.vtp...");
// adjust path
frame2.Write(@"c:\vtk\vtkdata-5.8.0\Data\frame2.vtp");
vtkTransform transform = vtkTransform.New();
AlignFrames(frame2, frame1, ref transform); // Brings frame2 to frame1
Console.WriteLine("\nWriting transformed.vtp...");
// adjust path
frame2.ApplyTransform(ref transform, @"c:\vtk\vtkdata-5.8.0\Data\transformed.vtp");
Console.WriteLine("\nPress any key to continue...");
Console.ReadKey();
}
示例9: AddFrame
/// <summary>
/// 添加一帧
/// </summary>
public void AddFrame(Frame Frame)
{
lock(_locker)
{
_frames.Enqueue(Frame);
}
}
示例10: OnButtonClicked
protected void OnButtonClicked(object sender, EventArgs e)
{
if (sender == button1)
{
Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel", ResponseType.Cancel, "Insert Spacer", ResponseType.None, "Add", ResponseType.Accept);
Gtk.Alignment align = new Alignment (1, 0, 0, 1);
Gtk.Frame frame = new Frame ("Position");
Gtk.HBox hbox = new HBox (false, 4);
RadioButton rbRight;
rbRight = new RadioButton ("Right");
hbox.PackEnd(rbRight, false, false, 1);
hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);
frame.Add (hbox);
align.Add (frame);
align.ShowAll ();
dialog.ExtraWidget = align;
ResponseType response = (ResponseType)dialog.Run ();
if (response == ResponseType.Accept) {
RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
} else if (response == ResponseType.None) {
RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
}
dialog.Destroy ();
}
}
示例11: Draw
public override void Draw(GameTime gameTime, Frame frame)
{
var ir = new ImperativeRenderer(frame, Materials);
ir.AutoIncrementLayer = true;
ir.Clear(color: ClearColor);
var rect1 = new Rectangle(0, 0, 32, 32);
var rect2 = new Rectangle(1, 1, 30, 30);
var drawSet = (Action<Rectangle, float>)((r, y) => {
DrawRow(ref ir, 0f, y + 0f, SamplerState.PointClamp, r);
DrawRow(ref ir, 0.5f, y + 1 + 64f, SamplerState.PointClamp, r);
DrawRow(ref ir, 0f, (y + 3 + 128) + 0.5f, SamplerState.PointClamp, r);
DrawRow(ref ir, 0f, y + 5 + 192f, SamplerState.LinearClamp, r);
DrawRow(ref ir, 0.5f, y + 7 + 256f, SamplerState.LinearClamp, r);
DrawRow(ref ir, 0f, (y + 9 + 320) + 0.5f, SamplerState.LinearClamp, r);
});
drawSet(rect1, 0f);
drawSet(rect2, (70f*6));
var cornerSamplers = SamplerState.LinearClamp;
ir.Draw(TestTexture, new Vector2(Graphics.PreferredBackBufferWidth - 1, Graphics.PreferredBackBufferHeight - 1), origin: new Vector2(1, 1), samplerState: cornerSamplers);
ir.Draw(TestTexture, new Vector2(0, Graphics.PreferredBackBufferHeight - 1), origin: new Vector2(0, 1), samplerState: cornerSamplers);
ir.Draw(TestTexture, new Vector2(Graphics.PreferredBackBufferWidth - 1, 0), origin: new Vector2(1, 0), samplerState: cornerSamplers);
}
示例12: Evaluate
public object Evaluate(Frame environment, Expression expression)
{
List<Expression> operands = expression.GetRest();
if (operands.Count < 1)
{
throw new Exception("Invalid number of cond arguments");
}
Frame evalFrame = new Frame(new Dictionary<string, Procedure>(0), environment,environment, null, true, null);
foreach (Expression expr in operands)
{
if (expr.GetFirst().ToString() == "else")
{
return evalFrame.Evaluate(expr.GetRest()[0], true);
}
object result = evalFrame.Evaluate(expr.GetFirst());
bool resultValue = false;
if (!bool.TryParse(result.ToString(), out resultValue))
{
throw new Exception("Cond clause not a predicate.");
}
if (resultValue)
{
object exprResult = string.Empty;
for (int i = 0; i < expr.GetRest().Count;i++ )
{
exprResult = evalFrame.Evaluate(expr.GetRest()[i]);
}
return exprResult;
}
}
return string.Empty;
}
示例13: Update
public bool Update(Frame frame)
{
// List of Ids for current Leap Gestures
var currentIds = _CurrentGestures.Where(g => g is VyroLeapGesture).Select(g => ((VyroLeapGesture)g).LeapGestureId).ToList();
// Find any new Leap Gestures
var newLeapGestures = frame.Gestures().Where(ge => !currentIds.Contains(ge.Id));
// Update current gestures dispatching activated ones and removing the invalid/complete ones
var item = _CurrentGestures.First;
while (item != null)
{
var next = item.Next;
var state = item.Value.Update(frame);
if (state == VyroGestureState.DiscreteComplete || state == VyroGestureState.IterationComplete)
_Dispatcher.Dispatch(item.Value);
if (state == VyroGestureState.Invalid || state == VyroGestureState.DiscreteComplete || state == VyroGestureState.ContinuousComplete)
_CurrentGestures.Remove(item);
item = next;
}
// Add new Leap Gestures
foreach (var g in newLeapGestures)
_CurrentGestures.AddLast(VyroLeapGesture.CreateFromLeapGesture(g));
return true;
}
示例14: spare_should_leave_frame_open_for_scoring
public void spare_should_leave_frame_open_for_scoring()
{
var frame = new Frame();
frame.Roll('1');
frame.Roll('/');
Assert.AreEqual(true, frame.StillScoring);
}
示例15: ChatBox
public ChatBox()
{
Size = new Point(100, 100);
Input = new TextBox();
Input.Size = new Point(100, 35);
Input.Dock = DockStyle.Bottom;
Input.TextCommit += Input_OnTextCommit;
Elements.Add(Input);
Scrollbar = new ScrollBar();
Scrollbar.Dock = DockStyle.Right;
Scrollbar.Size = new Point(25, 25);
Elements.Add(Scrollbar);
Frame = new Frame();
Frame.Dock = DockStyle.Fill;
Frame.Scissor = true;
Elements.Add(Frame);
Output = new Label();
Output.BBCodeEnabled = true;
Output.TextWrap = true;
Output.AutoSize = Squid.AutoSize.Vertical;
Output.Text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";
Output.Style = "multiline";
Frame.Controls.Add(Output);
}