private void deletePicture()
        {
            if (listview_Dropbox_uploads.SelectedItems != null && listview_Dropbox_uploads.SelectedItems.Count > 0)
            {
                for (int i = 0; i < listview_Dropbox_uploads.SelectedItems.Count; i++)
                {
                    DropboxInfo  imgurInfo = (DropboxInfo)listview_Dropbox_uploads.SelectedItems[i].Tag;
                    DialogResult result    = MessageBox.Show(lang.GetFormattedString(LangKey.delete_question, imgurInfo.Title), lang.GetFormattedString(LangKey.delete_title, imgurInfo.ID), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(DropboxPlugin.Attributes.Name, lang.GetString(LangKey.communication_wait));
                        try
                        {
                            DropboxUtils.DeleteDropboxImage(imgurInfo);
                        }
                        catch (Exception ex)
                        {
                            LOG.Warn("Problem communicating with Dropbox: ", ex);
                        }
                        finally
                        {
                            backgroundForm.CloseDialog();
                        }

                        imgurInfo.Dispose();
                    }
                }
            }
            redraw();
        }
        public bool TryGetRepositoryInfo(HttpRequest request, JObject payload, out RepositoryInfo repositoryInfo)
        {
            repositoryInfo = null;
            if (!String.IsNullOrEmpty(payload.Value<string>("NewCursor")))
            {
                repositoryInfo = new DropboxInfo(payload);
            }

            return repositoryInfo != null;
        }
        private void openPicture()
        {
            if (listview_Dropbox_uploads.SelectedItems != null && listview_Dropbox_uploads.SelectedItems.Count > 0)
            {
                for (int i = 0; i < listview_Dropbox_uploads.SelectedItems.Count; i++)
                {
                    DropboxInfo imgurInfo = (DropboxInfo)listview_Dropbox_uploads.SelectedItems[i].Tag;

                    System.Diagnostics.Process.Start(imgurInfo.WebUrl);
                }
            }
        }
Exemple #4
0
        public DeployAction TryParseDeploymentInfo(HttpRequestBase request, JObject payload, string targetBranch, out DeploymentInfo deploymentInfo)
        {
            deploymentInfo = null;
            if (!String.IsNullOrEmpty(payload.Value<string>("NewCursor")))
            {
                var dropboxInfo = new DropboxInfo(payload);
                deploymentInfo = dropboxInfo;

                // Temporary deployment
                string authorName = dropboxInfo.DeployInfo.UserName;
                string authorEmail = dropboxInfo.DeployInfo.Email;
                string message = "Syncing with dropbox at " + DateTime.UtcNow.ToString("g");
                deploymentInfo.TargetChangeset = new ChangeSet("InProgress", authorName, authorEmail, message, DateTimeOffset.MinValue);

                return DeployAction.ProcessDeployment;
            }

            return DeployAction.UnknownPayload;
        }
        public DeployAction TryParseDeploymentInfo(HttpRequest request, JObject payload, string targetBranch, out DeploymentInfoBase deploymentInfo)
        {
            DropboxInfo dropboxInfo = null;
            string      message     = null;

            if (!String.IsNullOrEmpty(payload.Value <string>("NewCursor")))
            {
                dropboxInfo = DropboxInfo.CreateV1Info(payload, GetRepositoryType(), _repositoryFactory);
                message     = String.Format(CultureInfo.CurrentUICulture, Resources.Dropbox_SynchronizingNChanges, dropboxInfo.DeployInfo.Deltas.Count);
            }
            else if (String.Equals(payload.Value <string>(DropboxVersionKey), "2", StringComparison.OrdinalIgnoreCase))
            {
                string oauthToken = GetValue(payload, DropboxTokenKey),
                       path       = GetValue(payload, DropboxPathKey),
                       userName   = payload.Value <string>("dropbox_username") ?? "Dropbox",
                       email      = payload.Value <string>("dropbox_email");

                dropboxInfo = DropboxInfo.CreateV2Info(path, oauthToken, GetRepositoryType(), _repositoryFactory);
                dropboxInfo.DeployInfo.UserName = userName;
                dropboxInfo.DeployInfo.Email    = email;
                message = String.Format(CultureInfo.CurrentUICulture, Resources.Dropbox_Synchronizing);
            }

            if (dropboxInfo != null)
            {
                deploymentInfo = dropboxInfo;

                // Temporary deployment
                deploymentInfo.TargetChangeset = DeploymentManager.CreateTemporaryChangeSet(
                    authorName: dropboxInfo.DeployInfo.UserName,
                    authorEmail: dropboxInfo.DeployInfo.Email,
                    message: message
                    );

                deploymentInfo.AllowDeploymentWhileScmDisabled = true;

                return(DeployAction.ProcessDeployment);
            }

            deploymentInfo = null;
            return(DeployAction.UnknownPayload);
        }
Exemple #6
0
        public DeployAction TryParseDeploymentInfo(HttpRequestBase request, JObject payload, string targetBranch, out DeploymentInfo deploymentInfo)
        {
            deploymentInfo = null;
            if (!String.IsNullOrEmpty(payload.Value <string>("NewCursor")))
            {
                var dropboxInfo = new DropboxInfo(payload, _settings.IsNullRepository() ? RepositoryType.None : RepositoryType.Git);
                deploymentInfo = dropboxInfo;

                // Temporary deployment
                deploymentInfo.TargetChangeset = DeploymentManager.CreateTemporaryChangeSet(
                    authorName: dropboxInfo.DeployInfo.UserName,
                    authorEmail: dropboxInfo.DeployInfo.Email,
                    message: String.Format(CultureInfo.CurrentUICulture, Resources.Dropbox_Synchronizing, dropboxInfo.DeployInfo.Deltas.Count())
                    );

                return(DeployAction.ProcessDeployment);
            }

            return(DeployAction.UnknownPayload);
        }
        public DeployAction TryParseDeploymentInfo(HttpRequestBase request, JObject payload, string targetBranch, out DeploymentInfo deploymentInfo)
        {
            deploymentInfo = null;
            if (!String.IsNullOrEmpty(payload.Value<string>("NewCursor")))
            {
                var dropboxInfo = new DropboxInfo(payload, _settings.IsNullRepository() ? RepositoryType.None : RepositoryType.Git); 
                deploymentInfo = dropboxInfo; 

                // Temporary deployment
                deploymentInfo.TargetChangeset = DeploymentManager.CreateTemporaryChangeSet(
                    authorName: dropboxInfo.DeployInfo.UserName,
                    authorEmail: dropboxInfo.DeployInfo.Email,
                    message: String.Format(CultureInfo.CurrentUICulture, Resources.Dropbox_Synchronizing, dropboxInfo.DeployInfo.Deltas.Count())
                );

                return DeployAction.ProcessDeployment;
            }

            return DeployAction.UnknownPayload;
        }
 private void Listview_Dropbox_uploadsSelectedIndexChanged(object sender, EventArgs e)
 {
     pictureBox_Dropbox.Image = null;
     if (listview_Dropbox_uploads.SelectedItems != null && listview_Dropbox_uploads.SelectedItems.Count > 0)
     {
         deleteButton.Enabled    = true;
         openButton.Enabled      = true;
         clipboardButton.Enabled = true;
         if (listview_Dropbox_uploads.SelectedItems.Count == 1)
         {
             DropboxInfo imgurInfo = (DropboxInfo)listview_Dropbox_uploads.SelectedItems[0].Tag;
             pictureBox_Dropbox.Image = imgurInfo.Image;
         }
     }
     else
     {
         pictureBox_Dropbox.Image = null;
         deleteButton.Enabled     = false;
         openButton.Enabled       = false;
         clipboardButton.Enabled  = false;
     }
 }
        private void clipboardUrl()
        {
            StringBuilder links = new StringBuilder();

            if (listview_Dropbox_uploads.SelectedItems != null && listview_Dropbox_uploads.SelectedItems.Count > 0)
            {
                for (int i = 0; i < listview_Dropbox_uploads.SelectedItems.Count; i++)
                {
                    DropboxInfo DropboxInfo = (DropboxInfo)listview_Dropbox_uploads.SelectedItems[i].Tag;

                    links.AppendLine(DropboxInfo.WebUrl);
                }
            }
            try
            {
                Clipboard.SetText(links.ToString());
            }
            catch (Exception ex)
            {
                LOG.Error("Can't write to clipboard: ", ex);
            }
        }