Exemplo n.º 1
0
    void CreateNewDocument(string folderPath, string docType)
    {
        if (string.IsNullOrEmpty(folderPath))
        {
            folderPath = "Files";
        }

        string documentName;

        if (docType == "richtext")
        {
            documentName = "Document.rtf";
        }
        else if (docType == "worksheet")
        {
            documentName = "Worksheet.xlsx";
        }
        else
        {
            throw new Exception("Incorrect document type.");
        }

        Item newDocument = FileSystemService.CreateNewFileItem(folderPath, documentName);

        CurrentDocument = newDocument;
    }