Beispiel #1
0
        public void ShowMetadata()
        {
            TrackingListManager.Reload();

            var trackingItem = TrackingListManager.GetByPath(Globals.ThisAddIn.Application.ActiveDocument.FullName);

            if (trackingItem == null)
            {
                MessageBox.Show(String.Format("El documento no contiene metadatos porque no existe en DokuFlex.\n\n{0}",
                                              "Guarde el documento en DokuFlex y repita la acción"),
                                this.Application.Name, MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
            else
            {
                var ticket = Session.GetTikect();

                using (var form = new MetadataForm(ticket, trackingItem.FileId, trackingItem.Name))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        DokuFlexService.UpdateDocumentMetadata(ticket, form.DocumentType,
                                                               trackingItem.FileId, form.Metadata.ToArray());
                    }
                }
            }
        }
Beispiel #2
0
        public void SaveDocument()
        {
            var newFile = false;

            if (String.IsNullOrWhiteSpace(this.Application.ActiveDocument.Path))
            {
                if (MessageBox.Show(String.Format("El documento aún no ha sido guardado en disco.\n\n{0}",
                                                  "¿Desea guardar el documento en su PC para continuar?"),
                                    this.Application.Name, MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    this.Application.ActiveDocument.Save();

                    newFile = true;

                    if (string.IsNullOrWhiteSpace(this.Application.ActiveDocument.Path))
                    {
                        return;
                    }
                }
            }
            else
            {
                if (!this.Application.ActiveDocument.Saved &&
                    MessageBox.Show(String.Format("¿Desea guardar los cambios en {0} antes continuar?",
                                                  this.Application.ActiveDocument.Name.ToUpperInvariant()),
                                    this.Application.Name, MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    this.Application.ActiveDocument.Save();
                }
            }

            var ticket = Session.GetTikect();

            if (String.IsNullOrWhiteSpace(ticket))
            {
                return;
            }

            var fileId = UploadFile(ticket, this.Application.ActiveDocument.FullName);

            if (newFile && !String.IsNullOrWhiteSpace(fileId))
            {
                using (var form = new MetadataForm(ticket, fileId, this.Application.ActiveDocument.Name))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        DokuFlexService.UpdateDocumentMetadata(ticket, form.DocumentType,
                                                               fileId, form.Metadata.ToArray());
                    }
                }
            }
        }
Beispiel #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     Hide();
     if (dataGridView1.SelectedRows.Count > 0)
     {
         var          index  = dataGridView1.SelectedRows[0].Index;
         int          fileId = int.Parse(dataGridView1.Rows[index].Cells[0].Value.ToString());
         MetadataForm frm    = new MetadataForm(fileId);
         frm.Show();
     }
 }
Beispiel #4
0
        public void SavePresentation()
        {
            var newFile = false;

            if (String.IsNullOrWhiteSpace(this.Application.ActivePresentation.Path))
            {
                if (MessageBox.Show(String.Format("La presentación aún no ha sido guardada en disco.\n\n{0}",
                                                  "¿Desea guardar la presentación en su equipo para continuar?"),
                                    this.Application.Name, MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    this.Application.ActivePresentation.Save();

                    newFile = true;

                    if (string.IsNullOrWhiteSpace(this.Application.ActivePresentation.Path))
                    {
                        return;
                    }
                }
            }
            else
            {
                this.Application.ActivePresentation.Save();
            }

            var ticket = Session.GetTikect();

            if (String.IsNullOrWhiteSpace(ticket))
            {
                return;
            }

            var fileId = UploadFile(ticket, this.Application.ActivePresentation.FullName);

            if (newFile && !String.IsNullOrWhiteSpace(fileId))
            {
                using (var form = new MetadataForm(ticket, fileId, this.Application.ActivePresentation.Name))
                {
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        DokuFlexService.UpdateDocumentMetadata(ticket, form.DocumentType,
                                                               fileId, form.Metadata.ToArray());
                    }
                }
            }
        }
Beispiel #5
0
        private async void btnStart_Click(object sender, EventArgs e)
        {
            if (chkAttachedList.CheckedItems.Count == 0)
            {
                MessageBox.Show("No hay archivos seleccionados para enviar a DokuFlex", Globals.ThisAddIn.Application.Name, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                return;
            }

            var counter      = 0;
            var linkedFileId = String.Empty;

            DisableUIControls();

            try
            {
                var ticket = await Session.GetTikectAsync();

                var fileId = String.Empty;

                foreach (object itemChecked in chkAttachedList.CheckedItems)
                {
                    var attachName = itemChecked.ToString();

                    UpdateProgressInfo(++counter, chkAttachedList.CheckedItems.Count);

                    this.Cursor = Cursors.WaitCursor;

                    try
                    {
                        if (chkIncludeMessage.Checked)
                        {
                            fileId = await _presenter.UploadAttachAsync(attachName, linkedFileId, true);
                        }
                        else
                        {
                            fileId = await _presenter.UploadAttachAsync(attachName, linkedFileId, false);
                        }
                    }
                    finally
                    {
                        this.Cursor = Cursors.Default;
                    }

                    using (var form = new MetadataForm(ticket, String.Empty, attachName))
                    {
                        if (form.ShowDialog() == DialogResult.OK)
                        {
                            await DokuFlexService.UpdateDocumentMetadataAsync(ticket, form.DocumentType,
                                                                              fileId, form.Metadata.ToArray());
                        }
                    }

                    if (String.IsNullOrWhiteSpace(linkedFileId))
                    {
                        linkedFileId = fileId;
                    }
                }

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            finally
            {
                EnableUIControls();
            }
        }