本文整理汇总了C#中Windows.GetBasicPropertiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Windows.GetBasicPropertiesAsync方法的具体用法?C# Windows.GetBasicPropertiesAsync怎么用?C# Windows.GetBasicPropertiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.GetBasicPropertiesAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadAsync
public async Task UploadAsync(Windows.Storage.StorageFile sourceFile,
string containerName, string blobName)
{
var properties = await sourceFile.GetBasicPropertiesAsync();
if (properties.Size > (1024 * 1024 * 64))
throw new Exception("File cannot be larger than 64MB");
var container = this.Parent.GetContainer(containerName);
var blob = container.GetBlockBlobReference(blobName);
await blob.UploadFromFileAsync(sourceFile);
}
示例2: UploadBackgroundAsync
public async Task<Windows.Networking.BackgroundTransfer.UploadOperation> UploadBackgroundAsync(Windows.Storage.StorageFile sourceFile,
string containerName, string blobName, Action<Windows.Networking.BackgroundTransfer.UploadOperation> progressCallback = null)
{
var properties = await sourceFile.GetBasicPropertiesAsync();
if (properties.Size > (1024 * 1024 * 64))
throw new Exception("File cannot be larger than 64MB");
var permissions = Microsoft.WindowsAzure.Storage.Blob.SharedAccessBlobPermissions.Write;
var container = this.Parent.GetContainer(containerName);
var signature = this.GetSas(permissions, TimeSpan.FromMinutes(5), container.Name, blobName);
var uploader = new Windows.Networking.BackgroundTransfer.BackgroundUploader
{
TransferGroup = Windows.Networking.BackgroundTransfer.BackgroundTransferGroup.CreateGroup(_groupName)
};
uploader.SetRequestHeader("Filename", sourceFile.Name);
var upload = uploader.CreateUpload(signature, sourceFile);
if (progressCallback == null)
return await upload.StartAsync();
else
return await upload.StartAsync().AsTask(new Progress<Windows.Networking.BackgroundTransfer.UploadOperation>(progressCallback));
}
示例3: OpenPDFDocument
//////////////////////////////////////////////////////////////// open pdf and load pdf and calculate pdf size and unload pdf
private async void OpenPDFDocument(Windows.Storage.StorageFile file)
{
if (file != null)
{
Windows.Storage.FileProperties.BasicProperties properties = await file.GetBasicPropertiesAsync();
m_SDKDocument = new FSDK_Document();
//Load PDF document
int result = await m_SDKDocument.OpenDocumentAsync(file, (int)properties.Size);
if(result != 0)
{
return;
}
m_PDFDoc.pointer = m_SDKDocument.m_hDoc.pointer;
m_iPageCount = m_PDFFunction.My_Doc_CountPages(m_PDFDoc);
//import wordlist into struct
string[] testStr = new string[WordNumber];
testStr = Wordlist;
wordInfo wInfo;
for (int count = 0; count < testStr.Length; count++)
{
bool[] testData = new bool[m_iPageCount];
for (int count1 = 0; count1 < testData.Length; count1++)
{
testData[count1] = false;
}
wInfo.word = testStr[count];
wInfo.annotFlag = testData;
wordInfoList.Add(wInfo);
}
//Load first two PDF page
result = LoadPage(0);
if(result != 0)
{
return;
}
result = LoadPage(1);
if (result != 0)
{
return;
}
nextInvisibleIndex = 2;
//get page size and calculate suitable render size
GetPageInfo();
m_dbScaleFator = (m_dbCommonFitWidthScale < m_dbCommonFitHeightScale) ? m_dbCommonFitWidthScale : m_dbCommonFitHeightScale;
CalcRenderSize();
//Show PDF page to device.
initPdfGrid(m_iPageCount);
ShowPage();
//initial preview page
preview_visiblePage = new Dictionary<int, PageHandle>();
Preview_InitGrid();
}
return;
}