Пример #1
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(PresenceBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_Check, serviceImpl.Check).Build());
 }
Пример #2
0
        private void MenuItem_Click_4(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();

            dlg.DefaultExt = ".ptr";
            dlg.Filter     = "Proximity Toolkit Recorded Session Files (*.ptr)|*.ptr";

            if (dlg.ShowDialog() == true)
            {
                output = dlg.FileName;
            }

            foreach (relation item in events)
            {
                if (!entities.Contains(item.obj1))
                {
                    entities.Add(item.obj1);
                }

                if (!entities.Contains(item.obj2))
                {
                    entities.Add(item.obj2);
                }
            }

            PresenceBase[] presences = new PresenceBase[entities.Count];

            // Initialize objects
            for (int x = 0; x < entities.Count; x++)
            {
                foreach (ListBoxItem item in this.windowObject.listBox1.Items)
                {
                    if (((tag)item.Tag).name == entities[x])
                    {
                        if (((tag)item.Tag).type == "Display")
                        {
                            presences[x] = this.space.GetDisplay(entities[x]);
                        }
                        else
                        {
                            presences[x] = this.space.GetPresence(entities[x]);
                        }

                        break;
                    }
                }
            }

            // Check if the objects are available in the Vicon software (with a timeout of 3 seconds)
            for (int x = 0; x < entities.Count; x++)
            {
                presences[x].WaitForEmbodiment(3);
            }

            //initialize relations
            this.startTime = DateTime.Now;

            //store objects info
            this.storeFirstInfo();

            foreach (relation item in events)
            {
                if (!relationsList.Contains(item.obj1 + item.obj2))
                {
                    relationsList.Add(item.obj1 + item.obj2);

                    RelationPair temp = new RelationPair(presences[entities.IndexOf(item.obj1)], presences[entities.IndexOf(item.obj2)],
                                                         RelationMonitor.Location | RelationMonitor.Pointing | RelationMonitor.Motion | RelationMonitor.Direction);

                    /*if(item.collision)
                     * {
                     *  temp.OnCollisionUpdatedAsynch += new CollisionRelationHandler(onCollisionUpdatedAsynch);
                     * }*/

                    if (item.pointing)
                    {
                        temp.OnPointingUpdatedAsynch += new PointingRelationHandler(onPointingUpdatedAsynch);
                    }

                    if (item.direction)
                    {
                        temp.OnDirectionUpdatedAsynch += new DirectionRelationHandler(onDirectionUpdatedAsynch);
                    }

                    if (item.location)
                    {
                        temp.OnLocationUpdatedAsynch += new LocationRelationHandler(onLocationUpdatedAsynch);
                    }

                    if (item.motion)
                    {
                        temp.OnMotionUpdatedAsynch += new MotionRelationHandler(onMotionUpdatedAsynch);
                    }

                    /*if (item.orientation)
                     * {
                     *  temp.OnOrientationUpdatedAsynch += new OrientationRelationHandler(onOrientationUpdatedAsynch);
                     * }
                     *
                     * if (item.rotation)
                     * {
                     *  temp.OnRotationUpdatedAsynch += new RotationRelationHandler(onRotationUpdatedAsynch);
                     * }*/

                    relations.Add(temp);
                }
            }

            recording.ShowDialog();
        }