Example #1
0
        protected override void OnContactTapGesture(ContactEventArgs e)
        {
            var textFadeOut = (Storyboard)FindResource("TextFadeOut");

            textFadeOut.Begin();

            new ThreadedSoundPlayer(Properties.Resources.Tap).PlaySound();
        }
 public ContactMultiTapEventArgs(RoutedEvent routedEvent, ContactEventArgs args, int multiTapCount)
 {
     this.RoutedEvent = routedEvent;
     this.ContactEventArgs = args;
     this.MultiTapCount = multiTapCount;
     this.Handled = args.Handled;
     this.Source = args.Source;
 }
Example #3
0
        public void AfterOnTapGesture(ContactEventArgs e)
        {
            OnTapAnimation();

            CardOut = true;

            CurrentState = States.StateUnlocked;
        }
        private void addLibraryBar_ContactDown(object sender, ContactEventArgs e)
        {
            //SurfaceButton _bt = (SurfaceButton)sender;
            //_bt.po
            string stamp = Guid.NewGuid().ToString(); //guid to stamp the control name with
            stamp = stamp.Replace("-", ""); //remove the - from the guid

            //get the sender contact so we can get the orientation
            double o = e.Contact.GetOrientation(this);
            //Point p = e.Contact.GetPosition();

            //create the LibraryBar
            LibraryBar lb = new LibraryBar();
            lb.Width = 860;
            lb.Height = 250;
            lb.Rows = 1;

            //need a binging item to get the xml resource out of the resource dictionary
            Binding items = new Binding();
            items.Source = FindResource("Source"); //Source is the XML data in the resource dict
            //items.XPath = "Entry"; //can use Xpath here to get the xml needed
            lb.SetBinding(ItemsControl.ItemsSourceProperty, items);
            lb.ItemTemplate = (DataTemplate)this.FindResource("BarItemTemplate"); //set the item template from the resource dict

            //lb.AddHandler(SurfaceDragDrop.DragCompletedEvent,(OnShoppingListDragCompleted));

            //lb.PreviewContactDown  += OnShoppingListPreviewContactDown;
            //lb.PreviewContactChanged += OnShoppingListPreviewContactChanged;
            //lb.PreviewContactUp += OnShoppingListPreviewContactUp;
            //lb.PreviewMouseLeftButtonDown += OnShoppingListPreviewMouseLeftButtonDown;
            //lb.PreviewMouseMove += OnShoppingListPreviewMouseMove;
            //lb.PreviewMouseLeftButtonUp += OnShoppingListPreviewMouseLeftButtonUp;

            //register the library bar so we can find it later
            //NameScope.GetNameScope(this).RegisterName("fm1_anotherLb" + stamp, lb); //must call Registername to be able to use FindName later

            //Must create a new scatterview item to be added to the named scatter view in the XAML.
            ScatterViewItem svi = new ScatterViewItem();
            svi.Style = (Style)this.FindResource("LibraryControlInScatterViewItemContentStyle"); //Get the style for the scatterview item when using a surface library control (provided in SDK eg)
            svi.Orientation = o + 90;
            svi.Center = new Point(400, 400);
            svi.Content = lb;

            //register the scatterview item so we can find it later
            //NameScope.GetNameScope(this).RegisterName("fm1_anotherSV" + stamp, svi); //must call Registername to be able to use FindName later
            NameScope.GetNameScope(this).RegisterName("fm1_anotherSV", svi); //temp perm name

            DispatcherTimer timer = new DispatcherTimer();
            timer.Tag = _countDown; //store the count down in the tag of the timer so we can access it later
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick += new EventHandler(timer_Tick);
            timer.Start();

            //add the new timer and listview to the dictionary so we can get at it later
            myDictionary.Add(timer, svi);
            //add the library bar to the screen
            this.myScatterView.Items.Add(svi);
        }
Example #5
0
 private void Switchboard_ContactJoined(object sender, ContactEventArgs e)
 {
     Mail = e.Contact.Mail;
     if (!msn.InAcceptList(Mail))
     {
         conversation.Switchboard.Close();
     }
     frm_main.AddActiveConv(Mail);
 }
 void ImageThumbnailTemplate_ContactTapGesture(object sender, ContactEventArgs e)
 {
     /*LibraryBarItem self = sender as LibraryBarItem;
     Image i = pouet.Content as Image;
     if (i != null) Console.WriteLine(i.Source);
     e.Handled = true;
      */
     Console.WriteLine("Fap");
     e.Handled = true;
 }
Example #7
0
        protected override void OnContactDown(ContactEventArgs e)
        {
            base.OnContactDown(e);

            e.Contact.Capture(this);

            _manipulationProcessor.BeginTrack(e.Contact);

            e.Handled = true;
        }
        void ProviderScatterViewItem_ContactUp(object sender, ContactEventArgs e)
        {
            TrashBin t = StaticField.trashSVI.trashBin;

            ProviderScatterViewItem s = sender as ProviderScatterViewItem;
            ScatterViewItem trashSVI = StaticField.trashSVI;

            Point centerS = s.ActualCenter;
            Point centerTrashSVI = trashSVI.ActualCenter;

            double trashSVIWidth = trashSVI.ActualWidth;
            double trashSVIHeight = trashSVI.ActualHeight;

            double max = Math.Min(trashSVIHeight, trashSVIWidth);

            if ((centerS.X <= centerTrashSVI.X + max / 2) &&
                (centerS.X >= centerTrashSVI.X - max / 2) &&
                (centerS.Y <= centerTrashSVI.Y + max / 2) &&
                (centerS.Y >= centerTrashSVI.Y - max / 2))
            {

                ObservableCollection<Trash> dataTemplate = (ObservableCollection<Trash>) t.ItemsSource;

                if (dataTemplate == null)
                {
                    dataTemplate = new ObservableCollection<Trash>();
                }

                Trash trash = new Trash(s.providerTemplate, s.providerTemplate.ProviderImage.Source);
                dataTemplate.Add(trash);

                t.ItemsSource = dataTemplate;

                // loop over Wedding services to disactivate
                var st = StaticField.wedding.service_types;
                for (int i = 0; i < st.Count; i++)
                {
                    for (int j = 0; j < st[i].services.Count; j++)
                    {
                        if (s.providerTemplate.provider.id == st[i].services[j].id)
                        {
                            st[i].services[j].activated = false;
                            Console.WriteLine("GOT IT !" + st[i].services[j].activated);
                        }
                    }
                }

                // loop over all scattersView to delete
                ScatterView sv = ((ScatterView)MainView.GetWindow(this).FindName("MainScatterView"));
                ItemCollection tmp = (ItemCollection) sv.Items;
                tmp.Remove(s);
            }
        }
 /// <summary>
 /// Occurs when the user tap on a shape.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void scatter_ContactTapGesture(object sender, ContactEventArgs e)
 {
     for (int i = 0; i < this.scatter.Items.Count; i++)
     {
         ScatterViewItem svi = (ScatterViewItem)this.scatter.Items[i];
         if (svi.IsActive) //if a shape is selected
         {
             this.selectedShape = this.shapes[i];
             // trigger an event with this selected shape in parameter
             ShapeSelectedEventArgs eventShapeSelection = new ShapeSelectedEventArgs(this.selectedShape);
             if (eventShapeSelection != null) this.OnShapeSelected(this, eventShapeSelection);
         }
     }
 }
        private void GenePentagon_PreviewContactDown(object sender, ContactEventArgs e)
        {
            FrameworkElement element = (FrameworkElement)sender;
            VisualGene visualGene = (VisualGene) element.DataContext;
            ViewModel.SelectedGene = visualGene.Model;

            //// Bring gene pentagon to the front of the chromosome bar
            //// so the elementmenu will appear in front of other gene pentagons
            //SurfaceListBoxItem container = this.GetListBoxItem(element);
            //container.SetValue(Panel.ZIndexProperty, _maxZIndex);
            //_maxZIndex++;

            Rect contactPosition = e.Contact.BoundingRect;
            ViewModel.GenePentagonContacted(contactPosition, visualGene.Direction);
        }
Example #11
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public void AfterContactdown(ContactEventArgs e)
        {
            if (CurrentState.Equals(States.StateRotation))
            {
                AfterContactDownAnimation();

                base.OnContactDown(e);

                e.Contact.Capture(this);

                _manipulationProcessor.BeginTrack(e.Contact);

                e.Handled = true;
            }
        }
Example #12
0
        protected override void OnContactDown(ContactEventArgs e)
        {
            var p = e.Contact.GetPosition(this);

            if (p.Y > 30 && p.Y < 50)
            {
                if (p.X > 30 && p.X < 45)
                {
                    ZoomOut(this, e);
                    Visibility = Visibility.Collapsed;
                }
                else if (p.X > 55 && p.X < 70)
                {
                    ZoomIn(this, e);
                    Visibility = Visibility.Collapsed;
                }
            }
        }
        private void scatterviewMomma_ContactDown(object sender, ContactEventArgs e)
        {
            ScatterViewItem svi = new ScatterViewItem();
            svi.Background = Brushes.Tomato;
            svi.Height = 300;
            svi.Width = 300;

            //DoubleAnimation animation = new DoubleAnimation();
            //animation.To = 0;
            //animation.Duration = new Duration(new TimeSpan(0, 0, 5));

            //Storyboard sb = new Storyboard();
            //sb.Children.Add(animation);

            //Storyboard.SetTarget(sb, svi);
            //Storyboard.SetTargetProperty(sb, new PropertyPath(Control.ActualHeightProperty));
            //sb.Begin();
            ScatterView temp = (ScatterView) scatterviewMomma.Parent;

        }
 /// <summary>
 /// Handles the tap event for the current color indicator.
 /// </summary>
 /// <param name="sender">The color wheel.</param>
 /// <param name="args">The arguments for the event.</param>
 private void OnCurrentColorTap(object sender, ContactEventArgs args)
 {
     // Replace the current color botton with the color wheel
     ColorWheel.Visibility = Visibility.Visible;
 }
Example #15
0
 public void OnContactStartRecord(object sender, ContactEventArgs e)
 {
     isTouching = true;
     touchManager.Clear();
     capture.OnContactHelper();
 }
Example #16
0
 private void conv_UserTyping(Conversation sender, ContactEventArgs e)
 {
     this.Invoke(new StartClientWritingTimerDelegate(this.StartClientWritingTimer), new object [] { e.Contact.Name } );
 }
 /// <summary>
 /// Handles the ContactDownEvent for the color wheel and the current color indicator.
 /// </summary>
 /// <param name="sender">The color wheel that raised the event.</param>
 /// <param name="args">The arguments for the event.</param>
 private void OnColorSelectionPreviewContactDown(object sender, ContactEventArgs args)
 {
     // Capture the contact and handle the event
     IInputElement element = sender as IInputElement;
     if (element != null && Contacts.CaptureContact(args.Contact, element))
     {
         args.Handled = true;
     }
 }
Example #18
0
 static void Switchboard_ContactLeft(object sender, ContactEventArgs e)
 {
     WL("{0} left", e.Contact.Name);
 }
Example #19
0
        private void conv_ContactJoin(Conversation sender, ContactEventArgs e)
        {
            this._contact.MSNContact = e.Contact;
            this.DisplayMessage("\t\t\t\t\t\tContact joined! " + e.Contact.Name);
            this.UpdateMsnContactName();

            foreach( string message in this.messageStack)
            {
                this.SendMessage(message);
            }
            messageStack.Clear();
        }
Example #20
0
 void OnContactLeave(object sender, ContactEventArgs e)
 {
     InvokeHandler(ContactLeave, e);
 }
 /// <summary>
 /// Handles the tap event for the current color indicator.
 /// </summary>
 /// <param name="sender">The color wheel.</param>
 /// <param name="args">The arguments for the event.</param>
 private void OnCurrentColorTap(object sender, ContactEventArgs args)
 {
     // Replace the current color botton with the color wheel
     ColorWheel.Visibility = Visibility.Visible;
 }
Example #22
0
 void OnPreviewContactMoved(object sender, ContactEventArgs e)
 {
     InvokeHandler(PreviewContactMoved, e);
 }
Example #23
0
 void OnGotContactCapture(object sender, ContactEventArgs e)
 {
     InvokeHandler(GotContactCapture, e);
 }
        void OnContactMoved(object sender, ContactEventArgs e)
        {
            Point position = e.GetPosition(this);

            FixedHingeJoint joint;

            if (contactJoints.TryGetValue(e.Contact.Id, out joint))
            {
                joint.Anchor = position.ToVector2D();

                //scale
                Body             body             = joint.Bodies.First();
                FrameworkElement frameworkElement = body.Tag as FrameworkElement;
                if (frameworkElement != null && GetIsScalable(frameworkElement))
                {
                    ScaleState state;
                    if (elementToScale.TryGetValue(frameworkElement, out state))
                    {
                        IEnumerable <Contact> contacts = MultitouchScreen.GetContactsCaptured((IInputElement)e.Source);
                        double    previousDistance     = 0;
                        double    currentDistance      = 0;
                        int       divisor       = 0;
                        Contact[] contactsArray = contacts.ToArray();

                        Point center = new Point(frameworkElement.ActualWidth / 2, frameworkElement.ActualHeight / 2);

                        for (int i = 0; i < contactsArray.Length; i++)
                        {
                            for (int j = i + 1; j < contactsArray.Length; j++)
                            {
                                Point  currFirst  = contactsArray[j].GetPosition(this);
                                Point  currSecond = contactsArray[i].GetPosition(this);
                                Vector vector     = frameworkElement.PointFromScreen(currFirst) - frameworkElement.PointFromScreen(currSecond);
                                currentDistance += vector.Length;

                                Point prevFirst = contactsArray[j].GetPoints(this).FirstOrDefault();
                                if (default(Point) == prevFirst)
                                {
                                    prevFirst = currFirst;
                                }
                                Point prevSecond = contactsArray[i].GetPoints(this).FirstOrDefault();
                                if (default(Point) == prevSecond)
                                {
                                    prevSecond = currSecond;
                                }
                                Vector previousVector = frameworkElement.PointFromScreen(prevFirst) - frameworkElement.PointFromScreen(prevSecond);
                                previousDistance += previousVector.Length;
                                divisor++;
                            }
                        }
                        if (divisor == 0)
                        {
                            divisor = 1;
                        }

                        previousDistance /= divisor;
                        currentDistance  /= divisor;

                        double delta = currentDistance / previousDistance;
                        if (double.IsNaN(delta))
                        {
                            delta = 1;
                        }

                        var newScale = state.Scale * delta;
                        if (newScale > MaxScale)
                        {
                            delta = MaxScale / state.Scale;
                        }
                        else if (newScale < MinScale)
                        {
                            delta = MinScale / state.Scale;
                        }

                        state.Scale         *= delta;
                        state.Center         = center;
                        body.Transformation *= Matrix2x3.FromScale(new Vector2D(delta, delta));
                    }
                }
            }
        }
 private void OnContactLoaded(object sender, ContactEventArgs e)
 {
     View.Add(e.Contacto);
     //SubTitle = View.Count + " contacts";
     //labelSubTitle.Text = SubTitle;
 }
Example #26
0
        internal void Input(IEnumerable <ContactInfo> contactInfos)
        {
            foreach (ContactInfo contactInfo in contactInfos)
            {
                ContactAction clickAction = clickStates.GetAction(contactInfo);

                RoutedEvent routedEvent = null;
                switch (contactInfo.State)
                {
                case ContactState.Down:
                    routedEvent = MultitouchScreen.ContactDownEvent;
                    break;

                case ContactState.Up:
                    routedEvent = MultitouchScreen.ContactUpEvent;
                    break;

                case ContactState.Move:
                    routedEvent = MultitouchScreen.ContactMoveEvent;
                    break;

                default:
                    break;
                }
                if (routedEvent != null)
                {
                    dispatcher.Invoke(DispatcherPriority.Input,
                                      (Action)(delegate
                    {
                        try
                        {
                            Point localPoint = Application.Current.MainWindow.PointFromScreen(contactInfo.Center);
                            IInputElement inputElement = Application.Current.MainWindow.InputHitTest(localPoint);

                            MultitouchDevice device;
                            if (!devices.TryGetValue(contactInfo.Id, out device))
                            {
                                //novoe kasanie v predelah elementa. posilaem snachalo ContactEnterEvent.
                                device = new MultitouchDevice(contactInfo.Id, inputElement);
                                devices.Add(contactInfo.Id, device);
                                ContactEventArgs mouseEnter = new ContactEventArgs(device, contactInfo);
                                mouseEnter.RoutedEvent = MultitouchScreen.ContactEnterEvent;
                                InputManager.Current.ProcessInput(mouseEnter);
                            }
                            else
                            {
                                if (device.Target != inputElement)
                                {
                                    //staroe kasanie popalo na novij element. posilaem ContactLeaveEvent v starij element.
                                    ContactEventArgs mouseLeave = new ContactEventArgs(device, contactInfo);
                                    mouseLeave.RoutedEvent = MultitouchScreen.ContactLeaveEvent;
                                    try
                                    {
                                        InputManager.Current.ProcessInput(mouseLeave);
                                    }
                                    finally
                                    {
                                        devices.Remove(contactInfo.Id);
                                    }
                                }
                            }
                            //posilaem event v element.
                            RaiseInputEvent(device, inputElement, contactInfo, routedEvent);

                            //esli bil click ili double click, to posilaem ih tozhe.
                            if (clickAction == ContactAction.Click)
                            {
                                RaiseInputEvent(device, inputElement, contactInfo, MultitouchScreen.ContactClickEvent);
                            }
                            else if (clickAction == ContactAction.DoubleClick)
                            {
                                RaiseInputEvent(device, inputElement, contactInfo, MultitouchScreen.ContactDoubleClickEvent);
                            }

                            if (routedEvent == MultitouchScreen.ContactUpEvent)
                            {
                                devices.Remove(contactInfo.Id);
                            }
                        }
                        catch (Exception ex)
                        {
                            Trace.TraceError(ex.ToString());
                        }
                    }));
                }
            }
        }
Example #27
0
 private void OnContactChanged(object source, ContactEventArgs e)
 {
     //Event handler for new contact created
     OnValidateForm(null, EventArgs.Empty);
 }
Example #28
0
 void OnContactEnter(object sender, ContactEventArgs e)
 {
     InvokeHandler(ContactEnter, e);
 }
Example #29
0
 private void Grid_ContactUp_1(object sender, ContactEventArgs e)
 {
     Grid_MouseUp_1(sender, null);
 }
Example #30
0
 void OnContactRemoved(object sender, ContactEventArgs e)
 {
     InvokeHandler(ContactRemoved, e);
 }
 // For Testing
 private void OuterEllipse_PreviewContactDown(object sender, ContactEventArgs e)
 {
     //if (e.Contact.IsFingerRecognized)
     //{
     //    CenterButtonAnimations();
     //}
     //else if (!e.Contact.IsTagRecognized)
     //{
     Restaurant.Model.States newState = StateMachineHelper.GetNextState(Session.Instance.GlobalState);
     if (Session.Instance.Persons.Count > 0)
     {
         foreach (Person p in Session.Instance.Persons)
         {
             Session.Instance.NextStateForPerson(p, newState);
         }
     }
     else
     {
         Session.Instance.NextGlobalState();
     }
     //}
 }
Example #32
0
 private static void OnContactInfoReceived(object sender, ContactEventArgs e)
 {
     Console.WriteLine($"Contact info: {e.Contact.Number}");
 }
Example #33
0
		/// <summary>
		/// Called when contact is moved.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="Multitouch.Framework.WPF.Input.ContactEventArgs"/> instance containing the event data.</param>
		protected virtual void OnContactMoved(object sender, ContactEventArgs e)
		{
			Point position = e.GetPosition(this);
			if(points.ContainsKey(e.Contact.Id))
				points[e.Contact.Id].Add(new StylusPoint(position.X, position.Y));
		}
Example #34
0
 private static void OnContactStateChanged(object sender, ContactEventArgs e)
 {
     Console.WriteLine($"{e.Contact.Number} changed state to {e.Contact.State}");
 }
Example #35
0
 private void conv_ContactLeave(Conversation sender, ContactEventArgs e)
 {
     this.DisplayMessage("\t\t\t\t\t\tContact left! " + e.Contact.Name);
     if(sender.Users.Count > 0)
     {
         this.UpdateMsnContactName();
     }
 }
Example #36
0
 private void ContactTyping(Conversation sender, ContactEventArgs e)
 {
     //Console.WriteLine(e.Contact.Name + " is typing");
 }
 private void PublicationsSurfaceListBox_PreviewContactUp(object sender, ContactEventArgs e)
 {
    
     ((PublicationsViewModel)this.DataContext).Routed_PublicationsSurfaceListBox_PreviewContactUp(sender, e);
 }
Example #38
0
 private void OnContactOffline(Messenger sender, ContactEventArgs e)
 {
     Console.Text = e.Contact.Name + " went offline\r\n";
 }
        /// <summary>
        /// Handles the tap event for the color wheel.
        /// </summary>
        /// <param name="sender">The color wheel.</param>
        /// <param name="args">The arguments for the event.</param>
        private void OnColorWheelContactTap(object sender, ContactEventArgs args)
        {
            // Set the color on the CurrentColor indicator and on the SurfaceInkCanvas
            Color color = GetPixelColor(args.Contact);

            // Black means the user touched the transparent part of the wheel. In that
            // case, leave the color set to its current value
            if (color != Colors.Black)
            {
                DrawingPadCanvas.DefaultDrawingAttributes.Color = color;
                CurrentColor.Fill = new SolidColorBrush(color);
            }

            // Set editing mode to ink
            DrawingPadCanvas.EditingMode = SurfaceInkEditingMode.Ink;

            // Update the button image
            EditModeButton.Content = LoadImageFromPath("Resources\\Draw.png");

            // Replace the color wheel with the current color button
            ColorWheel.Visibility = Visibility.Hidden;
        }
Example #40
0
 private void country_ContactEnter(object sender, ContactEventArgs e)
 {
     (sender as Image).Opacity = 0.5;
 }
Example #41
0
        /// <summary>
        /// Controls what occurs when the user stops a gesture
        /// NOTE: This event fires more than it ought. So we have it ignore any data shorter than 600 millisecondsw
        ///
        /// </summary>
        public void OffContactStopRecord(object sender, ContactEventArgs e)
        {
            capture.OffContactHelper();

            if (capture.totalMillisec > 800)
            {
                lock (obj)
                {
                    writeToCSV();
                }

                capture.calculateRatio(touchManager);

                advanceGesture();
            }
        }
Example #42
0
        private static void ContactUp(object sender, ContactEventArgs e)
        {
            try
            {
                int id = e.Contact.Id;
                if (!deviceDictionary.Keys.Contains(id))
                {
                    ContactDown(sender, e);
                }
                SurfaceTouchDevice device = deviceDictionary[id];

                if (device != null &&
                    device.IsActive)
                {
                    device.ReportUp();
                    device.Deactivate();

                    deviceDictionary.Remove(id);
                }
            }
            //Ignore InvalidOperationException due to race condition on Surface hardware
            catch (InvalidOperationException)
            { }
        }
Example #43
0
 private void country_ContactLeave(object sender, ContactEventArgs e)
 {
     (sender as Image).Opacity = 1.0;
 }
Example #44
0
 /// <summary>
 /// Received a event notification that a contact information was successfully read.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnContactLoaded(object sender, ContactEventArgs e)
 {
     Contacts.Add(e.Contact);
     RaiseSearchHandle();
 }
Example #45
0
        private static void ContactDown(object sender, ContactEventArgs e)
        {
            try
            {
                if (deviceDictionary.Keys.Contains(e.Contact.Id))
                {
                    return;
                }
                SurfaceTouchDevice device = new SurfaceTouchDevice(e.Contact);
                deviceDictionary.Add(e.Contact.Id, device);

                device.SetActiveSource(e.Device.ActiveSource);
                device.Activate();
                device.ReportDown();
            }
            //Ignore InvalidOperationException due to race condition on Surface hardware
            catch (InvalidOperationException)
            { }
        }
 public SurfaceVEPushPinClickedEventArgs(ContactEventArgs contactEventArgs)
 {
     this.contactEventArgs = contactEventArgs;
     this.RoutedEvent      = contactEventArgs.RoutedEvent;
 }
        /// <summary> 
        /// Creates detailed view notecard that pops up when a ResultSVI has been touched. 
        /// 
        /// Make as touched so we don't have useless memory waste.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// clumsy animation conversion for anchoring expanded results
        void resultSVI_PreviewContactDown(object sender, ContactEventArgs e)
        {
            ScatterViewItem senderSVI = (ScatterViewItem)sender;
            ResultSVI resultSVI = (ResultSVI)senderSVI.Content;
            if (!resultSVI._balloon) //if a balloon doesn't already exist
            {
                resultSVI._balloon = true;

                //outlines selected svi
                resultSVI.BorderBrush = Brushes.SeaShell;
                resultSVI.BorderThickness = new Thickness(3);

                //creates the info box

                //ScatterViewItem svi = new ScatterViewItem();
                //svi.Background = Brushes.OliveDrab;
               // svi.Opacity = .75;
               // svi.Orientation = 0;

                Grid infoGrid = new Grid();
                infoGrid.VerticalAlignment = VerticalAlignment.Top;
                infoGrid.HorizontalAlignment = HorizontalAlignment.Left;

                //create rows and single column
                RowDefinition row1 = new RowDefinition();
                RowDefinition row2 = new RowDefinition();
                RowDefinition row3 = new RowDefinition();
                RowDefinition row4 = new RowDefinition();
                RowDefinition row5 = new RowDefinition();
                ColumnDefinition col1 = new ColumnDefinition();

                //edit heights of information to be displayed
                row1.Height = new GridLength(35);
                row2.Height = new GridLength(15);
                row3.Height = new GridLength(15);
                row4.Height = new GridLength(15);
                row5.Height = new GridLength(15);



                // add rows and column to the infoGrid contained in the SVI
                infoGrid.RowDefinitions.Add(row1);
                infoGrid.RowDefinitions.Add(row2);
                infoGrid.RowDefinitions.Add(row3);
                infoGrid.RowDefinitions.Add(row4);
                infoGrid.RowDefinitions.Add(row5);
                infoGrid.ColumnDefinitions.Add(col1);

                //get sender, ResultSVI
                ScatterViewItem resultSVIWrapper = (ScatterViewItem)sender;
                ResultSVI result = (ResultSVI)resultSVIWrapper.Content;

                //text for notecard
                TextBlock headerText = new TextBlock();
                headerText.Text = " Detailed BLAST Result";
                headerText.TextWrapping = TextWrapping.Wrap;
                headerText.FontSize = 12;
                headerText.TextAlignment = TextAlignment.Center;
                headerText.FontWeight = FontWeights.Bold;
                Grid.SetColumnSpan(headerText, 1);
                Grid.SetRow(headerText, 0);
                infoGrid.Children.Add(headerText);

                TextBlock startText = new TextBlock();
                startText.Text = " Start: " + result.GetHitStart();
                startText.FontSize = 12;
                startText.TextAlignment = TextAlignment.Left;
                Grid.SetColumnSpan(startText, 1);
                Grid.SetRow(startText, 1);
                infoGrid.Children.Add(startText);

                TextBlock lengthText = new TextBlock();
                double length = result.GetHitStop() - result.GetHitStart();
                lengthText.Text = " Length: " + length;
                lengthText.FontSize = 12;
                lengthText.TextAlignment = TextAlignment.Left;
                Grid.SetColumnSpan(lengthText, 1);
                Grid.SetRow(lengthText, 2);
                infoGrid.Children.Add(lengthText);

                TextBlock eValText = new TextBlock();
                eValText.Text = " E-Val " + result.GetEvalue();
                eValText.FontSize = 12;
                eValText.TextAlignment = TextAlignment.Left;
                Grid.SetColumnSpan(eValText, 1);
                Grid.SetRow(eValText, 3);
                infoGrid.Children.Add(eValText);

                TextBlock scoreText = new TextBlock();
                scoreText.Text = " Score " + result.GetScore();
                scoreText.FontSize = 12;
                scoreText.TextAlignment = TextAlignment.Left;
                Grid.SetColumnSpan(scoreText, 1);
                Grid.SetRow(scoreText, 4);
                infoGrid.Children.Add(scoreText);

                double start = resultSVI.GetHitStart();
                double score = resultSVI.GetScore();

                //svi.Content = infoGrid;
               // svi.Center = senderSVI.Center;

                //ScatterViewItem child = (ScatterViewItem)sender;
                //ScatterView temp = (ScatterView)child.Parent;
               // temp.Items.Add(svi);


                infoGrid.Height = 5;
                infoGrid.Width = 100;


                resultSVI.infoCanvas.Children.Add(infoGrid);
                infoGrid.Margin = new Thickness(0, -25, 0, 0);
                resultSVI.infoCanvas.Children.Remove(resultSVI.eValLabel);
                resultSVI.infoCanvas.Children.Remove(resultSVI.scoreLabel);

                senderSVI.Opacity = 1;


                // Animation for making notecard appear
                //EasingFunction Code 
                Duration duration = new Duration(TimeSpan.FromSeconds(1.0));

                //Make width animation and height animation
                DoubleAnimation widthAnimation = new DoubleAnimation();
                widthAnimation.Duration = duration;
                DoubleAnimation heightAnimation = new DoubleAnimation();
                heightAnimation.Duration = duration;


                DoubleAnimation infoGridHeightAnimation = new DoubleAnimation();
                infoGridHeightAnimation.Duration = duration;



                ThicknessAnimation infoGridMarginAnimation = new ThicknessAnimation();
                infoGridMarginAnimation.Duration = duration;
                
           

                // give starting and stopping x and y values for animation
                widthAnimation.To = 100;
                widthAnimation.From = 100;
                heightAnimation.To = 100;
                heightAnimation.From = 50;


                infoGridHeightAnimation.To = 100;
                infoGridHeightAnimation.From = 50;

                infoGridMarginAnimation.To = new Thickness(0,-25,0,0);
                infoGridMarginAnimation.From = new Thickness(0,0,0,0);



                // Tell storyboards which animation is happening to which item
                Storyboard.SetTargetName(widthAnimation, senderSVI.Name);
                Storyboard.SetTarget(widthAnimation, senderSVI);
                Storyboard.SetTargetProperty(widthAnimation, new PropertyPath(ScatterViewItem.WidthProperty));

                Storyboard.SetTargetName(heightAnimation, senderSVI.Name);
                Storyboard.SetTarget(heightAnimation, senderSVI);
                Storyboard.SetTargetProperty(heightAnimation, new PropertyPath(ScatterViewItem.HeightProperty));


                Storyboard.SetTargetName(infoGridHeightAnimation, infoGrid.Name);
                Storyboard.SetTarget(infoGridHeightAnimation, infoGrid);
                Storyboard.SetTargetProperty(infoGridHeightAnimation, new PropertyPath(ScatterViewItem.HeightProperty));


                Storyboard.SetTargetName(infoGridMarginAnimation, infoGrid.Name);
                Storyboard.SetTarget(infoGridMarginAnimation, infoGrid);
                Storyboard.SetTargetProperty(infoGridMarginAnimation, new PropertyPath(Grid.MarginProperty));



                // add and begin animations
                storyBoard1 = new Storyboard();
                storyBoard1.Children.Add(heightAnimation);
                storyBoard1.Children.Add(widthAnimation);
                storyBoard1.Children.Add(infoGridHeightAnimation);

                storyBoard1.Children.Add(infoGridMarginAnimation);

                
               
                storyBoard1.Begin();

            }//closes if
        }
Example #48
0
 private void SurfaceButton_ContactTapGesture(object sender, ContactEventArgs e)
 {
     SurfaceButton surfaceButton = sender as SurfaceButton;
     ScatterViewItem scatterViewItem = surfaceButton.FindVisualParent<ScatterViewItem>();
     ScatterFlip.SetIsFlipped(scatterViewItem, !ScatterFlip.GetIsFlipped(scatterViewItem));
 }
        private void RaiseElementDraggedEvent(FrameworkElement element, Point offset, ContactEventArgs e)
        {
            ElementRoutedEventArgs newEventArgs = new ElementRoutedEventArgs(element, offset, e);

            newEventArgs.RoutedEvent = ElementDraggedEvent;
            RaiseEvent(newEventArgs);
        }
Example #50
0
 public CountryContactEventArgs(string countryId, ContactEventArgs e)
 {
     this.CountryId        = countryId;
     this.ContactEventArgs = e;
 }
Example #51
0
 private void OnContactLoaded(object sender, ContactEventArgs e)
 {
     Contacts.Add(e.Contact);
 }
 protected void HandleEvent(object sender, ContactEventArgs e)
 {
     events.Enqueue(new RoutedEventArgsInfo(e));
 }
Example #53
0
 static void Switchboard_UserTyping(object sender, ContactEventArgs e)
 {
     WL(e.Contact.Name + "is typing");
     //发送打字状态
     ((XihSolutions.DotMSN.SBMessageHandler)sender).SendTypingMessage();
 }
 private void PublicationsArticle_PreviewContactDown(object sender, ContactEventArgs e)
 {
     //This method is used to handle moving PublicationsArticleSVI back into the SurfaceListBox
     ((ExtendedDesktopViewModel)this.DataContext)._mainVM.Routed_PublicationsArticle_PreviewContactDown(sender, e);//reroutes event handler to SurfaceWindow1ViewModel, which will then reroute it to PublicationsViewModel
 }
 public SurfaceVEPushPinClickedEventArgs()
 {
     this.contactEventArgs = null;
 }
        private void SeqTransSVI_PreviewContactUp(object sender, ContactEventArgs e)
        {
            if (((ScatterViewItem)sender).DataContext as SequenceViewModel != null)
            {
                //Goes through workspaceActualSV looking for TranslationViewModels
                for (int i = 0; i < workspaceActualSV.Items.Count; i++)
                {
                    //If the translation object is found in the workspaceActualSV
                    if ((workspaceActualSV.Items[i]) as TranslationViewModel != null)
                    {
                        //Check centers to see if they should be aligned
                        if ((Math.Abs(((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center.X - ((ScatterViewItem)sender).Center.X) < 50)
                            && (Math.Abs(((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center.Y - ((ScatterViewItem)sender).Center.Y) < 50))
                        {
                            //ALIGN!
                            ((ScatterViewItem)sender).Center = ((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center;
                            ((ScatterViewItem)sender).Orientation = ((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Orientation;
                            ((ScatterViewItem)sender).Width = ((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Width;
                            ((ScatterViewItem)sender).Height = ((TranslationViewModel)workspaceActualSV.Items[i]).MyDadSVI.Height;
                            //Transparent-ify the top
                            ((SequenceViewModel)((ScatterViewItem)sender).DataContext).Background = new SolidColorBrush(Colors.Transparent);
                        }
                        else
                        {
                            ((SequenceViewModel)((ScatterViewItem)sender).DataContext).Background = new SolidColorBrush(Colors.Black);
                        }
                    }

                }

            }
            else if (((ScatterViewItem)sender).DataContext as TranslationViewModel != null)
            {
                //Goes through workspaceActualSV looking for TranslationViewModels
                for (int i = 0; i < workspaceActualSV.Items.Count; i++)
                {
                    //If the translation object is found in the workspaceActualSV
                    if ((workspaceActualSV.Items[i]) as SequenceViewModel != null)
                    {
                        //Check centers to see if they should be aligned
                        if ((Math.Abs(((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center.X - ((ScatterViewItem)sender).Center.X) < 50)
                            && (Math.Abs(((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center.Y - ((ScatterViewItem)sender).Center.Y) < 50))
                        {
                            //ALIGN!
                            ((ScatterViewItem)sender).Center = ((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Center;
                            ((ScatterViewItem)sender).Orientation = ((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Orientation;
                            ((ScatterViewItem)sender).Width = ((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Width;
                            ((ScatterViewItem)sender).Height = ((SequenceViewModel)workspaceActualSV.Items[i]).MyDadSVI.Height;
                            //Transparent-ify the top
                            ((TranslationViewModel)((ScatterViewItem)sender).DataContext).Background = new SolidColorBrush(Colors.Transparent);
                        }
                        else
                        {
                            ((TranslationViewModel)((ScatterViewItem)sender).DataContext).Background = new SolidColorBrush(Colors.Black);
                        }
                    }

                }
            }

        }
Example #57
0
        private void OnContactEvent(object sender, ContactEventArgs e)
        {
            object oGroup  = e.GetExtra("group");
            object oPerson = e.GetExtra("contact");

            if (oPerson is Group)
            {
                oGroup = (oPerson as Group);
            }
            switch (e.Type)
            {
            case ContactEventTypes.CONTACT_ADDED:
            case ContactEventTypes.CAMERA_ADDED:
                if (oPerson != null)
                {
                    if (oPerson is System.Collections.Generic.List <Person> )
                    {
                        System.Collections.Generic.List <Person> lP = oPerson as System.Collections.Generic.List <Person>;
                        foreach (Person p in lP)
                        {
                            if (p.Uri != null && !(p.Uri == ""))
                            {
                                this.SubscribeTermStatus(p);
                            }
                        }
                    }
                    else
                    {
                        Person p = oPerson as Person;
                        if (p != null && p.Uri != null && !(p.Uri == ""))
                        {
                            this.SubscribeTermStatus(p);
                        }
                    }
                }
                break;

            case ContactEventTypes.CONTACT_REMOVED:
                if (oPerson != null)
                {
                    if (oPerson is System.Collections.Generic.List <Person> )
                    {
                        System.Collections.Generic.List <Person> lP = oPerson as System.Collections.Generic.List <Person>;
                        foreach (Person p in lP)
                        {
                            this.UnSubscribeTermStatus(p);
                        }
                    }
                    else
                    {
                        Person p = oPerson as Person;
                        this.UnSubscribeTermStatus(p);
                    }
                }
                break;

            case ContactEventTypes.GROUP_ADDED:
                if (oGroup != null)
                {
                    Group g = oGroup as Group;
                    if (g.Uri != null && !(g.Uri == ""))
                    {
                        this.SubscribeGroupStatus(g);
                        this.SubscribeGroupMemberShip(g);
                    }
                }
                break;

            case ContactEventTypes.GROUP_REMOVED:
                if (oGroup != null)
                {
                    Group gg = oGroup as Group;
                    this.UnSubscribeGroupStatus(gg);
                }
                break;
            }
        }
Example #58
0
 private void Switchboard_ContactLeft(object sender, ContactEventArgs e)
 {
     Console.WriteLine("==>Contact Left.");
 }
Example #59
0
        private void Grid_ContactDown(object sender, ContactEventArgs e)
        {
            UIElement source = sender as UIElement;
            Point point = e.GetPosition(source);
            //Console.WriteLine("This is the point = " + point.ToString());
            
            Canvas clicked = ClickLocation(point);
            //Console.WriteLine("This is the clicked variable", clicked.ToString());
            
            if (clicked == Notes)
            {
                int row = ClickRow(e.GetPosition(clicked));

                if (row != -1)
                    AddNote(row);
            }
            else if (clicked != null)
            {
                TimeOfDay area = ClickArea(e.GetPosition(clicked));
                AddEntry(clicked, area);
            }
        }
 private void OnContactLeave(object sender, ContactEventArgs e)
 {
     OnContactUp(sender, e);
 }