コード例 #1
0
        private void ShareDeck(Deck deck)
        {
            UIViewController topCtrl = UIApplication.SharedApplication.KeyWindow.RootViewController;

            //save deck in temp location with name
            var tempdir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var file     = Path.Combine(tempdir, deck.Name + ".dfd");
            var deckJson = JsonConvert.SerializeObject(deck, Formatting.Indented);

            File.WriteAllText(file, deckJson);

            var navCtrl = topCtrl.ChildViewControllers.OfType <NavigationRenderer>().FirstOrDefault();

            if (navCtrl != null)
            {
                viewCtrl = navCtrl.TopViewController;

                var allButtons = viewCtrl.NavigationItem.RightBarButtonItems;
                var button     = allButtons[0];

                uidic      = UIDocumentInteractionController.FromUrl(new NSUrl(file, true));
                uidic.Name = "Share Deck";
                uidic.Uti  = "com.benreierson.deck";

                result = uidic.PresentOptionsMenu(button, true);
            }
        }
コード例 #2
0
ファイル: VideoUtils.cs プロジェクト: nour7/Ta7meel
        public void OpenActionSheet(string path)
        {
            var window   = UIApplication.SharedApplication.KeyWindow;
            var subviews = window.Subviews;
            var view     = subviews.Last();

            NSUrl videoUrl = NSUrl.CreateFileUrl(path, null);
            UIDocumentInteractionController openInWindow = UIDocumentInteractionController.FromUrl(videoUrl);

            openInWindow.PresentOptionsMenu(CGRect.Empty, view, true);
            //openInWindow.PresentOpenInMenu(CGRect.Empty, view, true);
        }
コード例 #3
0
        partial void ShareClick(UIKit.UIBarButtonItem sender)
        {
            if (PdfPath == null)
            {
                ShowHowToUse();
                return;
            }

            UIDocumentInteractionController docController = new UIDocumentInteractionController();

            docController.Url = NSUrl.FromFilename(PdfPath);
            docController.PresentOptionsMenu(ShareButton, true);
        }
コード例 #4
0
 public void Share(string filePath)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(() =>
     {
         _controller      = UIDocumentInteractionController.FromUrl(NSUrl.FromFilename(filePath));
         _controller.Name = Path.GetFileName(filePath);
         var window       = UIApplication.SharedApplication.KeyWindow;
         var subviews     = window.Subviews;
         var view         = subviews.Last();
         var frame        = view.Frame;
         frame            = new CGRect((float)Math.Min(10, frame.Width), (float)frame.Bottom, 0, 0);
         _controller.PresentOptionsMenu(frame, view, true);
     });
 }
コード例 #5
0
        async partial void ShareClick(NSObject sender)
        {
            if (!File.Exists(TempXlsPath))
            {
                if (!await TryCreateReport())
                {
                    return;
                }
            }
            UIDocumentInteractionController docController = new UIDocumentInteractionController();

            docController.Url = NSUrl.FromFilename(TempXlsPath);
            docController.PresentOptionsMenu((UIBarButtonItem)sender, true);
        }
コード例 #6
0
        public void ShareFile(string path, string mime)
        {
            Log.Info($"Sharing file with path: {path}");
            UIDocumentInteractionController viewer = UIDocumentInteractionController.FromUrl(NSUrl.FromFilename(path));
            var controller = GetVisibleViewController();

            viewer.Uti = "public.data";
            viewer.PresentOptionsMenu(controller.View.Frame, controller.View, true);

            var task = new TaskCompletionSource <bool>();

            viewer.DidDismissOptionsMenu += (sender, e) =>
            {
                task.TrySetResult(true);
            };
        }