Esempio n. 1
0
        private void btnLoadPrinters_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var cloudPrint = new GoogleCloudPrint("");
                cloudPrint.UserName = txtUsername.Text + "%40ridgewood%2Ek12%2Enj%2Eus";
                cloudPrint.Password = pwdPassword.Password;
                var printers = cloudPrint.Printers;
                int x        = 0;
                foreach (CloudPrinter printer in printers.printers)
                {
                    //name is the name of the printer on the system when added to google cloud print
                    //description is the comment of the printer in the Comment field on Windows. Mac shared printer was blank.

                    //Console.WriteLine(@"name:{0} description:{1}", printer.name, printer.description, printer.name);
                    //lstPrinters.Items.Add(String.Format(@"{0}", printer.name));

                    lstPrinters.Items.Add(printer.description);
                    allPrinters[x] = printer.description;
                    x++;
                }
                //Console.ReadLine();

                //CloudPrintJob job = cloudPrint.PrintDocument(printers.printers[0].id, "Title", FileToByteArray(@"page.pdf"), @"application/pdf");
                //Console.WriteLine(job.message);
            }
            catch
            {
                MessageBox.Show("Could not access API. Please make sure you aren't using your personal account.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 2
0
        // http://pastie.org/pastes/1733781/text
        public void TestGetPrinters()
        {
            var cloudPrint = new GoogleCloudPrint("");

            #region info
            cloudPrint.UserName = "******";
            cloudPrint.Password = "******";
            #endregion
            //var printers = new cloudPrint.Printers();
            //cloudPrint.Printers x = new cloudPrint.printers();
            var printers = cloudPrint.Printers;

            var printerList = printers.printers;
            foreach (var p in printerList)
            {
                lstPrinters.Items.Add(p.name);
            }

            /*foreach (var p in printers)
             * {
             *
             * }*/
        }