void startStopPushed(object sender, EventArgs ea)
        {
            if (!weAreRecording)
            {
                var screenSize   = UIScreen.MainScreen.Bounds;
                var screenWidth  = screenSize.Width;
                var screenHeight = screenSize.Height;

                var time = 16;

                timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromSeconds(1.0), delegate {
                    time -= 1;
                    if (time >= 10)
                    {
                        timerLabel.Text = "00:" + time.ToString();
                    }
                    else
                    {
                        timerLabel.Text = "00:0" + time.ToString();
                    }

                    if (time == 0)
                    {
                        StopRecording();
                    }
                });

                timer.Fire();

                var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                var library   = System.IO.Path.Combine(documents, "..", "Library");
                var urlpath   = System.IO.Path.Combine(library, "Report.mov");

                url = new NSUrl(urlpath, false);

                NSFileManager manager = new NSFileManager();
                NSError       error   = new NSError();

                if (manager.FileExists(urlpath))
                {
                    Console.WriteLine("Deleting File");
                    manager.Remove(urlpath, out error);
                    Console.WriteLine("Deleted File");
                }

                AVCaptureFileOutputRecordingDelegate avDel = new MyRecordingDelegate(cameraView, this, Element);
                output.StartRecordingToOutputFile(url, avDel);
                Console.WriteLine(urlpath);
                weAreRecording = true;
                btnStartRecording.SetImage(UIImage.FromFile("captureButton_red.png"), UIControlState.Normal);
                timer.Fire();
                View.AddSubview(timerLabel);
            }
            //we were already recording.  Stop recording
            else
            {
                StopRecording();
            }
        }
		public void Animate()
		{
			if (timer != null)
				timer.Invalidate();
			timer = NSTimer.CreateRepeatingScheduledTimer(ImageDuration, nextImage);
			timer.Fire();
		}
Exemplo n.º 3
0
 public void CancelCalibration()
 {
     if (isCalibrating)
     {
         isCalibrating = false;
         timer.Fire();
     }
 }
Exemplo n.º 4
0
 public void Animate()
 {
     if (timer != null)
     {
         timer.Invalidate();
     }
     timer = NSTimer.CreateRepeatingScheduledTimer(ImageDuration, nextImage);
     timer.Fire();
 }
Exemplo n.º 5
0
        public void Start()
        {
            _isRunning = true;
            var metronomeTimeInterval = (240.0 / (double)_model.Lower) / _model.CurrentBPM;

            _metronomeTimer = NSTimer.CreateScheduledTimer(metronomeTimeInterval, true, PlaySound);
            _metronomeTimer?.Fire();
#if DEBUG
            _testTimer.AutoReset = true;
            _testTimer.Enabled   = true;
#endif
        }
Exemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // device init
            GraphicsDeviceOptions options = new GraphicsDeviceOptions(false, null, false, ResourceBindingModel.Improved);

#if DEBUG
            options.Debug = true;
#endif
            SwapchainSource      ss  = SwapchainSource.CreateNSView(this.View.Handle);
            SwapchainDescription scd = new SwapchainDescription(
                ss,
                width, height,
                PixelFormat.R32_Float,
                false);

            graphicsDevice = GraphicsDevice.CreateMetal(options);
            swapchain      = graphicsDevice.ResourceFactory.CreateSwapchain(ref scd);
            factory        = graphicsDevice.ResourceFactory;

            // resource init
            CreateSizeDependentResources();
            VertexPosition[] quadVertices =
            {
                new VertexPosition(new Vector3(-1,  1, 0)),
                new VertexPosition(new Vector3(1,   1, 0)),
                new VertexPosition(new Vector3(-1, -1, 0)),
                new VertexPosition(new Vector3(1,  -1, 0))
            };
            uint[] quadIndices = new uint[]
            {
                0,
                1,
                2,
                1,
                3,
                2
            };
            vertexBuffer = factory.CreateBuffer(new BufferDescription(4 * VertexPosition.SizeInBytes, BufferUsage.VertexBuffer));
            indexBuffer  = factory.CreateBuffer(new BufferDescription(6 * sizeof(uint), BufferUsage.IndexBuffer));
            graphicsDevice.UpdateBuffer(vertexBuffer, 0, quadVertices);
            graphicsDevice.UpdateBuffer(indexBuffer, 0, quadIndices);

            commandList = factory.CreateCommandList();

            viewLoaded = true;

            displayTimer = NSTimer.CreateRepeatingTimer(60.0 / 1000.0, Render);
            displayTimer.Fire();
        }
Exemplo n.º 7
0
        private void StartTimer()
        {
            _clipboardTimer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromMilliseconds(500), delegate {
                var text = NSPasteboard.GeneralPasteboard.GetStringForType(NSPasteboard.NSPasteboardTypeString) ?? string.Empty;

                if (!_currentClipboardText.Equals(text) && DoesClipboardContainsText(NSPasteboard.GeneralPasteboard.Types))
                {
                    NSPasteboard.GeneralPasteboard.ClearContents();
                    NSPasteboard.GeneralPasteboard.DeclareTypes(new string[] { NSPasteboard.NSPasteboardTypeString }, null);
                    NSPasteboard.GeneralPasteboard.SetStringForType(text, NSPasteboard.NSPasteboardTypeString);
                    _currentClipboardText = text;
                    Console.WriteLine($"Overwritten: {text}");
                }

                Console.WriteLine($"Clipboard: {text}");
            });

            _clipboardTimer.Fire();
        }
Exemplo n.º 8
0
        public void InsertUI()
        {
            this.Title = jsonPromos.titulo;

            /*
             * promoImage = jsonPromos.imagen;
             * byte[] bytes = Convert.FromBase64String (promoImage);
             * NSData data = NSData.FromArray (bytes);
             * var uiImage = UIImage.LoadFromData (data);
             * uiImagePromo.Image = uiImage;
             *
             */
            //tiempoAhora = DateTime.Now;
            //DateTime tiempoRestante = (jsonPromos.fechaVencimiento - tiempoAhora).TotalDays;



            NSTimer timer = NSTimer.CreateRepeatingScheduledTimer(TimeSpan.FromSeconds(0.1), delegate {
                tiempoAhora = DateTime.Now;
                if (tiempoAhora < jsonPromos.fechaVencimiento)
                {
                    tiempoRestante = (jsonPromos.fechaVencimiento - tiempoAhora);
                    tiempos        = String.Format("{0} dias, {1}:{2}:{3}",
                                                   tiempoRestante.Days, tiempoRestante.Hours, tiempoRestante.Minutes, tiempoRestante.Seconds);
                    //lbTimer.Text = tiempos;
                    //lbCountdown.Text = tiempos;
                    btnCountdown.Title = tiempos;
                }
                else
                {
                    btnCountdown.Title = "Promocion finalizada";
                }
            });

            timer.Fire();
            InsertUIImage();
            loadLocalDatabase();
            var attrString = new NSAttributedString("$" + jsonPromos.precio.ToString(), new UIStringAttributes {
                StrikethroughStyle = NSUnderlineStyle.Single
            });

            lbTituloPromo.Text       = jsonPromos.titulo;
            txtDescr.Text            = jsonPromos.descripcion;
            lbPrecioA.AttributedText = attrString;
            lbPrecioB.Text           = (jsonPromos.descuento * 100).ToString() + "%";
            lbPrecioTotal.Text       = "$" + (jsonPromos.precio - (jsonPromos.precio * jsonPromos.descuento)).ToString();
            Favorites fav = null;

            try{
                fav = db.Get <Favorites>(jsonPromos.idPromocion);
            }
            catch (Exception ex) {
                Console.WriteLine("Fav no existente: {0}", ex.StackTrace);
                _btnFav.SetImage(UIImage.FromFile("star-grey45.png"), UIControlState.Normal);
                favorite = 0;
            }

            if (fav != null)
            {
                Console.WriteLine("Fav existente ");
                _btnFav.SetImage(UIImage.FromFile("star-gold45.png"), UIControlState.Normal);
                favorite = 1;
            }

            _btnFav.SetImage(UIImage.FromFile("star-gold45.png"), UIControlState.Highlighted);
            _btnFav.TouchUpInside += delegate {
                var newFav = new Favorites(jsonPromos.idPromocion, jsonPromos.titulo);
                if (favorite == 0)
                {
                    _btnFav.SetImage(UIImage.FromFile("star-gold45.png"), UIControlState.Normal);
                    favorite  = 1;
                    newFav.Id = jsonPromos.idPromocion;
                    var rowcount = db.Insert(newFav);;
                    Console.WriteLine("Fav agregado {0}", rowcount);
                }
                else
                {
                    _btnFav.SetImage(UIImage.FromFile("star-grey45.png"), UIControlState.Normal);
                    favorite = 0;
                    var rowcount = db.Delete <Favorites>(newFav.Id);
                    Console.WriteLine("Fav eliminado, afectados: {0} ", rowcount);
                }
            };
        }