Ejemplo n.º 1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (isrecording)
            {
                DialogResult dr = MessageBox.Show("Screen is recording. \nAre you sure close Application.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    isrecording = false;
                    istopped    = true;
                    this.Text   = "Recording Stopped.";
                    timer1.Stop();
                    time = 0;
                    MainWindowViewModel.StopRecording();
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }

            if (!closedByCode)
            {
                DLOperation dLOperation = new DLOperation();
                dLOperation.SaveEntry(ClsCommon.UserId, "", 3);
                Environment.Exit(1);
            }
        }
Ejemplo n.º 2
0
        void UploadVideo()
        {
            UploadToAzure uploadToAzure = new UploadToAzure();

            using (var file = File.OpenRead(Program.Localpath + "//output.mp4"))
            {
                int bytesRead;
                var buffer = new byte[file.Length];
                while ((bytesRead = file.Read(buffer, 0, buffer.Length)) > 0)
                {
                }

                byte[][] vs         = BufferSplit(buffer, chunkSize);
                long     filesize   = file.Length;
                long     totalChunk = vs.Length;
                string   FileName   = Guid.NewGuid().ToString();
                uploadToAzure.SetMetadata((int)totalChunk, FileName, filesize, "");
                for (int i = 0; i < totalChunk; i++)
                {
                    CurrentChunk = i + 1;
                    var res = uploadChunk(vs[i]);
                    Thread.Sleep(10);
                    if (res.isLastBlock)
                    {
                        timer1.Enabled = false;
                        DLOperation dLOperation = new DLOperation();
                        dLOperation.SaveEntry(ClsCommon.UserId, Program.cloudFile.BlockBlob.SnapshotQualifiedStorageUri.PrimaryUri.ToString(), 2);
                    }
                }
            }
            Environment.Exit(1);
        }
Ejemplo n.º 3
0
 void GetConfig()
 {
     base.Invoke(new MethodInvoker(() => {
         DLOperation DLOperation = new DLOperation();
         DLOperation.exeConfig();
         LastActiveTimer.Interval = ClsCommon.Interval;
         LastActiveTimer.Start();
     }));
     //  LastActiveTimer. = ClsCommon.Interval;
 }
Ejemplo n.º 4
0
        void Lastactive()
        {
            DLOperation      dLOperation      = new DLOperation();
            LastActiveResult lastActiveResult = dLOperation.checkLastActive();

            if (lastActiveResult.IsLogged)
            {
                if (lastActiveResult.Seconds >= ClsCommon.TimeToexit)
                {
                    Environment.Exit(1);
                }
            }
            else
            {
                Environment.Exit(1);
            }
        }
Ejemplo n.º 5
0
 void GetDevices()
 {
     MainWindowView = new MainWindowViewModel();
     filterInfos    = MainWindowView.GetVideoDevices();
     if (filterInfos == null || filterInfos.Count == 0)
     {
         DLOperation dLOperation = new DLOperation();
         dLOperation.SaveEntry(ClsCommon.UserId, "", 3);
         MessageBox.Show("Webcam not available");
         Environment.Exit(1);
     }
     else
     {
         foreach (var item in filterInfos)
         {
             cmbWebCamera.Items.Add(item.Name);
         }
         cmbWebCamera.SelectedIndex = 0;
     }
 }
Ejemplo n.º 6
0
 private void VideoPreview_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!isclosedbycode)
     {
         DialogResult dialog = MessageBox.Show("Your recording will not be saved. Continue?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (dialog == DialogResult.Yes)
         {
             if (CheckForInternetConnection())
             {
                 DLOperation dLOperations = new DLOperation();
                 dLOperations.SaveEntry(ClsCommon.UserId, "", 3);
             }
             Environment.Exit(1);
         }
         else
         {
             e.Cancel = true;
             return;
         }
     }
 }
Ejemplo n.º 7
0
        private void RecordVideo_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_recorder)
            {
                DialogResult dr = MessageBox.Show("Video is recording. \n Are you sure close Application.", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    timerRecordTime.Enabled = false;
                    timerRecordTime.Stop();
                    try
                    {
                        _recorder = false;
                        this.Text = "Recording Stopped.";
                        MainWindowView.StopRecording();
                        //  MainWindowView.StopCamera();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + "\n\n" + ex.ToString());
                    }
                }
                else
                {
                    e.Cancel = true;
                    return;
                }
            }


            if (!ClosedByCode)
            {
                DLOperation dLOperation = new DLOperation();
                dLOperation.SaveEntry(ClsCommon.UserId, "", 3);
                MainWindowView.StopCamera();
                Application.Exit();
            }
        }
Ejemplo n.º 8
0
        void UploadVideo()
        {
            UploadToAzure uploadToAzure = new UploadToAzure();

            using (var file = File.OpenRead(Program.Localpath + "//output.mp4"))
            {
                int bytesRead;
                var buffer = new byte[file.Length];
                while ((bytesRead = file.Read(buffer, 0, buffer.Length)) > 0)
                {
                }

                byte[][] vs         = BufferSplit(buffer, chunkSize);
                long     filesize   = file.Length;
                long     totalChunk = vs.Length;
                string   FileName   = Guid.NewGuid().ToString();
                uploadToAzure.SetMetadata((int)totalChunk, FileName, filesize, "");
                for (int i = 0; i < totalChunk; i++)
                {
                    CurrentChunk = i + 1;
                    var res = uploadChunk(vs[i]);
                    Thread.Sleep(10);
                    if (res.isLastBlock)
                    {
                        // timer1.Enabled = false;
                        DLOperation dLOperation = new DLOperation();
                        dLOperation.SaveEntry(ClsCommon.UserId, Program.cloudFile.BlockBlob.SnapshotQualifiedStorageUri.PrimaryUri.ToString(), 2);
                    }
                    int percent = (CurrentChunk * 100 / (int)totalChunk);
                    progressBar1.Invoke(new MethodInvoker(() => { progressBar1.Value = percent; progressBar1.Update(); }));
                    lblProgress.Invoke(new MethodInvoker(() => { lblProgress.Text = percent.ToString() + " %"; lblProgress.Update(); }));
                }
            }
            this.Invoke(new MethodInvoker(() => { MessageBox.Show(this, "Content Captured. Press OK to continue submission."); }));
            Environment.Exit(1);
        }
Ejemplo n.º 9
0
        static void SaveLog()
        {
            DLOperation dLOperation = new DLOperation();

            dLOperation.SaveEntry(ClsCommon.UserId, "", 1);
        }