private bool win = false; // true if the user had win. #endregion Fields #region Constructors /// <summary> /// Load the shape and its pieces /// </summary> /// <param name="lockShapes"></param> /// <param name="shape"></param> public SecondScatterView(bool lockShapes, TangramShape shape) { InitializeComponent(); this.lockShapes = lockShapes; this.currentShape = shape; //Load the motherpiece for the location this.currentShape.getMotherPiece().Center = new Point(512, 384); this.currentShape.getMotherPiece().Orientation = 0; this.currentShape.getMotherPiece().IsEnabled = false; System.Windows.Shapes.Path p = (System.Windows.Shapes.Path)this.currentShape.getMotherPiece().Content; p.Fill = new SolidColorBrush(Colors.Black); p.Opacity = 0.5; this.currentShape.getMotherPiece().CanMove = false; this.currentShape.getMotherPiece().CanRotate = false; this.currentShape.getMotherPiece().CanScale = false; this.scatter2.Items.Add(this.currentShape.getMotherPiece()); //Load all pieces for the shape for (int j = 0; j < this.currentShape.getPieces().Count; j++) { this.scatter2.Items.Add(this.currentShape.getPieces()[j]); } //Create the surfaceTextBlock this.name = (SurfaceTextBox)Resources["name"]; //Check the time this.t1 = DateTime.Now; }
public KeyboardTextInput(AbstractKeyboard k, SurfaceTextBox t) { this.k = k; this.t = t; k.CaretMovedBackward += this.keyboard1_CaretMovedBackward; k.CaretMovedForward += this.keyboard1_CaretMovedForward; k.CharacterDeleted += this.keyboard1_CharacterDeleted; k.SelectionMovedBackward += this.keyboard1_SelectionMovedBackward; k.SelectionMovedForward += this.keyboard1_SelectionMovedForward; k.KeyPressed += this.keyboard1_KeyEvent; }
public Note() { Canvas innerView = new Canvas(); innerView.Width = 260; innerView.Height = 170; innerView.Background = new SolidColorBrush(Color.FromRgb(252, 240, 173)); //Titie text box titleText = new SurfaceTextBox(); titleText.AcceptsReturn = false; titleText.FontSize = 14; titleText.FontWeight = FontWeights.Bold; titleText.Foreground = Brushes.Black; titleText.Height = 30; titleText.Margin = new Thickness(8); titleText.Text = "Note Title"; titleText.Width = 243; titleText.Background = new SolidColorBrush(Color.FromRgb(252, 240, 173)); titleText.BorderBrush = Brushes.Gray; titleText.GotFocus += new RoutedEventHandler(titleText_GotFocus); //Content text box txt = new SurfaceTextBox(); txt.Foreground = Brushes.Black; txt.Margin = new Thickness(8); txt.FontSize = 14; txt.FontWeight = FontWeights.Bold; txt.Text = "Note Text"; txt.Width = 243; txt.Height = 100; txt.AcceptsReturn = true; txt.AcceptsTab = true; txt.TextWrapping = TextWrapping.Wrap; txt.Background = new SolidColorBrush(Color.FromRgb(252, 240, 173)); txt.BorderBrush = Brushes.Gray; txt.GotFocus += new RoutedEventHandler(txt_GotFocus); //Attach innerView.Children.Add(titleText); Canvas.SetTop(titleText, 0); innerView.Children.Add(txt); Canvas.SetTop(txt, 52); //Final item this.Content = innerView; this.Orientation = 0; this.MinHeight = 0; this.Height = 170; this.MaxHeight = 1000; this.MaxWidth = 1000; this.Center = new Point(152, 620); }
public override void OnApplyTemplate() { if (painter != null) Strokes = painter.Strokes; if (text != null) Name = text.Text; if (GetTemplateChild("btnReset") != null) { reset = GetTemplateChild("btnReset") as SurfaceButton; reset.Click += new RoutedEventHandler(btnReset_Click); } if (GetTemplateChild("txtName") != null) { text = GetTemplateChild("txtName") as SurfaceTextBox; text.TextChanged += new TextChangedEventHandler(text_TextChanged); text.Text = Name; } if (GetTemplateChild("lblName") != null) { label = GetTemplateChild("lblName") as Label; label.Content = Name; } if (GetTemplateChild("Painter") != null) { painter = GetTemplateChild("Painter") as SurfaceInkCanvas; // Set up the DrawingAttributes for the pen. var inkDA = new DrawingAttributes(); inkDA.Color = Colors.Black; inkDA.Height = 1; inkDA.Width = 1; inkDA.FitToCurve = false; painter.UsesTouchShape = false; painter.DefaultDrawingAttributes = inkDA; if(Strokes != null) painter.Strokes = Strokes; } base.OnApplyTemplate(); }
private SurfaceTextBox NewEntryTileTextBox(String attTag, ScatterViewItem item) { SurfaceTextBox txt = new SurfaceTextBox(); txt.AcceptsReturn = false; txt.Background = item.Background; txt.FontSize = 14; txt.FontWeight = FontWeights.Bold; txt.Height = 30; txt.Margin = new Thickness(8); Thickness bottomMargin = txt.Margin; bottomMargin.Bottom = 50; txt.Margin = bottomMargin; txt.Tag = attTag; txt.Text = attTag + "="; txt.Width = 150; txt.TextChanged += new TextChangedEventHandler(FilterTile_TextChanged); txt.MouseDoubleClick += new MouseButtonEventHandler(txt_MouseDoubleClick); return txt; }
public OurWebBrowser() { base.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); base.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); base.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(280, GridUnitType.Pixel) }); base.Background = new SolidColorBrush(Color.FromArgb(200, 50, 50, 50)); _webBrowser = new WebControl() { VerticalAlignment = System.Windows.VerticalAlignment.Stretch, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(12, 6, 12, 12) }; _webBrowser.BeginLoading += new BeginLoadingEventHandler(_webBrowser_BeginLoading); LoadUrl("msn.com"); Grid.SetRow(_webBrowser, 1); base.Children.Add(_webBrowser); //grid for the top items Grid grid = new Grid(); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); Grid.SetRow(grid, 0); base.Children.Add(grid); //stack panel for left buttons StackPanel sp = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal //Margin = new Thickness(12, 0, 0, 0) }; Grid.SetColumn(sp, 0); grid.Children.Add(sp); _backButton = new ImageButton("Back.png") { IsEnabled = false }; _backButton.Click += new System.Windows.RoutedEventHandler(backButton_Click); sp.Children.Add(_backButton); _forwardButton = new ImageButton("188-ArrowRounded.png") { IsEnabled = false }; _forwardButton.Click += new System.Windows.RoutedEventHandler(forwardButton_Click); sp.Children.Add(_forwardButton); //url bar _textBox = new SurfaceTextBox() { VerticalContentAlignment = System.Windows.VerticalAlignment.Center }; _textBox.Loaded += delegate { _textBox.Focus(); }; //focus on loaded _textBox.KeyUp += new System.Windows.Input.KeyEventHandler(_textBox_KeyUp); Grid.SetColumn(_textBox, 1); grid.Children.Add(_textBox); //right buttons StackPanel right = new StackPanel() { Orientation = System.Windows.Controls.Orientation.Horizontal }; Grid.SetColumn(right, 2); grid.Children.Add(right); //enter button ImageButton enterButton = new ImageButton("139-Play.png"); enterButton.Click += new RoutedEventHandler(enterButton_Click); right.Children.Add(enterButton); //save button ImageButton saveButton = new ImageButton("178-Save.png"); saveButton.Click += new RoutedEventHandler(saveButton_Click); right.Children.Add(saveButton); // keyboard this.kb = new Keyboard(); kbwi = new KeyboardWebInput(kb, _webBrowser); kbti = new KeyboardTextInput(kb, _textBox); _textBox.GotFocus += textGotFocus; _textBox.LostFocus += textLostFocus; _webBrowser.GotFocus += webGotFocus; _webBrowser.LostFocus += webLostFocus; kb.KeyboardHidden += keyBoardHidden; kb.KeyboardShown += keyBoardShown; Grid.SetRow(kb, 2); base.Children.Add(kb); }
/// <summary> /// Authors: Consuelo Valdes and Kelsey Tempel /// /// When user has finished moving the orignal BlastResult over, show an expanded information view and animate :) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void BlastPR_ScatterManipulationCompleted(object sender, ScatterManipulationCompletedEventArgs e) { Console.WriteLine(sender.GetType()); RealBlastPrimerResult senderSVI = (RealBlastPrimerResult)sender; if (!_balloon) { _balloon = true; //outlines selected svi this.BorderBrush = Brushes.SeaShell; this.BorderThickness = new Thickness(4); //creates the info box ScatterViewItem svi = new ScatterViewItem(); svi.Background = Brushes.OliveDrab; svi.Opacity = .75; svi.Orientation = 0; ///////////////////////////////////////////////////////////////////////////////////////// SurfaceTextBox surfaceTextBox = new SurfaceTextBox(); surfaceTextBox.FontFamily = new FontFamily("Courier New"); surfaceTextBox.AppendText(senderSVI.toString()); surfaceTextBox.TextWrapping = TextWrapping.Wrap; surfaceTextBox.IsReadOnly = true; surfaceTextBox.Width = 250;//Sets the size of the text box so that it wraps Grid textGrid = new Grid(); textGrid.Background = Brushes.White; textGrid.Margin = new Thickness(3); textGrid.Children.Add(surfaceTextBox); //set row content for mainWrapperGrid and add all objects appropriately svi.Content = textGrid; /////////////////////////////////////////////////////////////////////////// //Grid infoGrid = new Grid(); //infoGrid.VerticalAlignment = VerticalAlignment.Top; //infoGrid.HorizontalAlignment = HorizontalAlignment.Left; ////infoGrid.ShowGridLines = true; //RowDefinition row1 = new RowDefinition(); //RowDefinition row2 = new RowDefinition(); //RowDefinition row3 = new RowDefinition(); //RowDefinition row4 = new RowDefinition(); //ColumnDefinition col1 = new ColumnDefinition(); //row1.Height = new GridLength(35); //row2.Height = new GridLength(20); //row3.Height = new GridLength(20); //row4.Height = new GridLength(20); //infoGrid.RowDefinitions.Add(row1); //infoGrid.RowDefinitions.Add(row2); //infoGrid.RowDefinitions.Add(row3); //infoGrid.RowDefinitions.Add(row4); //infoGrid.ColumnDefinitions.Add(col1); //TextBlock headerText = new TextBlock(); ////headerText.Text = "This is the detailed view for a BLAST result"; //headerText.Text = "Restriction Enzyme Cut Sites"; //headerText.TextWrapping = TextWrapping.Wrap; //headerText.FontSize = 12; //headerText.TextAlignment = TextAlignment.Center; //headerText.FontWeight = FontWeights.Bold; //Grid.SetColumnSpan(headerText, 1); //Grid.SetRow(headerText, 0); //TextBlock scoreText = new TextBlock(); ////scoreText.Text = "Score: " + _score; //if (Math.Abs(_score) == 92) //{ // scoreText.Text = "SpeI:"; //} //else if (Math.Abs(_score) == 93) //{ // scoreText.Text = "XbaI:"; //} //else //{ // scoreText.Text = "EcoRI:"; //} //scoreText.FontSize = 12; //Grid.SetColumnSpan(scoreText, 1); //Grid.SetRow(scoreText, 1); //TextBlock startText = new TextBlock(); ////startText.Text = "Start: " + _start; //if (Math.Abs(_score) == 92) //{ // startText.Text = " 5' A | CTAGT 3'"; //} //else if (Math.Abs(_score) == 93) //{ // startText.Text = " 5' T | CTAGA 3'"; //} //else //{ // startText.Text = " 5' G | AATTC 3'"; //} //startText.FontSize = 12; //Grid.SetColumnSpan(startText, 1); //Grid.SetRow(startText, 2); //TextBlock stopText = new TextBlock(); ////stopText.Text = "Stop: " + _stop; //if (Math.Abs(_score) == 92) //{ // stopText.Text = " 3' TBATC | A 5'"; //} //else if (Math.Abs(_score) == 93) //{ // stopText.Text = " 3' AGATC | T 5'"; //} //else //{ // stopText.Text = " 3' CTTAA | G 5'"; //} //stopText.FontSize = 12; //Grid.SetColumnSpan(stopText, 1); //Grid.SetRow(stopText, 3); ScatterViewItem child = (ScatterViewItem)sender; svi.Center = child.Center; svi.ScatterManipulationDelta += new ScatterManipulationDeltaEventHandler(svi_ScatterManipulationDelta); ScatterView temp = (ScatterView)child.Parent; svi.CanScale = true; temp.Items.Add(svi); //EasingFunction Code Duration duration = new Duration(TimeSpan.FromSeconds(1.0)); // DoubleAnimation scale x/y DoubleAnimation widthAnimation = new DoubleAnimation(); widthAnimation.Duration = duration; DoubleAnimation heightAnimation = new DoubleAnimation(); heightAnimation.Duration = duration; widthAnimation.To = 250; widthAnimation.From = 50; heightAnimation.To = 150; heightAnimation.From = 50; Storyboard.SetTargetName(widthAnimation, svi.Name); Storyboard.SetTarget(widthAnimation, svi); Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(ScatterViewItem.WidthProperty)); Storyboard.SetTargetName(heightAnimation, svi.Name); Storyboard.SetTarget(heightAnimation, svi); Storyboard.SetTargetProperty(heightAnimation, new PropertyPath(ScatterViewItem.HeightProperty)); storyBoard1.Children.Add(heightAnimation); storyBoard1.Children.Add(widthAnimation); storyBoard1.Begin(); } // closes if (!_balloon) }