示例#1
0
        public FloatingActionButton()
        {
            SizeRequest = 40;
            AllowTap    = true;

            GestureRecognizers.Add(new TapGestureRecognizer {
                Command = new Command(() => {
                    if (TapAction != null)
                    {
                        TapAction.Dispatch();
                        return;
                    }

                    if (IsOpened)
                    {
                        IsOpened = false;
                        CloseAction.Dispatch();
                    }
                    else
                    {
                        IsOpened = true;
                        OpenAction.Dispatch();
                    }
                }, () => AllowTap)
            });
        }
示例#2
0
        static void Main(String[] args)
        {
            if (Application.Init() != InitError.Success)
            {
                return;
            }

            var stage  = new Stage();
            var image  = (Image)Image.New();
            var action = new TapAction();
            var text   = new Text();
            var pixbuf = new Pixbuf("redhand.png");

            stage.Name          = "Stage";
            stage.Title         = "Content Box";
            stage.UserResizable = true;
            stage.Destroyed    += (sender, e) => Application.MainQuit();
            stage.MarginTop     = 12;
            stage.MarginBottom  = 12;
            stage.MarginLeft    = 12;
            stage.MarginRight   = 12;
            stage.Show();

            image.SetData(pixbuf.Pixels,
                          pixbuf.HasAlpha ? Cogl.PixelFormat.Rgba8888 : Cogl.PixelFormat.Rgb888,
                          (uint)pixbuf.Width, (uint)pixbuf.Height, (uint)pixbuf.Rowstride);

            stage.SetContentScalingFilters(ScalingFilter.Trilinear, ScalingFilter.Linear);
            stage.ContentGravity = gravities.Last <ContentGravity>();
            stage.Content        = image;

            text.TextProp = "Content gravity: " + gravities.Last <ContentGravity>();
            text.AddConstraint(new AlignConstraint(stage, AlignAxis.Both, 0.5f));
            stage.AddChild(text);

            action.Tapped += (object o, TappedArgs arg) => {
                var actor = arg.Actor;

                actor.SaveEasingState();
                actor.ContentGravity = gravities [currentGravity];
                actor.RestoreEasingState();

                text.TextProp = "Content gravity: " + gravities [currentGravity];

                currentGravity++;
                if (currentGravity >= gravities.Count)
                {
                    currentGravity = 0;
                }
            };
            stage.AddAction(action);

            Application.Main();
        }
示例#3
0
        // This is executed in a new thread each time, so it is safe to use blocking calls
        protected override void OnIncomingCall(Call call)
        {
            AnswerResult resultAnswer = call.Answer();

            if (!resultAnswer.Successful)
            {
                Completed.Set();
                return;
            }

            UdpClient udpClient = new UdpClient(RTPPort);

            TapAction actionTap = call.TapAsync(
                new CallTap
            {
                Type       = CallTap.TapType.audio,
                Parameters = new CallTap.AudioParams
                {
                    Direction = CallTap.AudioParams.AudioDirection.both,
                }
            },
                new CallTapDevice
            {
                Type       = CallTapDevice.DeviceType.rtp,
                Parameters = new CallTapDevice.RTPParams
                {
                    Address = RTPAddr,
                    Port    = RTPPort,
                }
            }
                );

            IPEndPoint ipEndPoint = new IPEndPoint(IPAddress.Any, RTPPort);

            byte[] data = udpClient.Receive(ref ipEndPoint);
            Task <UdpReceiveResult> resultReceive = udpClient.ReceiveAsync();

            bool gotData = false;

            gotData = resultReceive.Wait(5000);

            if (gotData)
            {
                Logger.LogInformation("Received {0} RTP bytes", data.Length);
            }

            actionTap.Stop();

            HangupResult resultHangup = call.Hangup();

            Successful = gotData && actionTap.Result.Successful && resultHangup.Successful;
            Completed.Set();
        }
        /// <summary>
        ///     tap
        /// </summary>
        /// <returns><c>true</c>, if pressed was oned, <c>false</c> otherwise.</returns>
        /// <param name="config">Action.</param>
        /// <param name="tap">Action.</param>
        protected void OnTap(TapConfig config, bool tap = true)
        {
            if (config == null)
            {
                return;
            }

            var tapAction = new TapAction
            {
                KaraokeTapAction = config.KaraokeTapAction,
                Tap = tap
            };

            InputAction.Value = tapAction;
        }
示例#5
0
        void actionListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TapAction action = (TapAction)actionListBox.SelectedIndex;

            if (action == TapAction.AddMeasurement)
            {
                //When we open the Wi-Fi scan form from this 'dialog' we don't want to go back here (but rather to the offline map)
                //Therefore, we indicate to the wifi scan form that we come from here so we get skipped in the backStack
                string queryString = "?source=noget";
                string fullString  = Globals.XamlUri_WifiScanForm + queryString;
                this.NavigationService.Navigate(new Uri(fullString, UriKind.Relative));
            }
            else if (action == TapAction.EditLocation)
            {
                this.NavigationService.Navigate(new Uri(Globals.XamlUri_EditSymbolicLocation, UriKind.Relative));
            }
        }
 public override bool OnSingleTapUp(MotionEvent e)
 {
     TapAction?.Invoke(e);
     return(true);
 }
示例#7
0
 public void OnTapAction(Element element)
 {
     TapAction?.Invoke(element, new EventArgs());
 }