예제 #1
0
        /// <param name="url">The shared document's URL.</param>
        /// <param name="completionHandler">
        ///   <para>An action the system calls subsequent to the creation of a placeholder.</para>
        ///   <para tool="nullallowed">This parameter can be <see langword="null" />.</para>
        /// </param>
        /// <summary>When implemented by the developer, creates a specified placeholder for a previously defined URL.</summary>
        /// <remarks>
        ///   <para>The developer must override this method. This method is called to provide a placeholder for documents that are returned by the Document Picker but that are not locally stored.</para>
        ///   <para tool="threads">This can be used from a background thread.</para>
        /// </remarks>
        public override void ProvidePlaceholderAtUrl(NSUrl url, Action <NSError> completionHandler)
        {
            try
            {
                string       identifier   = this.GetPersistentIdentifier(url);
                ItemMetadata itemMetadata = this.StorageManager.GetItemMetadata(identifier);
                if (!itemMetadata.IsExists)
                {
                    completionHandler?.Invoke(NSFileProviderErrorFactory.CreateNonExistentItemError(identifier));
                    return;
                }
                NSUrl   placeholderUrl = NSFileProviderManager.GetPlaceholderUrl(url);
                NSError error;
                NSFileManager.DefaultManager.CreateDirectory(placeholderUrl.RemoveLastPathComponent(), true, null, out error);
                if (error != null)
                {
                    completionHandler?.Invoke(error);
                    return;
                }

                INSFileProviderItem providerItem = ProviderItem.CreateFromMetadata(itemMetadata);
                NSFileProviderManager.WritePlaceholder(placeholderUrl, providerItem, out error);
                completionHandler?.Invoke(error);
            }
            catch (Exception ex)
            {
                NSError error = this.MapError(ex);
                completionHandler?.Invoke(error);
            }
        }
예제 #2
0
        private void LoadArExperienceIfRequired()
        {
            NSUrl experienceURLValidator(string URL)
            {
                if (URL.Contains("https"))
                {
                    return(NSUrl.FromString(URL));
                }
                else
                {
                    NSUrl  relativeArExperienceURL = NSUrl.FromString(currentArExperience.Path);
                    string bundleSubdirectory      = "ARchitectExamples/" + relativeArExperienceURL.RemoveLastPathComponent().AbsoluteString;
                    NSUrl  bundleArExperienceURL   = NSBundle.MainBundle.GetUrlForResource("index", "html", bundleSubdirectory);
                    return(bundleArExperienceURL);
                }
            }

            NSUrl fullArExperienceURL = experienceURLValidator(currentArExperience.Path);

            if (loadedArExperienceNavigation == null || (loadedArExperienceNavigation != null && !loadedArExperienceNavigation.OriginalURL.Equals(fullArExperienceURL)))
            {
                loadingArExperienceNavigation = architectView.LoadArchitectWorldFromURL(fullArExperienceURL);
            }
        }