internal static void MakeVideoCall(string primaryId, UIElementCollection uiElementCollection, int timeoutInSeconds, string secondaryId = null)
 {
     CommunicationView commView = new CommunicationView(primaryId, timeoutInSeconds);
     uiElementCollection.Add(commView);
     commView.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
     commView.VerticalAlignment = System.Windows.VerticalAlignment.Center;
     commView.Width = 700;
     commView.Height = 400;
     commView.CommunicationEnded += (p1, p2) =>
     {
         if (commView.TimedOut &&
             string.IsNullOrEmpty(secondaryId)==false)
         {
             commView.InitializeUI(secondaryId);
             secondaryId = null;
             return;
         }
         else
         {
             commView.Visibility = Visibility.Collapsed;
         uiElementCollection.Remove(commView);
         }
     };
 }
Exemple #2
0
 public void RemoveFrom(UIElementCollection collection)
 {
     collection.Remove(circle);
 }
Exemple #3
0
        public void AdvanceFrame(UIElementCollection children, bool instructing/*, List<ShoopDoup.Models.DataObject> data*/)
        {
            // Move all things by one step, accounting for gravity
            for (int i = 0; i < things.Count; i++)
            {
                Thing thing = things[i];
                Image apple = apples[i];
                Label label = appleLabels[i];

                thing.center.Offset(thing.xVelocity, thing.yVelocity);
                thing.yVelocity += gravity * sceneRect.Height;
                thing.yVelocity *= airFriction;
                thing.xVelocity *= airFriction;
                thing.theta += thing.spinRate;

                if (thing.state != ThingState.Dissolving)
                {
                    apple.SetValue(Canvas.LeftProperty, thing.center.X - thing.size);
                    apple.SetValue(Canvas.TopProperty, thing.center.Y-25);
                    label.SetValue(Canvas.LeftProperty, thing.center.X - thing.size*.84);
                    label.SetValue(Canvas.TopProperty, thing.center.Y);
                    label.SetValue(Canvas.ZIndexProperty, 100);
                }

                // bounce off walls
                if ((thing.center.X - thing.size < 0) || (thing.center.X + thing.size > sceneRect.Width))
                {
                    thing.xVelocity = -thing.xVelocity;
                    thing.center.X += thing.xVelocity;
                }

                // Then get rid of one if any that fall off the bottom
                if (thing.center.Y - thing.size > sceneRect.Bottom)
                {
                    thing.state = ThingState.Remove;
                }

                // Get rid of after dissolving.
                if (thing.state == ThingState.Dissolving)
                {
                        thing.state = ThingState.Remove;
                }
                things[i] = thing;
                apples[i] = apple;
                appleLabels[i] = label;
            }

            // Then remove any that should go away now
            for (int i = 0; i < things.Count; i++)
            {
                Thing thing = things[i];
                Image apple = apples[i];
                Label label = appleLabels[i];
                //double appleLocation = appleLocations[i];
                //String text = labelText[i];
                if (thing.state == ThingState.Remove)
                {
                    things.Remove(thing);
                    apples.Remove(apple);
                    appleLabels.Remove(label);
                    //appleLocations.Remove(appleLocation);
                    //labelText.Remove(text);
                    children.Remove(apple);
                    children.Remove(label);
                    i--;
                }
            }

            // Create any new things to drop based on dropRate
            if (!instructing && (things.Count < maxThings) && (rnd.NextDouble() < dropRate / targetFrameRate) && (polyTypes != PolyType.None))
            {
                PolyType[] alltypes = {PolyType.Square};
                byte r = baseColor.R;
                byte g = baseColor.G;
                byte b = baseColor.B;

                if (doRandomColors)
                {
                    r = (byte)(rnd.Next(215) + 40);
                    g = (byte)(rnd.Next(215) + 40);
                    b = (byte)(rnd.Next(215) + 40);
                }
                else
                {
                    r = (byte)(Math.Min(255.0, (double)baseColor.R * (0.7 + rnd.NextDouble() * 0.7)));
                    g = (byte)(Math.Min(255.0, (double)baseColor.G * (0.7 + rnd.NextDouble() * 0.7)));
                    b = (byte)(Math.Min(255.0, (double)baseColor.B * (0.7 + rnd.NextDouble() * 0.7)));
                }

                PolyType tryType = PolyType.None;
                do
                {
                    tryType = alltypes[rnd.Next(alltypes.Length)];
                } while ((polyTypes & tryType) == 0);

                DropNewThing(tryType, shapeSize, 0,Color.FromRgb(r, g, b),children, null /*,data*/);
            }
        }
 public void draw(UIElementCollection _element)
 {
     _element.Remove(LeaderBoardCanvas);
     LeaderBoardCanvas.Children.Clear();
     LeaderBoardCanvas.Children.Add(lbRectangle);
     LeaderBoardCanvas.Children.Add(LeaderBoardHeader);
     LeaderBoardCanvas.Children.Add(lbline);
     for (int i = 0; i < 10; i++)
     {
         LeaderBoardCanvas.Children.Add(LBList[i].lbName);
         LeaderBoardCanvas.Children.Add(LBList[i].lbScore);
     }
     LeaderBoardCanvas.Children.Add(lbButton);
     _element.Add(LeaderBoardCanvas);
 }
Exemple #5
0
 public void RemoveFrom(UIElementCollection collection)
 {
     collection.Remove(line1);
     collection.Remove(line2);
 }
Exemple #6
0
 public void RemoveFrom(UIElementCollection collection)
 {
     collection.Remove(rectangle);
 }