示例#1
0
 private void Faddout(NSView view)
 {
     NSAnimationContext.BeginGrouping();
     NSAnimationContext.CurrentContext.Duration = 2;
     view.RemoveFromSuperview();
     NSAnimationContext.EndGrouping();
 }
示例#2
0
 private void Faddin(NSView view)
 {
     NSAnimationContext.BeginGrouping();
     NSAnimationContext.CurrentContext.Duration = 2;
     this.View.AddSubview(view);
     NSAnimationContext.EndGrouping();
 }
示例#3
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            SimpleAuth.Mac.WebAuthenticatorWebView.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1"
                                                               AudioOutputHelper.Init();
            var version = Device.SystemVersion;

            //window.StyleMask |= NSWindowStyle.FullSizeContentView;
            //window.TitlebarAppearsTransparent = true;
            SetupApp();
            // Insert code here to initialize your application
            _sidebarOutlineView.SizeLastColumnToFit();
            _sidebarOutlineView.WeakDataSource = this;
            _sidebarOutlineView.ReloadData();
            _sidebarOutlineView.FloatsGroupRows = false;

            _sidebarOutlineView.RowSizeStyle = NSTableViewRowSizeStyle.Default;

            // Expand all the root items; disable the expansion animation that normally happens
            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration = 0;
            _sidebarOutlineView.ExpandItem(null, true);
            NSAnimationContext.EndGrouping();
            CheckLogin();

                        #pragma warning disable 4014
            App.Start();
                        #pragma warning restore 4014

            ApiManager.Shared.StartSync();
            fullScreenController = new VideoPlaybackWindowController();
            NotificationManager.Shared.ToggleFullScreenVideo += NotificationManager_Shared_ToggleFullScreenVideo;
        }
示例#4
0
 void EndExpandCollapseAnimation()
 {
     if (!AnimationsEnabled)
     {
         NSAnimationContext.EndGrouping();
     }
 }
        private void ShowDisconnectedAnimation(bool isPaused)
        {
            View.IsVisibleCircles = true;

            UpdateDisconnectedUITheme(isPaused);

            GuiConnectButtonImage.AlphaValue   = 0f;
            GuiConnectButtonText.AlphaValue    = 0f;
            GuiLabelToDoDescription.AlphaValue = 0f;

            GuiConnectButtonImage.Hidden = false;
            GuiConnectButtonText.Hidden  = false;
            UpdateToDoLabelHiddenStatus(false);

            NSAnimationContext.RunAnimation((NSAnimationContext context) =>
            {
                context.Duration = 0.5f;

                ((NSView)GuiConnectButtonImage.Animator).AlphaValue        = 1f;
                ((NSTextField)GuiConnectButtonText.Animator).AlphaValue    = 1f;
                ((NSTextField)GuiLabelToDoDescription.Animator).AlphaValue = 1f;
            },
                                            () =>
            {
            });
        }
        void UpdateCurrentPage(bool animated = true)
        {
            ContentPage current = Carousel.CurrentPage;

            if (current != null)
            {
                int index = Carousel.CurrentPage != null?CarouselPage.GetIndex(Carousel.CurrentPage) : 0;

                if (index < 0)
                {
                    index = 0;
                }

                if (SelectedIndex == index)
                {
                    return;
                }

                if (animated)
                {
                    NSAnimationContext.RunAnimation(context => { ((NSPageController)Animator).SelectedIndex = index; },
                                                    CompleteTransition);
                }
                else
                {
                    SelectedIndex = index;
                }
            }
        }
示例#7
0
        partial void InterTreeSegment(NSObject sender)
        {
            var s = sender as NSSegmentedControl;

            if (s.IsSelectedForSegment(0) && InterTreePlotView.Frame.Width <= 20)
            {
                InterTreeSplitView.SetPositionOfDivider(
                    (nfloat)Math.Min(674, InterTreeSplitView.Frame.Width - 300), 0);
            }
            else if (!s.IsSelectedForSegment(0))
            {
                InterTreeSplitView.SetPositionOfDivider(0, 0);
            }

            if (s.IsSelectedForSegment(1) && InterText.Frame.Width <= 20)
            {
                NSAnimationContext.RunAnimation((NSAnimationContext a) => {
                    a.AllowsImplicitAnimation = true;
                    a.Duration = 0.5;
                    InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width - 300, 1);
                });
            }
            else if (!s.IsSelectedForSegment(1))
            {
                NSAnimationContext.RunAnimation((NSAnimationContext a) => {
                    a.AllowsImplicitAnimation = true;
                    a.Duration = 0.5;
                    InterTreeSplitView.SetPositionOfDivider(InterTreeSplitView.Frame.Width, 1);
                });
            }
        }
示例#8
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            var version = Device.SystemVersion;

            //window.StyleMask |= NSWindowStyle.FullSizeContentView;
            //window.TitlebarAppearsTransparent = true;
            SetupApp();
            // Insert code here to initialize your application
            _sidebarOutlineView.SizeLastColumnToFit();
            _sidebarOutlineView.WeakDataSource = this;
            _sidebarOutlineView.ReloadData();
            _sidebarOutlineView.FloatsGroupRows = false;

            _sidebarOutlineView.RowSizeStyle = NSTableViewRowSizeStyle.Default;

            // Expand all the root items; disable the expansion animation that normally happens
            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration = 0;
            _sidebarOutlineView.ExpandItem(null, true);
            NSAnimationContext.EndGrouping();
            CheckLogin();

                        #pragma warning disable 4014
            App.Start();
                        #pragma warning restore 4014

            ApiManager.Shared.StartSync();
            fullScreenController = new VideoPlaybackWindowController();
            NotificationManager.Shared.ToggleFullScreenVideo += NotificationManager_Shared_ToggleFullScreenVideo;
        }
示例#9
0
        public override void KeyDown(NSEvent theEvent)
        {
            if ((theEvent.ModifierFlags & NSEventModifierMask.AlphaShiftKeyMask) == NSEventModifierMask.AlphaShiftKeyMask ||
                (theEvent.ModifierFlags & NSEventModifierMask.ShiftKeyMask) == NSEventModifierMask.ShiftKeyMask)
            {
                NSAnimationContext.BeginGrouping();
                NSAnimationContext.CurrentContext.Duration = 2.0f;
            }

            if (theEvent.Characters.ToUpper()[0] == 'A')
            {
                NSView view = Mover();
                if (view.Superview == null)
                {
                    // there is a problem here with AddSubview with animator
                    //((NSView)Animator).AddSubview(view);
                    this.AddSubview(view);
                }
                else
                {
                    ((NSView)view.Animator).RemoveFromSuperview();
                }
            }
            else
            {
                base.KeyDown(theEvent);
            }

            if ((theEvent.ModifierFlags & NSEventModifierMask.AlphaShiftKeyMask) == NSEventModifierMask.AlphaShiftKeyMask ||
                (theEvent.ModifierFlags & NSEventModifierMask.ShiftKeyMask) == NSEventModifierMask.ShiftKeyMask)
            {
                NSAnimationContext.EndGrouping();
            }
        }
        private void AnimateButtonTextBlinking()
        {
            nfloat alpha = 0.3f;

            if (GuiConnectButtonText.AlphaValue < 1f)
            {
                alpha = 1f;
            }

            NSAnimationContext.RunAnimation((NSAnimationContext context) =>
            {
                context.Duration = 1f;
                ((NSView)GuiConnectButtonText.Animator).AlphaValue = alpha;
            },
                                            () =>
            {
                if (__MainViewModel.ConnectionState != ServiceState.Connecting &&
                    __MainViewModel.ConnectionState != ServiceState.Disconnecting)
                {
                    GuiConnectButtonText.AlphaValue = 1f;
                }
                else
                {
                    AnimateButtonTextBlinking();
                }
            });
        }
示例#11
0
        public static Task ScrollToPositionAsync(this NSScrollView scrollView, PointF point, bool animate,
                                                 double duration = 0.5)
        {
            if (!animate)
            {
                var nsView = scrollView.DocumentView as NSView;
                nsView?.ScrollPoint(point);
                return(Task.FromResult(true));
            }

            TaskCompletionSource <bool> source = new TaskCompletionSource <bool>();

            NSAnimationContext.BeginGrouping();

            NSAnimationContext.CurrentContext.CompletionHandler += () => { source.TrySetResult(true); };

            NSAnimationContext.CurrentContext.Duration = duration;

            var animator = scrollView.ContentView.Animator as NSView;

            animator?.SetBoundsOrigin(point);

            NSAnimationContext.EndGrouping();

            return(source.Task);
        }
示例#12
0
        public void InitializeOutlineView()
        {
            if (DataManager == null || DataManager.PublicationResultList == null ||
                DataManager.PublicationResultList.Count == 0)
            {
                NoResultLabel.Hidden      = false;
                NoResultLabel.StringValue = "You have no search result.";
                SearchOutlineView.Hidden  = true;
            }
            else
            {
                NoResultLabel.Hidden = true;

                //IndexOutlineView.SelectionShouldChange += (t) => true;
                //IndexOutlineView.EnclosingScrollView.BackgroundColor = NSColor.Clear;

                SearchOutlineView.EnclosingScrollView.BorderType                   = NSBorderType.NoBorder;
                SearchOutlineView.EnclosingScrollView.BackgroundColor              = NSColor.White;
                SearchOutlineView.EnclosingScrollView.HasHorizontalScroller        = false;
                SearchOutlineView.EnclosingScrollView.HasVerticalScroller          = true;
                SearchOutlineView.EnclosingScrollView.ScrollerKnobStyle            = NSScrollerKnobStyle.Default;
                SearchOutlineView.EnclosingScrollView.VerticalScroller.ControlSize = NSControlSize.Small;
                SearchOutlineView.GridStyleMask           = NSTableViewGridStyle.None;
                SearchOutlineView.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.Regular;
                SearchOutlineView.FloatsGroupRows         = true;

                SearchOutlineView.DataSource = new SearchOutlineDataSource(this);
                SearchOutlineView.Delegate   = new SearchOutlineDelegate(this);

                NSAnimationContext.BeginGrouping();
                NSAnimationContext.CurrentContext.Duration = 0;
                SearchOutlineView.ExpandItem(null, true);
                NSAnimationContext.EndGrouping();
            }
        }
示例#13
0
 private void bounce()
 {
     NSAnimationContext.RunAnimation((context) => {
         var newFrame = mover.Frame;
         newFrame.Offset(1, 0);
         ((NSView)mover.Animator).SetFrameOrigin(newFrame.Location);
     }, () => {});
 }
示例#14
0
 void BeginExpandCollapseAnimation()
 {
     if (!AnimationsEnabled)
     {
         NSAnimationContext.BeginGrouping();
         NSAnimationContext.CurrentContext.Duration = 0;
     }
 }
        /// <summary>
        /// Opens the panel
        /// </summary>
        public virtual void OpenPanel()
        {
            if (IsOpen)
            {
                return;
            }

            var screenRect = NSScreen.Screens[0].Frame;
            var statusRect = StatusRectForWindow(Window);

            var panelRect = Window.Frame;

            panelRect.X = (float)Math.Round((statusRect.Right - (statusRect.Width)) - panelRect.Width / 2f);
            panelRect.Y = statusRect.Top - panelRect.Height;

            if (panelRect.Right > (screenRect.Right - BackgroundView.ArrowHeight))
            {
                panelRect.X -= panelRect.Right - (screenRect.Right - BackgroundView.ArrowHeight);
            }

            NSApplication.SharedApplication.ActivateIgnoringOtherApps(true);
            Window.AlphaValue = 0f;
            Window.SetFrame(statusRect, true);
            Window.MakeKeyAndOrderFront(this);

            float openDuration = OpenDuration;

#if DEBUG
            var currentEvent = NSApplication.SharedApplication.CurrentEvent;
            if (currentEvent.Type == NSEventType.LeftMouseUp)
            {
                var  clearFlags         = currentEvent.ModifierFlags & NSEventModifierMask.DeviceIndependentModifierFlagsMask;
                bool shiftPressed       = clearFlags == NSEventModifierMask.ShiftKeyMask;
                bool shiftOptionPressed = clearFlags == (NSEventModifierMask.ShiftKeyMask | NSEventModifierMask.AlternateKeyMask);
                if (shiftPressed || shiftOptionPressed)
                {
                    openDuration *= 10f;

                    if (shiftOptionPressed)
                    {
                        Debug.WriteLine("Icon is at {0}\n\tMenu is on screen {1}\n\tWill be animated to {2}", statusRect, screenRect, panelRect);
                    }
                }
            }
#endif

            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration = openDuration;
            var animator = (NSWindow)Window.Animator; // Note the cast neccesary for MonoMac
            animator.SetFrame(panelRect, true);
            animator.AlphaValue = 1f;
            NSAnimationContext.EndGrouping();

            IsOpen = true;
            StatusItemView.IsHighlighted = true;
            NSApplication.SharedApplication.ActivateIgnoringOtherApps(false);
        }
        internal void ToggleTrailingSidebar()
        {
            NSSplitViewItem splitViewItem = (NSSplitViewItem)SplitViewItems.Last().Animator;

            TrailingSidebarViewWidthLayoutConstraint !.Active = false;
            NSAnimationContext.RunAnimation(changes: context => {
                context.Duration        = 3;
                splitViewItem.Collapsed = !splitViewItem.Collapsed;
            }, completionHandler: () => {
                TrailingSidebarViewWidthLayoutConstraint.Active = true;
            });
        }
示例#17
0
        void UpdateExpandedState()
        {
            if (!Widget.Loaded)
            {
                content.Hidden = !Expanded;
                return;
            }
            if (EnableAnimation)
            {
                var frame        = content.Frame;
                var controlFrame = Control.Frame;

                if (Expanded)
                {
                    content.Frame = frame;

                    frame.Y = 0;
                    suspendContentSizing++;
                    var newSize = GetPreferredSize(SizeF.MaxValue);
                    controlFrame.Height = newSize.Height;
                    Control.Frame       = controlFrame;
                    LayoutIfNeeded(force: true);
                    content.Frame = new CGRect(0, controlFrame.Height - header.Frame.Height, controlFrame.Width, 0);
                    suspendContentSizing--;
                    frame.Height   = newSize.Height - header.Frame.Height;
                    content.Hidden = false;
                }
                else
                {
                    frame.Y      = Control.Frame.Height - header.Frame.Height;
                    frame.Height = 0;
                }

                NSAnimationContext.RunAnimation(ctx =>
                {
                    ctx.Duration = AnimationDuration;
                    ((NSView)content.Animator).Frame = frame;
                }, () =>
                {
                    content.Hidden = !Expanded;
                    Callback.OnExpandedChanged(Widget, EventArgs.Empty);
                    LayoutIfNeeded();
                }
                                                );
            }
            else
            {
                content.Hidden = !Expanded;
                LayoutIfNeeded(force: true);
                Callback.OnExpandedChanged(Widget, EventArgs.Empty);
            }
        }
        void InitializeAnimation()
        {
            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration = 0f;

            heartImage.WantsLayer        = true;
            heartImage.Layer.AnchorPoint = new CGPoint(0.5f, 0.5f);
            heartImage.Layer.Position    = new CGPoint(
                heartImage.Layer.Frame.Size.Width / 2,
                heartImage.Layer.Frame.Size.Height / 2
                );

            NSAnimationContext.EndGrouping();
        }
        /// <summary>
        /// Closes the panel
        /// </summary>
        public virtual void ClosePanel()
        {
            if (!IsOpen)
            {
                return;
            }

            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration = CloseDuration;
            var animator = (NSWindow)Window.Animator; // Note the cast neccesary for MonoMac

            animator.AlphaValue = 0f;
            NSAnimationContext.EndGrouping();

            IsOpen = false;
            StatusItemView.IsHighlighted = false;
        }
        private void ShowConnectedAnimation()
        {
            View.IsVisibleCircles = false;

            GuiConnectButtonImage.Hidden = false;
            GuiConnectButtonText.Hidden  = false;
            UpdateToDoLabelHiddenStatus(false);

            GuiConnectButtonImage.AlphaValue   = 0f;
            GuiLabelToDoDescription.AlphaValue = 0f;

            GuiConnectButtonText.AttributedStringValue = AttributedString.Create(
                LocalizedStrings.Instance.LocalizedString("Button_Disconnect"),
                __ConnectedButtonTextColor,
                NSTextAlignment.Center);
            GuiConnectButtonText.AlphaValue = 1f;

            GuiLabelToDoDescription.AttributedStringValue = AttributedString.Create(
                LocalizedStrings.Instance.LocalizedString("Label_ClickToDisconnect"),
                __ToDoDescriptionTextColor,
                NSTextAlignment.Center);

            GuiConnectButtonImage.Image = NSImage.ImageNamed("buttonConnected");

            var    frame     = GuiConnectButtonImage.Frame;
            CGRect oldBounds = new CGRect(0, 0, frame.Width, frame.Height);
            nfloat offset    = frame.Width * 0.1f;
            CGRect newBounds = new CGRect(-offset, -offset, oldBounds.Width + offset * 2, oldBounds.Height + offset * 2);

            GuiConnectButtonImage.Bounds = newBounds;

            NSAnimationContext.RunAnimation((NSAnimationContext context) =>
            {
                context.Duration = 0.5f;

                ((NSView)GuiConnectButtonImage.Animator).Bounds       = oldBounds;
                ((NSView)GuiConnectButtonImage.Animator).AlphaValue   = 1f;
                ((NSView)GuiLabelToDoDescription.Animator).AlphaValue = 1f;
            },
                                            () =>
            {
                GuiConnectButtonImage.Bounds = oldBounds;
                ShowConnectedStatusAtimation();
            });
        }
示例#21
0
        void tableViewSelectionDidChange(NSNotification aNotification)
        {
            nint selectedIndex = TableView.SelectedRow;

            if (selectedIndex < 0 || selectedIndex == PageController.SelectedIndex)
            {
                return;
            }

            // TODO: change pageControllerDidEndLiveTransition
            // The selection of the table view changed. We want to animate to the new selection.
            // However, since we are manually performing the animation,
            // -pageControllerDidEndLiveTransition: will not be called. We are required to
            // PageController.CompleteTransition() when the animation completes.
            NSAnimationContext.RunAnimation((NSAnimationContext context) => {
                ((NSPageController)PageController.Animator).SelectedIndex = selectedIndex;
            }, PageController.CompleteTransition);
        }
示例#22
0
        protected void WireUpForceUpdateSizeRequested(ICellController cell, NSView nativeCell, NSTableView tableView)
        {
            cell.ForceUpdateSizeRequested -= _onForceUpdateSizeRequested;

            _onForceUpdateSizeRequested = (sender, e) =>
            {
                var index = tableView?.RowForView(nativeCell);
                if (index != null)
                {
                    NSAnimationContext.BeginGrouping();
                    NSAnimationContext.CurrentContext.Duration = 0;
                    var indexSetRow = NSIndexSet.FromIndex(index.Value);
                    tableView.NoteHeightOfRowsWithIndexesChanged(indexSetRow);
                    NSAnimationContext.EndGrouping();
                }
            };

            cell.ForceUpdateSizeRequested += _onForceUpdateSizeRequested;
        }
示例#23
0
        public override void AnimateDismissal(NSViewController viewController, NSViewController fromViewController)
        {
            var bottomVc = fromViewController;
            var topVc    = viewController;

            topVc.View.WantsLayer = true;
            topVc.View.LayerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay;

            NSAnimationContext.RunAnimation((context) =>
            {
                context.Duration = 1;

                (topVc.View.Animator as NSView).AlphaValue = 0;
            }, () =>
            {
                topVc.View.Superview.RemoveFromSuperview();
                topVc.View.RemoveFromSuperview();
            });
        }
        private void ShowDisconnectingAnimation(bool isPausing = false)
        {
            View.IsVisibleCircles = true;

            if (isPausing == false)
            {
                GuiConnectButtonText.AttributedStringValue = AttributedString.Create(
                    LocalizedStrings.Instance.LocalizedString("Button_Disconnecting"),
                    Colors.ConnectButtonTextColor,
                    NSTextAlignment.Center);
            }
            else
            {
                GuiConnectButtonText.AttributedStringValue = AttributedString.Create(
                    LocalizedStrings.Instance.LocalizedString("Button_Pausing"),
                    Colors.ConnectButtonTextColor,
                    NSTextAlignment.Center);
            }
            GuiConnectButtonText.AlphaValue = 1f;

            UpdateToDoLabelHiddenStatus(true);

            var    frame     = GuiConnectButtonImage.Frame;
            CGRect oldBounds = new CGRect(0, 0, frame.Width, frame.Height);
            nfloat offset    = frame.Width * 0.4f;
            CGRect newBounds = new CGRect(-offset, -offset, oldBounds.Width + offset * 2, oldBounds.Height + offset * 2);

            GuiConnectButtonImage.Bounds = oldBounds;

            NSAnimationContext.RunAnimation((NSAnimationContext context) =>
            {
                context.Duration = 0.5f;

                ((NSView)GuiConnectButtonImage.Animator).Bounds     = newBounds;
                ((NSView)GuiConnectButtonImage.Animator).AlphaValue = 0f;
            },
                                            () =>
            {
                GuiConnectButtonImage.Bounds = oldBounds;
            });

            AnimateButtonTextBlinking();
        }
示例#25
0
        public void AnimateSizeChange()
        {
            var bounds = Bounds;
            var frame  = bounds;

            frame.Height = trackHeight;
            frame.Width *= Value;

            NSAnimationContext.BeginGrouping();
            NSAnimationContext.CurrentContext.Duration  = .5;
            ((NSView)progressBackground.Animator).Frame = frame;

            var x = frame.Right;

            frame.Height = thumbHeight;
            frame.Width  = thumbWidth;
            frame.X      = x - (thumbWidth / 2);

            ((NSView)thumb.Animator).Frame = frame;
            NSAnimationContext.EndGrouping();
        }
示例#26
0
        public override void AnimatePresentation(NSViewController viewController, NSViewController fromViewController)
        {
            var bottomVc = fromViewController;
            var topVc    = viewController;

            topVc.View.WantsLayer = true;

            topVc.View.LayerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay;

            topVc.View.AlphaValue = 1;

            NSVisualEffectView backgroundView = new NSVisualEffectView();

            backgroundView.Material     = NSVisualEffectMaterial.Sheet;
            backgroundView.BlendingMode = NSVisualEffectBlendingMode.WithinWindow;
            backgroundView.AddSubview(topVc.View);
            backgroundView.AlphaValue = 0;

            bottomVc.View.AddSubview(backgroundView);

            backgroundView.LeadingAnchor.ConstraintEqualToAnchor(bottomVc.View.LeadingAnchor).Active   = true;
            backgroundView.TopAnchor.ConstraintEqualToAnchor(bottomVc.View.TopAnchor).Active           = true;
            backgroundView.BottomAnchor.ConstraintEqualToAnchor(bottomVc.View.BottomAnchor).Active     = true;
            backgroundView.TrailingAnchor.ConstraintEqualToAnchor(bottomVc.View.TrailingAnchor).Active = true;

            topVc.View.LeadingAnchor.ConstraintEqualToAnchor(backgroundView.LeadingAnchor).Active   = true;
            topVc.View.TopAnchor.ConstraintEqualToAnchor(backgroundView.TopAnchor).Active           = true;
            topVc.View.BottomAnchor.ConstraintEqualToAnchor(backgroundView.BottomAnchor).Active     = true;
            topVc.View.TrailingAnchor.ConstraintEqualToAnchor(backgroundView.TrailingAnchor).Active = true;

            backgroundView.Frame = bottomVc.View.Frame;
            topVc.View.Frame     = bottomVc.View.Frame;

            NSAnimationContext.RunAnimation((context) =>
            {
                context.Duration = 1;
                (backgroundView.Animator as NSView).AlphaValue = 1;
            });
        }
示例#27
0
        public void InitializeOutlineView()
        {
            if (IndexDataManager.IndexNodeList == null || IndexDataManager.IndexNodeList.Count == 0)
            {
                IndexLabel.StringValue     = "Publication Index";
                IndexInfoLabel.StringValue = "There are no index files available for this publication.";
                InfoCustomView.Hidden      = false;
                IndexOutlineView.EnclosingScrollView.Hidden = true;
            }
            else
            {
                IndexOutlineView.EnclosingScrollView.Hidden = false;
                InfoCustomView.Hidden = true;

                //IndexOutlineView.SelectionShouldChange += (t) => true;
                //IndexOutlineView.EnclosingScrollView.BackgroundColor = NSColor.Clear;
                IndexOutlineView.DataSource = new IndexTableViewDataSources(this);
                IndexOutlineView.Delegate   = new IndexTableViewDelegate(this);
                IndexOutlineView.EnclosingScrollView.BorderType = NSBorderType.NoBorder;
                IndexOutlineView.GridStyleMask = NSTableViewGridStyle.DashedHorizontalGridLine;

                IndexOutlineView.AllowsColumnSelection   = false;
                IndexOutlineView.SelectionHighlightStyle = NSTableViewSelectionHighlightStyle.Regular;
                IndexOutlineView.EnclosingScrollView.HasHorizontalScroller = false;
                IndexOutlineView.AllowsColumnResizing = true;
                IndexOutlineView.EnclosingScrollView.ScrollerKnobStyle            = NSScrollerKnobStyle.Default;
                IndexOutlineView.EnclosingScrollView.VerticalScroller.ControlSize = NSControlSize.Small;

                IndexOutlineView.FloatsGroupRows = true;

                NSAnimationContext.BeginGrouping();
                NSAnimationContext.CurrentContext.Duration = 0;
                IndexOutlineView.ExpandItem(null, true);
                NSAnimationContext.EndGrouping();
            }
        }