当前位置: 首页>>代码示例>>C#>>正文


C# IPictureService.PostPicture方法代码示例

本文整理汇总了C#中IPictureService.PostPicture方法的典型用法代码示例。如果您正苦于以下问题:C# IPictureService.PostPicture方法的具体用法?C# IPictureService.PostPicture怎么用?C# IPictureService.PostPicture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPictureService的用法示例。


在下文中一共展示了IPictureService.PostPicture方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InsertPictureFromFile

        private void InsertPictureFromFile()
        {
            if (!uploadingPicture)
            {
                String pictureUrl = string.Empty;
                using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
                {
                    if (s.ShowDialog() == DialogResult.OK)
                    {
                        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PostUpdate));
                        this.pictureFromCamers.Image = PockeTwit.Themes.FormColors.GetThemeIcon("takepicture.png");
                        if (DetectDevice.DeviceType == DeviceType.Standard)
                        {
                            this.pictureFromCamers.Visible = false;
                        }
                        uploadedPictureOrigin = "file";

                        pictureService = GetMediaService();
                        if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
                        {
                            AddPictureToForm(s.FileName, pictureFromStorage);
                            picturePath = s.FileName;
                            //Reduce length of message 140-pictureService.UrlLength
                            pictureUsed = true;
                        }
                        else
                        {
                            uploadingPicture = true;
                            AddPictureToForm(ClientSettings.IconsFolder() + "wait.png", pictureFromStorage);
                            using (PicturePostObject ppo = new PicturePostObject())
                            {
                                ppo.Filename = s.FileName;
                                ppo.Username = AccountToSet.UserName;
                                ppo.Password = AccountToSet.Password;
                                ppo.UseAsync = false;
                                Cursor.Current = Cursors.WaitCursor;
                                pictureService.PostPicture(ppo);
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Uploading picture...");
            }
        }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:47,代码来源:PostUpdate.cs

示例2: InsertPictureFromFile

 private void InsertPictureFromFile()
 {
     if (!uploadingPicture)
     {
         String pictureUrl = string.Empty;
         String filename = string.Empty;
         //using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
         try
         {
             pictureService = GetMediaService();
             using (Microsoft.WindowsMobile.Forms.SelectPictureDialog s = new Microsoft.WindowsMobile.Forms.SelectPictureDialog())
             {
                 //s.Filter = string.Empty; //all files //pictureService.FileFilter;
                 s.Filter = pictureService.FileFilter;
                 
                 if (s.ShowDialog() == DialogResult.OK)
                 {
                     filename = s.FileName;
                     ComponentResourceManager resources = new ComponentResourceManager(typeof(PostUpdate));
                     pictureFromCamers.Image = FormColors.GetThemeIcon("takepicture.png");
                     if (DetectDevice.DeviceType == DeviceType.Standard)
                     {
                         pictureFromCamers.Visible = false;
                     }
                     uploadedPictureOrigin = "file";
                 }
                 else //cancelled
                 {
                     pictureUsed = true;
                 }
             }
         }
         catch
         {
             MessageBox.Show("Unable to select picture.", "PockeTwit");
         }
         if  (string.IsNullOrEmpty(filename))
         {
             return;
         }
         try
         {
             if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
             {
                 AddPictureToForm(filename, pictureFromStorage);
                 picturePath = filename;
                 //Reduce length of message 140-pictureService.UrlLength
                 pictureUsed = true;
             }
             else
             {
                 uploadingPicture = true;
                 AddPictureToForm(FormColors.GetThemeIconPath("wait.png"), pictureFromStorage);
                 using (PicturePostObject ppo = new PicturePostObject())
                 {
                     ppo.Filename = filename;
                     ppo.Username = AccountToSet.UserName;
                     ppo.Password = AccountToSet.Password;
                     ppo.UseAsync = false;
                     Cursor.Current = Cursors.WaitCursor;
                     pictureService.PostPicture(ppo);
                 }
             }
         }
         catch
         {
             MessageBox.Show("Unable to upload picture.", "PockeTwit");
         } 
     }
     else
     {
         MessageBox.Show("Uploading picture...");
     }
 }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:74,代码来源:PostUpdate.cs

示例3: DoUpload

        private bool DoUpload(IPictureService Service, UploadAttachment a)
        {
            PicturePostObject ppo = new PicturePostObject();
            if(a.MediaType != null)
                ppo.ContentType = a.MediaType.ContentType;
            if (a.Position != null)
            {
                ppo.Lat = a.Position.Lat.ToString(System.Globalization.CultureInfo.InvariantCulture);
                ppo.Lon = a.Position.Lat.ToString(System.Globalization.CultureInfo.InvariantCulture);
            }
            ppo.Message = a.Caption;
            //ppo.PictureStream = a.Contents;
            ppo.Filename = a.Name;
            ppo.UseAsync = false;

            // This is only temporary -> PostUpdate form has event handlers reg'd
            a.Status = UploadAttachment.AttachmentStatus.Uploading;
            Service.PostPicture(ppo, Account);
            if (!string.IsNullOrEmpty(ppo.URL))
            {
                a.UploadedUri = new Uri(ppo.URL);
                a.Status = UploadAttachment.AttachmentStatus.Complete;
            }
            else
            {
                a.Status = UploadAttachment.AttachmentStatus.Error;
            }
            return true;
        }
开发者ID:enersia,项目名称:pocketwit,代码行数:29,代码来源:AttachmentUploadManager.cs

示例4: InsertPictureFromCamera

 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
         {
             MessageBox.Show("The camera is not available.", "PockeTwit");
             return;
         }
         if (string.IsNullOrEmpty(filename))
         {
             return; //no file selected, so don't upload
         }
         try
         {
             pictureService = GetMediaService();
             if (pictureService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
             {
                 AddPictureToForm(filename, pictureFromCamers);
                 picturePath = filename;
                 //Reduce length of message 140-pictureService.UrlLength
                 pictureUsed = true;
             }
             else
             {
                 AddPictureToForm(FormColors.GetThemeIconPath("wait.png"), pictureFromCamers);
                 uploadingPicture = true;
                 using (PicturePostObject ppo = new PicturePostObject())
                 {
                     ppo.Filename = filename;
                     ppo.Username = AccountToSet.UserName;
                     ppo.Password = AccountToSet.Password;
                     ppo.UseAsync = false;
                     Cursor.Current = Cursors.WaitCursor;
                     pictureService.PostPicture(ppo);
                 }
             }
         }
         catch
         {
             MessageBox.Show("Unable to upload picture.", "PockeTwit");
         }
     }
     else
     {
         MessageBox.Show("Uploading picture...");
     }
 }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:71,代码来源:PostUpdate.cs

示例5: StartUpload

 private void StartUpload(IPictureService mediaService, String fileName)
 {
     if (mediaService.CanUploadMessage && ClientSettings.SendMessageToMediaService)
     {
         AddPictureToForm(fileName, pictureFromStorage);
         picturePath = fileName;
         //Reduce length of message 140-pictureService.UrlLength
         pictureUsed = true;
     }
     else
     {
         uploadingPicture = true;
         AddPictureToForm(FormColors.GetThemeIconPath("wait.png"), pictureFromStorage);
         using (PicturePostObject ppo = new PicturePostObject())
         {
             ppo.Filename = fileName;
             ppo.Username = AccountToSet.UserName;
             ppo.Password = AccountToSet.Password;
             ppo.UseAsync = false;
             Cursor.Current = Cursors.WaitCursor;
             mediaService.PostPicture(ppo);
         }
     }
 }
开发者ID:JakeStevenson,项目名称:PockeTwit,代码行数:24,代码来源:PostUpdate.cs


注:本文中的IPictureService.PostPicture方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。