public override void SortDescriptorsChanged(NSOutlineView outlineView, NSSortDescriptor[] oldDescriptors)
 {
     if (oldDescriptors.Length > 0)
     {
         outlineView.ReloadData();
     }
 }
コード例 #2
0
		public override void SortDescriptorsChanged (NSOutlineView outlineView, NSSortDescriptor[] oldDescriptors)
		{
			// Any sort direction given?
			if (oldDescriptors.Length <= 0)
				return;

			// Sort the data
			Sort (oldDescriptors [0].Key, oldDescriptors [0].Ascending);
			outlineView.ReloadData ();
		}
コード例 #3
0
        void ReloadItems(NSOutlineView outlineView, IReactiveList <T> _items, Func <T, string> groupBy, Func <T, string> iconExtractor, Func <T, string> titleExtractor)
        {
            this.items = _items
                         .GroupBy(groupBy)
                         .Select(group => {
                var children = group.Select(item => new GenericOutlineItemWrapper(iconExtractor(item), titleExtractor(item))).ToList();
                return(new GenericOutlineItemWrapper("", group.Key, children, true));
            })
                         .ToList();

            outlineView.ReloadData();
        }
コード例 #4
0
        public override void SortDescriptorsChanged(NSOutlineView outlineView, NSSortDescriptor[] oldDescriptors)
        {
            // Any sort direction given?
            if (oldDescriptors.Length <= 0)
            {
                return;
            }

            // Sort the data
            Sort(oldDescriptors [0].Key, oldDescriptors [0].Ascending);
            outlineView.ReloadData();
        }
コード例 #5
0
        public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
        {
            var node = (Node)item;

            var view = new NSTableCellView();

            //TextField
            view.TextField = new NSTextField(new CGRect(20, 0, 400, 16));
            view.AddSubview(view.TextField);

            view.TextField.BackgroundColor = NSColor.Clear;
            view.TextField.Bordered        = false;
            view.TextField.Editable        = false;
            view.TextField.Selectable      = false;

            view.TextField.StringValue = node.Name;
            view.TextField.ToolTip     = node.Name;


            //CheckBox
            var checkBox = new NSButton(new CGRect(5, 0, 16, 16));

            view.AddSubview(checkBox);

            checkBox.SetButtonType(NSButtonType.Switch);
            checkBox.AllowsMixedState = true;

            checkBox.State = StateConverter.ConvertNodeState(node);

            checkBox.Activated += (sender, e) => {
                var ckb = (NSButton)sender;

                if (ckb.State == NSCellStateValue.Mixed)
                {
                    ckb.State = NSCellStateValue.On;
                }

                var state = StateConverter.ConvertCheckboxState(ckb);

                node.SetStateToChildren(state);
                node.SetStateToParent(state);

                outlineView.ReloadData();
            };

            return(view);
        }
        private NSView CreateAddNewButtonView(DataSourceOutlineViewSourceFieldsInfo field, NSOutlineView outlineView)
        {
            NSButton button = new NSButton
            {
                Title            = "Add New",
                ImagePosition    = NSCellImagePosition.ImageLeft,
                Alignment        = NSTextAlignment.Left,
                Bordered         = false,
                Image            = NSImage.ImageNamed("NSAddTemplate"),
                ContentTintColor = NSColor.Black
            };

            button.Activated += (sender, e) =>
            {
                field.FieldGroupParent.AddEmptyFieldValue();
                outlineView.ReloadData();
            };

            return(button);
        }
コード例 #7
0
ファイル: DragDelegate.cs プロジェクト: mawcc/Polarix
        public override bool PerformDragOperation(NSDraggingInfo sender)
        {
            Console.WriteLine("Drag Delegate received 'PerformDragOperation' sender: {0}", sender);

            //It seems that browserView does not send this message when it is an internal move.
            //It does all the work by sending a moveitems message to the datasource,
            // but I return false here just to be safe.

            NSObject obj = sender.DraggingSource;

            if (obj != null && obj.Equals(outlineView))
            {
                Console.WriteLine("\tLet the image browser handle it.");
                return(false);
            }

            NSPasteboard pb   = sender.DraggingPasteboard;
            NSArray      data = null;

            if (pb.Types.Contains(NSPasteboard.NSFilenamesType))
            {
                data = pb.GetPropertyListForType(NSPasteboard.NSFilenamesType) as NSArray;
            }
            if (data != null)
            {
                for (int i = 0; i < data.Count; i++)
                {
                    string path = (string)NSString.FromHandle(data.ValueAt((uint)i));
                    Console.WriteLine("From pasteboard Item {0} = {1}", i, path);
                    ((TreeDataSource)outlineView.DataSource).Directories.Add(
                        new Directory(NSUrl.FromFilename(path).AbsoluteString));
                    outlineView.ReloadData();
                }
            }
            return(true);
        }
コード例 #8
0
 public void ReloadOutlineView(NSNotification notification)
 {
     MainOutlineView.ReloadData();
 }
コード例 #9
0
        void ShowFolderSeletionPage()
        {
            Header      = Properties_Resources.Which;
            Description = "";
            bool firstRepo = true;

            Repositories = new List <RootFolder>();
            Loader       = new Dictionary <string, AsyncNodeLoader> ();
            foreach (KeyValuePair <String, String> repository in Controller.repositories)
            {
                RootFolder repo = new RootFolder()
                {
                    Name    = repository.Value,
                    Id      = repository.Key,
                    Address = Controller.saved_address.ToString()
                };
                Repositories.Add(repo);
                if (firstRepo)
                {
                    repo.Selected = true;
                    firstRepo     = false;
                }
                else
                {
                    repo.Selected = false;
                }
                CmisRepoCredentials cred = new CmisRepoCredentials()
                {
                    UserName = Controller.saved_user,
                    Password = Controller.saved_password,
                    Address  = Controller.saved_address,
                    RepoId   = repository.Key
                };
                AsyncNodeLoader asyncLoader = new AsyncNodeLoader(repo, cred, PredefinedNodeLoader.LoadSubFolderDelegate, PredefinedNodeLoader.CheckSubFolderDelegate);
                asyncLoader.UpdateNodeEvent += delegate {
                    InvokeOnMainThread(delegate {
                        DataSource.UpdateCmisTree(repo);
                        NSOutlineView view = OutlineController.OutlineView();
                        for (int i = 0; i < view.RowCount; ++i)
                        {
                            view.ReloadItem(view.ItemAtRow(i));
                        }
                    });
                };
                asyncLoader.Load(repo);
                Loader.Add(repo.Id, asyncLoader);
            }
            DataSource = new CmisTree.CmisTreeDataSource(Repositories);
            DataSource.SelectedEvent += delegate(NSCmisTree cmis, int selected) {
                InvokeOnMainThread(delegate {
                    RootFolder selectedRoot = null;
                    foreach (RootFolder root in Repositories)
                    {
                        Node node = cmis.GetNode(root);
                        if (node != null)
                        {
                            if (node.Parent == null && node.Selected == false)
                            {
                                selectedRoot = root;
                            }
                            node.Selected = (selected != 0);
                            DataSource.UpdateCmisTree(root);
                        }
                    }

                    NSOutlineView view = OutlineController.OutlineView();
                    if (selectedRoot != null)
                    {
                        foreach (RootFolder root in Repositories)
                        {
                            if (root != selectedRoot)
                            {
                                root.Selected = false;
                                DataSource.UpdateCmisTree(root);
                            }
                        }
                        view.ReloadData();
                    }
                    else
                    {
                        for (int i = 0; i < view.RowCount; ++i)
                        {
                            view.ReloadItem(view.ItemAtRow(i));
                        }
                    }
                });
            };
            DataDelegate      = new OutlineViewDelegate();
            OutlineController = new CmisOutlineController(DataSource, DataDelegate);
            ContinueButton    = new NSButton()
            {
                Title   = Properties_Resources.Continue,
                Enabled = (Repositories.Count > 0)
            };
            CancelButton = new NSButton()
            {
                Title = Properties_Resources.Cancel
            };
            NSButton BackButton = new NSButton()
            {
                Title = Properties_Resources.Back
            };

//            DataDelegate.SelectionChanged += delegate
//            {
//                InvokeOnMainThread(delegate {
//                    NSOutlineView view = OutlineController.OutlineView();
//                    if (view.SelectedRow >= 0) {
//                        ContinueButton.Enabled = true;
//                    } else {
//                        ContinueButton.Enabled = false;
//                    }
//                });
//            };
            DataDelegate.ItemExpanded += delegate(NSNotification notification)
            {
                InvokeOnMainThread(delegate {
                    NSCmisTree cmis = notification.UserInfo["NSObject"] as NSCmisTree;
                    if (cmis == null)
                    {
                        Console.WriteLine("ItemExpanded Error");
                        return;
                    }

                    NSCmisTree cmisRoot = cmis;
                    while (cmisRoot.Parent != null)
                    {
                        cmisRoot = cmisRoot.Parent;
                    }
                    RootFolder root = Repositories.Find(x => x.Name.Equals(cmisRoot.Name));
                    if (root == null)
                    {
                        Console.WriteLine("ItemExpanded find root Error");
                        return;
                    }

                    Node node = cmis.GetNode(root);
                    if (node == null)
                    {
                        Console.WriteLine("ItemExpanded find node Error");
                        return;
                    }
                    Loader[root.Id].Load(node);
                });
            };
            ContinueButton.Activated += delegate
            {
                InvokeOnMainThread(delegate {
                    NSOutlineView view = OutlineController.OutlineView();
//                    NSCmisTree cmis = (NSCmisTree)(view.ItemAtRow(view.SelectedRow));
//                    while (cmis.Parent != null)
//                        cmis = cmis.Parent;
//                    RootFolder root = Repositories.Find(x=>x.Name.Equals(cmis.Name));
                    RootFolder root = Repositories.Find(x => (x.Selected != false));
                    if (root != null)
                    {
                        foreach (AsyncNodeLoader task in Loader.Values)
                        {
                            task.Cancel();
                        }
                        Controller.saved_repository = root.Id;
                        List <string> ignored       = NodeModelUtils.GetIgnoredFolder(root);
                        List <string> selected      = NodeModelUtils.GetSelectedFolder(root);
                        Controller.Add2PageCompleted(root.Id, root.Path, ignored.ToArray(), selected.ToArray());
                    }
                });
            };
            CancelButton.Activated += delegate
            {
                InvokeOnMainThread(delegate
                {
                    foreach (AsyncNodeLoader task in Loader.Values)
                    {
                        task.Cancel();
                    }
                    Controller.PageCancelled();
                });
            };
            BackButton.Activated += delegate
            {
                InvokeOnMainThread(delegate
                {
                    foreach (AsyncNodeLoader task in Loader.Values)
                    {
                        task.Cancel();
                    }
                    Controller.BackToPage1();
                });
            };

            OutlineController.View.Frame = new RectangleF(190, 60, 400, 240);
            ContentView.AddSubview(OutlineController.View);
            Buttons.Add(ContinueButton);
            Buttons.Add(BackButton);
            Buttons.Add(CancelButton);
        }
コード例 #10
0
 public override void SortDescriptorsChanged(NSOutlineView outlineView, NSSortDescriptor[] oldDescriptors)
 {
     // Sort the data
     Sort(oldDescriptors [0].Key, oldDescriptors [0].Ascending);
     outlineView.ReloadData();
 }
コード例 #11
0
		public override void SortDescriptorsChanged (NSOutlineView outlineView, NSSortDescriptor[] oldDescriptors)
		{
			// Sort the data
			Sort (oldDescriptors [0].Key, oldDescriptors [0].Ascending);
			outlineView.ReloadData ();
		}