Пример #1
0
        public void SetImage(StorageFile image)
        {
            if (image == null)
            {
                throw new ArgumentNullException(nameof(image));
            }

            Items.Add(ShareSourceItem.FromImage(image));
        }
Пример #2
0
        public void SetStorageItems(IEnumerable <IStorageItem> storageItems)
        {
            if (storageItems == null || !storageItems.Any())
            {
                throw new ArgumentException("ExceptionShareSourceDataStorageItemsIsNullOrEmpty".GetLocalized(), nameof(storageItems));
            }

            Items.Add(ShareSourceItem.FromStorageItems(storageItems));
        }
Пример #3
0
        public void SetHtml(string html)
        {
            if (string.IsNullOrEmpty(html))
            {
                throw new ArgumentException("ExceptionShareSourceDataHtmlIsNullOrEmpty".GetLocalized(), nameof(html));
            }

            Items.Add(ShareSourceItem.FromHtml(html));
        }
Пример #4
0
        // To share a link to your app you must first register it to handle URI activation
        // More details at https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation
        public void SetApplicationLink(Uri applicationLink)
        {
            if (applicationLink == null)
            {
                throw new ArgumentNullException(nameof(applicationLink));
            }

            Items.Add(ShareSourceItem.FromApplicationLink(applicationLink));
        }
Пример #5
0
        public void SetWebLink(Uri webLink)
        {
            if (webLink == null)
            {
                throw new ArgumentNullException(nameof(webLink));
            }

            Items.Add(ShareSourceItem.FromWebLink(webLink));
        }
Пример #6
0
        public void SetText(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentException("ExceptionShareSourceDataTitleIsNullOrEmpty".GetLocalized(), nameof(text));
            }

            Items.Add(ShareSourceItem.FromText(text));
        }
Пример #7
0
        // Use this method to add content to share when you do not want to process the data until the target app actually requests it.
        // The defferedDataFormatId parameter must be a const value from StandardDataFormats class.
        // The getDeferredDataAsyncFunc parameter is the function that returns the object you want to share.
        public void SetDeferredContent(string deferredDataFormatId, Func <Task <object> > getDeferredDataAsyncFunc)
        {
            if (string.IsNullOrEmpty(deferredDataFormatId))
            {
                throw new ArgumentException("ExceptionShareSourceDataDeferredDataFormatIdIsNullOrEmpty".GetLocalized(), nameof(deferredDataFormatId));
            }

            Items.Add(ShareSourceItem.FromDeferredContent(deferredDataFormatId, getDeferredDataAsyncFunc));
        }