private string BuildOutputDocumentPathAndFileName() { // Get the server folder URI string folderPath = _sharePointBrowserControl.GetCurrentFolderPath(false); MyDocumentFormat format = (MyDocumentFormat)_demoOptions.DocumentFormatIndex; string extension = MyDocumentFormatItem.GetExtension(format); string name = System.IO.Path.GetFileNameWithoutExtension(_demoOptions.ImageDocumentFileName); string outputDocumentPathAndFileName = System.IO.Path.Combine(folderPath, name); outputDocumentPathAndFileName = System.IO.Path.ChangeExtension(outputDocumentPathAndFileName, extension); return(outputDocumentPathAndFileName); }
public void SetProperties( SharePoint.SharePointServerSettings serverSettings, string imageDocumentFileName, string serverDocumentPathAndFileName, MyDocumentFormat format) { _serverSettings = serverSettings; _imageDocumentFileName = imageDocumentFileName; _serverDocumentPathAndFileName = serverDocumentPathAndFileName; _format = format; UriBuilder builder = new UriBuilder(_serverSettings.Uri); builder.Path = Path.Combine(builder.Path, serverDocumentPathAndFileName); _serverDocumentFullUri = builder.Uri; _imageDocumentFileNameTextBox.Text = _imageDocumentFileName; _serverDocumentNameTextBox.Text = _serverDocumentFullUri.ToString(); }
public static string GetExtension(MyDocumentFormat format) { switch (format) { case MyDocumentFormat.DOC: return("doc"); case MyDocumentFormat.DOCX: return("docx"); case MyDocumentFormat.TEXT: return("txt"); case MyDocumentFormat.PDF: case MyDocumentFormat.PDFImageOverText: default: return("pdf"); } }
private void _nextButton_Click(object sender, EventArgs e) { if (_mainWizardControl.SelectedTab == _serverPropertiesTabPage) { _mainWizardControl.SelectedTab = _sharePointBrowserTabPage; _sharePointBrowserControl.RefreshCurrentFolder(); UpdateUIState(); } else if (_mainWizardControl.SelectedTab == _sharePointBrowserTabPage) { _mainWizardControl.SelectedTab = _selectImageDocumentFileTabPage; UpdateUIState(); } else if (_mainWizardControl.SelectedTab == _selectImageDocumentFileTabPage) { _demoOptions.ImageDocumentFileName = _selectImageDocumentFileControl.ImageDocumentFileName; MyDocumentFormat format = _selectImageDocumentFileControl.GetSelectedDocumentFormat(); _demoOptions.DocumentFormatIndex = (int)format; // Create the URL for the output document string outputDocumentPathAndFileName = BuildOutputDocumentPathAndFileName(); _recognizeAndUploadControl.SetProperties( _demoOptions.SharePointServerSettings, _demoOptions.ImageDocumentFileName, outputDocumentPathAndFileName, (MyDocumentFormat)_demoOptions.DocumentFormatIndex); _mainWizardControl.SelectedTab = _recognizeAndUploadTabPage; UpdateUIState(); Application.DoEvents(); _recognizeAndUploadControl.Run(); } else if (_mainWizardControl.SelectedTab == _recognizeAndUploadTabPage) { _mainWizardControl.SelectedTab = _sharePointBrowserTabPage; _sharePointBrowserControl.RefreshCurrentFolder(); _sharePointBrowserControl.SelectItem(_recognizeAndUploadControl.LastUplodedDocumentUri); UpdateUIState(); } }
public MyDocumentFormatItem(string t, MyDocumentFormat f) { Title = t; FormatType = f; }