Exemplo n.º 1
0
 private void lnkTakePicture_Click(object sender, EventArgs e)
 {
     Microsoft.WindowsMobile.Forms.CameraCaptureDialog ccd = new Microsoft.WindowsMobile.Forms.CameraCaptureDialog();
     ccd.Mode         = Microsoft.WindowsMobile.Forms.CameraCaptureMode.Still;
     ccd.Owner        = this;
     ccd.Resolution   = new Size(640, 480);
     ccd.StillQuality = Microsoft.WindowsMobile.Forms.CameraCaptureStillQuality.Normal;
     ccd.ShowDialog();
     this.trackBar1.Value = 5;
     this.LoadImage(ccd.FileName);
     ccd.Dispose();
 }
Exemplo n.º 2
0
 private void InsertPictureFromCamera()
 {
     if (!uploadingPicture)
     {
         String pictureUrl = string.Empty;
         String filename = string.Empty;
         try
         {
             using (Microsoft.WindowsMobile.Forms.CameraCaptureDialog c = new Microsoft.WindowsMobile.Forms.CameraCaptureDialog())
             {
                 if (c.ShowDialog() == DialogResult.OK)
                 {
                     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PostUpdate));
                     pictureFromStorage.Image = PockeTwit.Themes.FormColors.GetThemeIcon("existingimage.png");
                     if (DetectDevice.DeviceType == DeviceType.Standard)
                     {
                         pictureFromStorage.Visible = false;
                     }
                     uploadedPictureOrigin = "camera";
                     filename = c.FileName;                            
                 }
                 else //cancelled
                 {
                     pictureUsed = true;
                 }
             }
         }
         catch
         {
             PockeTwit.Localization.LocalizedMessageBox.Show("The camera is not available.", "PockeTwit");
             return;
         }
         if (string.IsNullOrEmpty(filename))
         {
             return; //no file selected, so don't upload
         }
         try
         {
             pictureService = GetMediaService(AccountToSet.ServerURL.ServerType);
             StartUpload(pictureService, filename);
         }
         catch
         {
             PockeTwit.Localization.LocalizedMessageBox.Show("Unable to upload picture.", "PockeTwit");
         }
     }
     else
     {
         PockeTwit.Localization.LocalizedMessageBox.Show("Uploading picture...");
     }
 }
Exemplo n.º 3
0
 private void InsertPictureFromCamera()
 {
     if (!uploadingPicture)
     {
         using (Microsoft.WindowsMobile.Forms.CameraCaptureDialog c = new Microsoft.WindowsMobile.Forms.CameraCaptureDialog())
         {
             String pictureUrl = string.Empty;
             try
             {
                 if (c.ShowDialog() == DialogResult.OK)
                 {
                     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PostUpdate));
                     this.pictureFromStorage.Image = PockeTwit.Themes.FormColors.GetThemeIcon("existingimage.png");
                     if (DetectDevice.DeviceType == DeviceType.Standard)
                     {
                         this.pictureFromStorage.Visible = false;
                     }
                     uploadedPictureOrigin = "camera";
                    
                     
                     pictureService = GetMediaService();
                     if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
                     {
                         AddPictureToForm(c.FileName, pictureFromCamers);
                         picturePath = c.FileName;
                         //Reduce length of message 140-pictureService.UrlLength
                         
                         pictureUsed = true;
                     }
                     else
                     {
                         AddPictureToForm(ClientSettings.IconsFolder() + "wait.png", pictureFromCamers);
                         uploadingPicture = true;
                         using (PicturePostObject ppo = new PicturePostObject())
                         {
                             ppo.Filename = c.FileName;
                             ppo.Username = AccountToSet.UserName;
                             ppo.Password = AccountToSet.Password;
                             ppo.UseAsync = false;
                             Cursor.Current = Cursors.WaitCursor;
                             pictureService.PostPicture(ppo);
                         }
                     }
                 }
             }
             catch
             {
                 MessageBox.Show("The camera is not available.", "PockeTwit");
             }
         }
     }
     else
     {
         MessageBox.Show("Uploading picture...");
     }
 }
Exemplo n.º 4
0
        private void InsertPictureFromCamera(bool video)
        {
            String pictureUrl = string.Empty;
            String filename = string.Empty;
            try
            {
                using (Microsoft.WindowsMobile.Forms.CameraCaptureDialog c = new Microsoft.WindowsMobile.Forms.CameraCaptureDialog())
                {
                    c.Owner = this;
                    if (video)
                    {
                        c.Mode = Microsoft.WindowsMobile.Forms.CameraCaptureMode.VideoWithAudio;
                        c.VideoTypes = Microsoft.WindowsMobile.Forms.CameraCaptureVideoTypes.Standard;
                    }
                    else
                        c.Mode = Microsoft.WindowsMobile.Forms.CameraCaptureMode.Still;
                    this.WindowState = FormWindowState.Normal;
                    if (c.ShowDialog() == DialogResult.OK)
                    {
                        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PostUpdate));
                        pictureFromStorage.Image = PockeTwit.Themes.FormColors.GetThemeIcon("existingimage", pictureFromStorage.Height);
                        if (DetectDevice.DeviceType == DeviceType.Standard)
                        {
                            pictureFromStorage.Visible = false;
                        }
                        filename = c.FileName;
                    }
                    else
                        return;
                    if(ClientSettings.IsMaximized)
                        this.WindowState = FormWindowState.Maximized;
                    c.Dispose();
                }
            }
            catch
            {
                PockeTwit.Localization.LocalizedMessageBox.Show("The camera is not available.", "PockeTwit");
                return;
            }
            if (string.IsNullOrEmpty(filename))
            {
                return; //no file selected, so don't upload
            }
            try
            {
                pictureService = GetMediaService();

                StartUpload(pictureService, filename, _AccountToSet);
            }
            catch
            {
                PockeTwit.Localization.LocalizedMessageBox.Show("Unable to upload picture.", "PockeTwit");
            }
        }