private IdentityPage(XmppConfiguration XmppConfiguration, Page Owner, LegalIdentity Identity, bool Personal, SignaturePetitionEventArgs Review)
        {
            this.xmppConfiguration = XmppConfiguration;
            this.owner             = Owner;
            this.identity          = Identity;
            this.personal          = Personal;
            this.review            = Review;

            this.BindingContext = this;
            InitializeComponent();

            byte[] Png = QR.GenerateCodePng("iotid:" + Identity.Id, (int)this.QrCode.WidthRequest, (int)this.QrCode.HeightRequest);
            this.QrCode.Source    = ImageSource.FromStream(() => new MemoryStream(Png));
            this.QrCode.IsVisible = true;

            if (!Personal)
            {
                this.IdentitySection.Remove(this.NetworkView);
                this.ButtonSection.Remove(this.CompromizedCell);
                this.ButtonSection.Remove(this.RevokeCell);
            }

            if (this.review is null)
            {
                this.ButtonSection.Remove(this.CarefulReviewCell);
                this.ButtonSection.Remove(this.ApprovePiiCell);
                this.ButtonSection.Remove(this.PinCell);
                this.ButtonSection.Remove(this.ApproveReviewCell);
                this.ButtonSection.Remove(this.RejectReviewCell);
            }

            this.LoadPhotos();
        }
示例#2
0
        // GET: api/QR/5
        /// <summary>
        /// wygeneruj kod qr dla existinigproduct
        /// </summary>
        /// <param name="id">existingproduct id</param>
        /// <returns></returns>
        public HttpResponseMessage GetQR(int id)
        {
            var existingProduct = db.ExistingProducts.Find(id);

            if (existingProduct == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            db.Entry(existingProduct).Reference(e => e.QR).Load();

            var qr = existingProduct.QR;

            if (qr == null)
            {
                qr = new QR
                {
                    ExistingProductId = existingProduct.Id,
                    ExistingProduct   = existingProduct
                };
                db.Entry(existingProduct).Reference(e => e.Product).Load();
                db.Entry(existingProduct.Product).Reference(p => p.Company).Load();
                qr.UpdateQR();
                db.QRs.Add(qr);
                db.SaveChanges();
            }

            var response = Request.CreateResponse();

            response.Content = new StreamContent(new MemoryStream(qr.Content));
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");

            return(response);
        }
示例#3
0
 public Form_wifi(QR _form_qr)
 {
     InitializeComponent();
     Region       = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr = _form_qr;
     form_qr.tb_description.Text = "Here you can create an Access Code for Wi-Fi point!";
 }
示例#4
0
        public ActionResult GenerarQR(int?AulaId)
        {
            if (AulaId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Aulas aula = db.Aulas.Find(AulaId);

            if (aula == null)
            {
                return(HttpNotFound());
            }

            var             nombreAula  = db.Aulas.Find(AulaId).NombreAula;
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            DateTime        hoy         = DateTime.Now.ToUniversalTime().AddHours(-6);
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode($"({nombreAula}/{hoy})", QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);
            QR newQR = new QR();

            using (Bitmap bitMap = qrCode.GetGraphic(20))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                    newQR.TextoQR = ms.ToArray();
                    newQR.Aula    = nombreAula;
                    //ViewBag.imageBytes = ms.ToArray();
                    //imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
                }
            }
            return(View(newQR));
        }
        private IdentityPage(XmppConfiguration XmppConfiguration, Page Owner, LegalIdentity Identity, bool Personal)
        {
            this.xmppConfiguration = XmppConfiguration;
            this.owner             = Owner;
            this.identity          = Identity;
            this.personal          = Personal;
            this.BindingContext    = this;
            InitializeComponent();

            byte[] Png = QR.GenerateCodePng("iotid:" + Identity.Id, (int)this.QrCode.WidthRequest, (int)this.QrCode.HeightRequest);
            this.QrCode.Source    = ImageSource.FromStream(() => new MemoryStream(Png));
            this.QrCode.IsVisible = true;

            this.CompromizedButton.IsVisible = Personal;
            this.RevokeButton.IsVisible      = Personal;

            if (!Personal)
            {
                this.IdentitySection.Remove(this.NetworkView);
                this.ButtonSection.Remove(this.CompromizedButtonView);
                this.ButtonSection.Remove(this.RevokeButtonView);
            }

            this.LoadPhotos();
        }
示例#6
0
    void Start()
    {
        Texture2D img = QR.GenerateBarcode("hello world!", (int)cRawImage.rectTransform.rect.width, (int)cRawImage.rectTransform.rect.width);

        cRawImage.texture = img;
        cRawImage.rectTransform.sizeDelta = new Vector2(img.width, img.height);
    }
 public override int GetHashCode()
 {
     unchecked
     {
         return(((QR != null ? QR.GetHashCode() : 0) * 397) ^ (Retrack != null ? Retrack.GetHashCode() : 0));
     }
 }
示例#8
0
        void btn_readQR_Clicked(object sender, EventArgs e)
        {
            QR qR = new QR();

            qR.IsSuccessfullyAdded += QR_IsSuccessfullyAdded;
            qR.ScanAsync();
        }
示例#9
0
 public Form_skype(QR _form_qr)
 {
     InitializeComponent();
     Region       = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr = _form_qr;
     form_qr.tb_description.Text = "Redirect to a call on Skype.";
 }
示例#10
0
        /// <summary>
        /// Barycentric Parameterization
        /// Covers barycentric methods which need a fully defined boundary
        /// A particular method can be chosen by creating an appropriate Laplacian matrix
        /// See also (Floater 2003)
        /// </summary>
        /// <param name="meshin">input mesh, after solving its texture coordinates in vertex traits will be adjusted</param>
        /// <param name="meshout">an flattened output mesh with only X,Y coordinates set, Z is set to 0</param>
        private void BarycentricMapping(TriangleMesh meshin, out TriangleMesh meshout)
        {
            /// init an mesh that serves for output of the 2d parametrized mesh
            meshout = meshin.Copy();
            //meshOut = meshIn;

            /// get lenghts
            var vertexCount      = meshout.Vertices.Count;
            var boundaryVertices = meshout.Vertices.Where(x => x.OnBoundary).ToList();

            /// right hand side (RHS)
            var bu = new double[vertexCount];
            var bv = new double[vertexCount];
            var b0 = new double[vertexCount];

            // TODO : For geometry images, L mapped edges require splitting. Adaptive length parameterization should be sufficient for crack prediction however
            FixBoundaryToShape(boundaryVertices, bu, bv);

            var laplacian = MeshLaplacian.SelectedLaplacian == MeshLaplacian.Type.Harmonic ?
                            MeshLaplacian.CreateBoundedHarmonicLaplacian(meshin, 1d, 0d, true) :
                            MeshLaplacian.SelectedLaplacian == MeshLaplacian.Type.MeanValue ?
                            MeshLaplacian.CreateBoundedMeanLaplacian(meshin, 1d, 0d, true) :
                            MeshLaplacian.CreateBoundedUniformLaplacian(meshin, 1d, 0d, true);

            var qrSolver = QR.Create(laplacian.Compress());
            var success  = qrSolver.Solve(bu) && qrSolver.Solve(bv);

            /// update mesh positions
            MeshLaplacian.UpdateMesh(meshout, bu, bv, b0, bu, bv);
            MeshLaplacian.UpdateMesh(meshin, bu, bv);
        }
示例#11
0
 public Form_link(QR _form_qr)
 {
     InitializeComponent();
     Region       = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr = _form_qr;
     form_qr.tb_description.Text = "In this function you associate a link to open with your QRCode.";
 }
示例#12
0
 //解析二维码
 private void Analysis()
 {
     if (isScanning)
     {
         lock (mutex)
         {
             tbuffer = buffer;
             buffer  = null;
         }
         if (tbuffer == null)
         {
             ;
         }
         else
         {
             string str = QR.DecodeColData(tbuffer, dw, dh);
             tbuffer = null;
             if (!string.IsNullOrEmpty(str) && OnQRScanned != null)
             {
                 ThreadPool.QueueUserWorkItem((obj) => {
                     if (OnQRScanned != null)
                     {
                         OnQRScanned(str);
                     }
                 });
             }
         }
     }
     tbuffer = null;
 }
        private async Task <byte[]> GetPDF(byte[] file, string id)
        {
            byte[] ret = null;

            string baseUrl = _configuration["baseUrl"];

            string inputFilename = @"wwwroot/pdf-template/cert.html";

            string imgsrc = $"data:image/png;base64,{QR.GetPureBase64($"{baseUrl}/Contract/Certificate?id={id}")}";

            HtmlDto dto = new HtmlDto()
            {
                html = System.Web.HttpUtility.HtmlEncode(
                    Encoding.UTF8.GetString(
                        System.IO.File.ReadAllBytes(inputFilename)))
                       .Replace("{certificateid}", id)
                       .Replace("{qrlink}", imgsrc),

                footerPath = $"{baseUrl}/pdf-template/footer.html"
            };

            string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(dto);

            string uri = _configuration["pdfApi"];

            var content = new StringContent(jsonString, Encoding.UTF8, "application/json");

            var response = await client.PostAsync($"{uri}", content).ConfigureAwait(false);

            var file2 = await response.Content.ReadAsByteArrayAsync();

            ret = Concat.DoConcat(file, file2);

            return(ret);
        }
示例#14
0
 public Form_onlyText(QR _form_qr)
 {
     InitializeComponent();
     Region       = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr = _form_qr;
     form_qr.tb_description.Text = "In this option you can create a QRCode with an Text for show when it's read.";
 }
示例#15
0
 public ScannQR(QR _form_qr)
 {
     InitializeComponent();
     Region               = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr         = _form_qr;
     filterInfoCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
 }
示例#16
0
        private void QrPicture_PrintPage(object sender, PrintPageEventArgs e) // Print Info Delegates
        {
            Bitmap printedQR = new Bitmap(QR.Width, QR.Height);

            QR.DrawToBitmap(printedQR, new Rectangle(0, 0, QR.Width, QR.Height));
            e.Graphics.DrawImage(printedQR, 0, 0);
        }
示例#17
0
 public Form_wpp(QR _form_qr)
 {
     InitializeComponent();
     Region                      = Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
     this.form_qr                = _form_qr;
     tb_message.Text             = "Message";
     form_qr.tb_description.Text = "Schedule a message to open your contact on WhatApp.";
 }
示例#18
0
 async void zobrazeni(object sender, SelectedItemChangedEventArgs e)
 {
     if (e.SelectedItem != null)
     {
         QR qr = e.SelectedItem as QR;
         await Navigation.PushAsync(new QRentry(true, qr.ID));
     }
 }
示例#19
0
        public ActionResult DeleteConfirmed(int id)
        {
            QR qR = db.QR.Find(id);

            db.QR.Remove(qR);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#20
0
        /// <summary>
        ///     Train.  Single iteration.
        /// </summary>
        public void Iteration()
        {
            int rowCount      = _trainingData.Count;
            int inputColCount = _trainingData[0].Input.Length;

            Matrix <double> xMatrix = new DenseMatrix(rowCount, inputColCount + 1);
            Matrix <double> yMatrix = new DenseMatrix(rowCount, 1);

            for (int row = 0; row < _trainingData.Count; row++)
            {
                BasicData dataRow = _trainingData[row];
                int       colSize = dataRow.Input.Count();

                xMatrix[row, 0] = 1;
                for (int col = 0; col < colSize; col++)
                {
                    xMatrix[row, col + 1] = dataRow.Input[col];
                }
                yMatrix[row, 0] = dataRow.Ideal[0];
            }

            // Calculate the least squares solution
            QR qr = xMatrix.QR();
            Matrix <double> beta = qr.Solve(yMatrix);

            double sum = 0.0;

            for (int i = 0; i < inputColCount; i++)
            {
                sum += yMatrix[i, 0];
            }
            double mean = sum / inputColCount;

            for (int i = 0; i < inputColCount; i++)
            {
                double dev = yMatrix[i, 0] - mean;
                _sst += dev * dev;
            }

            Matrix <double> residuals = xMatrix.Multiply(beta).Subtract(yMatrix);

            _sse = residuals.L2Norm() * residuals.L2Norm();

            for (int i = 0; i < _algorithm.LongTermMemory.Length; i++)
            {
                _algorithm.LongTermMemory[i] = beta[i, 0];
            }

            // calculate error
            _errorCalculation.Clear();
            foreach (BasicData dataRow in _trainingData)
            {
                double[] output = _algorithm.ComputeRegression(dataRow.Input);
                _errorCalculation.UpdateError(output, dataRow.Ideal, 1.0);
            }
            _error = _errorCalculation.Calculate();
        }
示例#21
0
        ////////////////////////////////////////////////////////////////////////

        protected override BitmapOutput RenderE(QR elem, Template tpl, DataMap data)
        {
            var text = elem.data.Parse(data);

            // generate QR

            var writer = new ZXing.QrCode.QRCodeWriter();
            var hints  = new Dictionary <ZXing.EncodeHintType, object>();

            hints[ZXing.EncodeHintType.MARGIN] = elem.margin;
            switch (elem.error)
            {
            case QR.Error.Low: hints[ZXing.EncodeHintType.ERROR_CORRECTION] = ZXing.QrCode.Internal.ErrorCorrectionLevel.L; break;

            case QR.Error.Med: hints[ZXing.EncodeHintType.ERROR_CORRECTION] = ZXing.QrCode.Internal.ErrorCorrectionLevel.M; break;

            case QR.Error.High: hints[ZXing.EncodeHintType.ERROR_CORRECTION] = ZXing.QrCode.Internal.ErrorCorrectionLevel.Q; break;

            case QR.Error.Max: hints[ZXing.EncodeHintType.ERROR_CORRECTION] = ZXing.QrCode.Internal.ErrorCorrectionLevel.H; break;
            }

            if (text == "")
            {
                text = "\0";
            }
            var code = writer.encode(text, ZXing.BarcodeFormat.QR_CODE, 0, 0, hints);
            var qr   = Helper.Create(code.Dimension, code.Dimension);

            for (int y = 0; y < qr.Height; ++y)
            {
                var row = code.getRow(y, null);
                for (int x = 0; x < qr.Width; ++x)
                {
                    var val = row.isRange(x, x + 1, true);
                    qr.SetPixel(x, y, val ? Color.Black : Color.White);
                }
            }

            // generate bitmap

            var size = elem.rect.CalcWH(new Vector(-1, -1));

            if (size.x < 0)
            {
                size.x = size.y;
            }
            else if (size.y < 0)
            {
                size.y = size.x;
            }

            if (size.x < 0)
            {
                size.x = size.y = code.Height * elem.pitch;
            }
            else if (elem.resize == QR.Resize.None) /* do nothing */ } {
示例#22
0
        async void delete_qr(object sender, EventArgs e)
        {
            if (ID_set)
            {
                QR qr = await App.Database.GetQRAsync(ID);

                await App.Database.DeleteQRAsync(qr);

                await Navigation.PopAsync();
            }
        }
        public ActionResult QRGenaration(int?GIId)
        {
            StoreService service = new StoreService();
            QR           qr      = new QR();
            GRNItemList  gi      = new GRNItemList();

            gi       = service.GetGRNItem(GIId);
            qr.GIId  = GIId;
            qr.GRNId = gi.GRNId;
            qr.PONo  = gi.PONo;
            qr.GIReceivedQuantity = gi.GIReceivedQuantity;
            return(View("QRGenaration", qr));
        }
示例#24
0
        //GET /api/qr/
        public Bitmap GetBitmap()
        {
            //  QR qr = new QR("200", "200", "http://www.google.com/");
            QR qr = new QR();

            byte[] data = File.ReadAllBytes(@"C:\Users\luisr\Desktop\QR\test.jpg");

            // Read in the data but do not close, before using the stream.
            Stream originalBinaryDataStream = new MemoryStream(data);
            Bitmap image = new Bitmap(originalBinaryDataStream);

            return(image);
        }
示例#25
0
        public virtual double[,] Solve(double[,] B)
        {
            if (B.RowCount() != QR.RowCount())
            {
                throw new ArgumentException("Row dimensions must agree.");
            }
            if (!IsFullRank)
            {
                throw new SystemException("Matrix is rank deficient.");
            }

            // Copy right hand side
            int nx = B.ColumnCount();

            double[,] X = B.Copy();

            // Compute Y = transpose(Q)*B
            for (int k = 0; k < QR.ColumnCount(); k++)
            {
                for (int j = 0; j < nx; j++)
                {
                    double s = 0.0;
                    for (int i = k; i < QR.RowCount(); i++)
                    {
                        s += QR[i, k] * X[i, j];
                    }
                    s = (-s) / QR[k, k];
                    for (int i = k; i < QR.RowCount(); i++)
                    {
                        X[i, j] += s * QR[i, k];
                    }
                }
            }
            // Solve R*X = Y;
            for (int k = QR.ColumnCount() - 1; k >= 0; k--)
            {
                for (int j = 0; j < nx; j++)
                {
                    X[k, j] /= Diagonal[k];
                }
                for (int i = 0; i < k; i++)
                {
                    for (int j = 0; j < nx; j++)
                    {
                        X[i, j] -= X[k, j] * QR[i, k];
                    }
                }
            }

            return(X.Submatrix(0, QR.ColumnCount() - 1, 0, nx - 1));
        }
示例#26
0
 public ActionResult Edit([Bind(Include = "ID_QR,ID_Cliente,ID_Departamento,ID_Tipo_QR,Fecha,Hora,ID_Estado_QR,Comentario")] QR qR)
 {
     if (ModelState.IsValid)
     {
         db.Entry(qR).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_Cliente      = new SelectList(db.Cliente, "ID_Cliente", "Cedula", qR.ID_Cliente);
     ViewBag.ID_Departamento = new SelectList(db.Departamento, "ID_Departamento", "Nombre", qR.ID_Departamento);
     ViewBag.ID_Estado_QR    = new SelectList(db.Estado_QR, "ID_Estado_QR", "Descripcion", qR.ID_Estado_QR);
     ViewBag.ID_Tipo_QR      = new SelectList(db.Tipo_QR, "ID_Tipo_QR", "Descripcion", qR.ID_Tipo_QR);
     return(View(qR));
 }
示例#27
0
        // GET: QRs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            QR qR = db.QR.Find(id);

            if (qR == null)
            {
                return(HttpNotFound());
            }
            return(View(qR));
        }
示例#28
0
        async void SaveQRresults(string QR_text)
        {
            var qr = new QR();

            qr.Name         = "";
            qr.QR_text      = QR_text;
            qr.Created      = false;
            qr.Date_created = DateTime.Now;
            await App.Database.SaveQRAsync(qr);

            int id = await App.Database.GetLastID();

            await Navigation.PushAsync(new QRentry(true, id));
        }
        public ActionResult Edit(Catalogos_viewModels.EquipoVM model)
        {
            var bdd = db.Equipos.Find(model.IdEquipo);

            bdd.IdEquipo    = model.IdEquipo;
            bdd.IdUsuario   = model.IdUsuario;
            bdd.SerieEquipo = model.SerieEquipo.Trim().ToUpper();
            bdd.Alias       = model.Alias.Trim().ToUpper();
            bdd.CodigoQR    = QR.GenerarQR(model.SerieEquipo);
            //AUDIT
            bdd.UsuarioModificacion = User.Identity.Name;
            bdd.FechaModificacion   = DateTime.Now;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#30
0
 // init
 public void init(int port, QR qr, int milisecondsForVibration = 500)
 {
     this.qr       = qr;
     puerto        = port;
     vibrationTime = milisecondsForVibration;
     listeners     = new List <InputMovileInterface>();
     receiveThread = new Thread(
         new ThreadStart(ReceiveData));
     receiveThread.IsBackground = true;
     receiveThread.Start();
     sendThread = new Thread(
         new ThreadStart(SendData));
     sendThread.IsBackground = true;
     sendThread.Start();
 }
示例#31
0
    public void SetLayer(int iLayer)
    {
        switch(iLayer)
        {
            case 0:
                _Renderer = _Background;
                break;

            case 1:
                _Renderer = _Foreground;
                break;

            case 2:
                _Renderer = _UI;
                break;
        }
    }
示例#32
0
    public static void Initialise(int iCount)
    {
        Debug.Log("Sprite initialise");

        if(_Pool == null)
        {
            _Pool = new LinkedList<Sprite>();
            _Active = new LinkedList<Sprite>();

            //GameObject pObject = GameObject.Find("BackgroundQuads");
            //_Background = pObject.GetComponent<QR>();

            GameObject pObject = GameObject.Find("ForegroundQuads");
            _Foreground = pObject.GetComponent<QR>();

            //pObject = GameObject.Find("UIQuads");
            //_UI = pObject.GetComponent<QR>();
        }

        for(int i = 0; i < iCount; ++i)
        {
            Sprite pSprite = new Sprite();
            _Pool.AddLast(pSprite);
        }
    }