Exemple #1
0
        partial void SelectedAnAction(Foundation.NSObject sender)
        {
            if (0 == FileResults.SelectedRows.Count)
            {
                var alert = new NSAlert()
                {
                    AlertStyle      = NSAlertStyle.Warning,
                    InformativeText = "Please select a path",
                    MessageText     = "Action Info",
                };

                alert.BeginSheet(this);

                return;
            }

            if (1 < FileResults.SelectedRows.Count)
            {
                var alert = new NSAlert()
                {
                    AlertStyle      = NSAlertStyle.Warning,
                    InformativeText = "Please select just one path",
                    MessageText     = "Action Info",
                };

                alert.BeginSheet(this);

                return;
            }

            int row;

            if (false == Int32.TryParse(FileResults.SelectedRow.ToString(), out row))
            {
                return;
            }

            var path = ((EntityDataSource)FileResults.DataSource).Entities[row].Path;

            if ("Show in Finder" == SelectableActions.SelectedItem.Title)
            {
                NSWorkspace.SharedWorkspace.SelectFile(path, System.IO.Path.GetDirectoryName(path));
            }

            if ("Quick Look" == SelectableActions.SelectedItem.Title)
            {
                _quick_look_path = path;

                if (QLPreviewPanel.SharedPreviewPanelExists() && QLPreviewPanel.SharedPreviewPanel().IsVisible)
                {
                    QLPreviewPanel.SharedPreviewPanel().ReloadData();

                    // QLPreviewPanel.SharedPreviewPanel().OrderOut(null);
                }
                else
                {
                    QLPreviewPanel.SharedPreviewPanel().MakeKeyAndOrderFront(null);
                }
            }
        }
 void ToggleQuickLookPanel()
 {
     if (QLPreviewPanel.SharedPreviewPanelExists() && QLPreviewPanel.SharedPreviewPanel().IsVisible)
     {
         QLPreviewPanel.SharedPreviewPanel().OrderOut(NSApplication.SharedApplication);
     }
     else
     {
         var panel = QLPreviewPanel.SharedPreviewPanel();
         panel.DataSource = new QLDataSource();
         panel.Delegate   = new QLDelegate();
         panel.MakeKeyAndOrderFront(NSApplication.SharedApplication);
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.

            PreviewBtn.Activated += (sender, e) =>
            {
                /*
                 * Applications have a shared QLPreviewPanel instance:
                 * https://developer.apple.com/reference/quartz/qlpreviewpanel
                 */

                QLPreviewPanel.SharedPreviewPanel().MakeKeyAndOrderFront(null);
            };
        }