コード例 #1
0
        void aprirePopupQrCodeInvioCassa()
        {
            InputBoxDialog d = new InputBoxDialog();

            d.inputValue.Text = DateTime.Today.ToString("yyyy-MM-dd");
            d.Title           = "Inserire data riferimento (AAAA-MM-GG)";
            bool?esito = d.ShowDialog();

            if (esito != true)
            {
                return;
            }

            DateTime dataFinale = DateTime.ParseExact(d.inputValue.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture);


            var chiusure = riempireDtoChiusure(dataFinale);

            if (chiusure == null)
            {
                dialogProvider.ShowMessage("Nessun dato estratto negli ultimi " + GIORNI_INDIETRO_CHIUSURE + " giorni", "Nessun dato");
                return;
            }


            string messaggio = chiusure.serializeToPiccolaString();

            // Aggiungo un crc di sicurezza
            Crc16  chk   = new Crc16();
            ushort crc16 = chk.ComputeChecksum(Encoding.ASCII.GetBytes(messaggio));

            // aggiungo un prefisso che è un comando per telegram che vado ad implementare
            string qrCode = "/cc " + messaggio + "!" + crc16.ToString("X4");

            string nomeFileTemp = Path.Combine(Path.GetTempPath(), "qrcode-cassa.ser.txt");

            File.WriteAllBytes(nomeFileTemp, Encoding.ASCII.GetBytes(qrCode));

            // Apro la popup lanciando un evento
            var ea = new OpenPopupRequestEventArgs {
                requestName = "QRcodeChiusureCassaPopup",
                param       = qrCode
            };

            RaisePopupDialogRequest(ea);

            if (ea.mioDialogResult == true)
            {
            }
        }
コード例 #2
0
        /// <summary>
        /// Apro la finestra di popup per la ricostruzione del database
        /// </summary>
        void aprirePopupRicostruzioneDb()
        {
            using (DbRebuilderViewModel dbRebuilderViewModel = new DbRebuilderViewModel()) {
                var oprea = new OpenPopupRequestEventArgs {
                    requestName = "RicostruzioneDbPopup",
                    viewModel   = dbRebuilderViewModel
                };

                RaisePopupDialogRequest(oprea);

                if (oprea.mioDialogResult == true)
                {
                }
            }
        }
コード例 #3
0
        private void _mainWindowViewModel_openPopupDialogRequest(object sender, EventArgs e)
        {
            if (e is OpenPopupRequestEventArgs)
            {
                OpenPopupRequestEventArgs popEventArgs = (OpenPopupRequestEventArgs)e;
                if (popEventArgs.requestName == "RicostruzioneDbPopup")
                {
                    DbRebuilderWiew win = new DbRebuilderWiew();

                    // Imposto la finestra contenitore per poter centrare
                    win.Owner = this;

                    // Questo è il viewmodel della finestra di popup
                    win.DataContext = popEventArgs.viewModel;

                    var esito = win.ShowDialog();

                    if (esito == true)
                    {
                        // TODO
                    }

                    win.Close();
                }



                if (popEventArgs.requestName == "QRcodeChiusureCassaPopup")
                {
                    QRcodeWindow win = new QRcodeWindow();

                    // Imposto la finestra contenitore per poter centrare
                    win.Owner = this;

                    // Questo è il QR code
                    win.DataContext = popEventArgs.param;

                    var esito = win.ShowDialog();

                    win.Close();
                }
            }
        }
コード例 #4
0
        private void viewModel_openPopupDialogRequest(object sender, EventArgs e)
        {
            OpenPopupRequestEventArgs eaPop = (OpenPopupRequestEventArgs)e;

            if (eaPop.requestName == "QRcodeSelfServicePopup")
            {
                QRcodeWindow win = new QRcodeWindow();

                // Imposto la finestra contenitore per poter centrare
                win.Owner = this.parentWindow;
                win.Title = "Indirizzo web self-service";

                win.DataContext = eaPop.param;

                var esito = win.ShowDialog();

                eaPop.mioDialogResult = esito;

                win.Close();
            }

            if (eaPop.requestName == "ScegliMasterizzaTargetPopup")
            {
                ScegliMasterizzaTarget win = new ScegliMasterizzaTarget();

                // Imposto la finestra contenitore per poter centrare
                win.Owner = this.parentWindow;

                // Questo è il viewmodel della finestra di popup
                win.DataContext = eaPop.viewModel;

                var esito = win.ShowDialog();

                eaPop.mioDialogResult = esito;

                win.Close();
            }
        }
コード例 #5
0
ファイル: ViewModelBase.cs プロジェクト: digiPHOTO-it/lumen
 protected virtual void RaisePopupDialogRequest(OpenPopupRequestEventArgs eventArgs)
 {
     _openPopupDialogRequest?.Invoke(this, eventArgs);
 }