Пример #1
0
        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(AccountToSet.ServerURL.ServerType);
                    filename = SelectFileVisual(pictureService.FileFilter(MediaTypeGroup.ALL));

                    //if (pictureService.CanUploadOtherMedia)
                    //{
                    //    if (MessageBox.Show("Upload a picture (yes) or a file (no)?", "PockeTwit", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                    //    {
                    //        filename = SelectFileVisual(pictureService.FileFilter(MediaTypeGroup.PICTURE));
                    //    }
                    //    else
                    //    {
                    //        filename = SelectFileNormal(pictureService.FileFilter(MediaTypeGroup.ALL));
                    //    }
                    //}
                    //else
                    //{
                    //    filename = SelectFileVisual(pictureService.FileFilter(MediaTypeGroup.PICTURE));
                    //}

                    ComponentResourceManager resources = new ComponentResourceManager(typeof(PostUpdate));
                    pictureFromCamers.Image = FormColors.GetThemeIcon("takepicture.png");
                    if (DetectDevice.DeviceType == DeviceType.Standard)
                    {
                        pictureFromCamers.Visible = false;
                    }
                }
                catch
                {
                    PockeTwit.Localization.LocalizedMessageBox.Show("Unable to select picture.", "PockeTwit");
                }
                if  (string.IsNullOrEmpty(filename))
                {
                    pictureUsed = true;
                    return;
                }
                try
                {
                    uploadedPictureOrigin = "file";
                    StartUpload(pictureService, filename);
                }
                catch
                {
                    PockeTwit.Localization.LocalizedMessageBox.Show("Unable to upload picture.", "PockeTwit");
                } 
            }
            else
            {
                PockeTwit.Localization.LocalizedMessageBox.Show("Uploading picture...");
            }
        }