public override void DidChange(NSKeyValueChange changeKind, NSIndexSet indexes, NSString forKey)
 {
     if (_ctrl != null)
     {
         _ctrl.SubtitleTextChanged();
     }
     base.DidChange(changeKind, indexes, forKey);
 }
Пример #2
0
 public void NSIndexSet_ConstructorTest()
 {
     #pragma warning disable 0219
     NSIndexSet a = new NSIndexSet ((int)5);
     #if XAMCORE_2_0
     NSIndexSet b = new NSIndexSet ((uint)5);
     NSIndexSet c = new NSIndexSet ((nint)5);
     #endif
     #pragma warning restore 0219
 }
Пример #3
0
		public override void RemoveItems (IKImageBrowserView aBrowser, NSIndexSet indexes)
		{
			//FIXME - add extension for List<T>
			//images.RemoveAt(indexes)
			List<BrowseItem> movingImages = new List<BrowseItem> ();
			foreach (int index in indexes)
				movingImages.Add (images[index]);
			foreach (BrowseItem item in movingImages)
				images.Remove (item);
			aBrowser.ReloadData();
		}
Пример #4
0
        public virtual void SetSource(IListDataSource source, IBackend sourceBackend)
        {
            this.source      = source;
            tsource          = new ListSource(source);
            Table.DataSource = tsource;

            //TODO: Reloading single rows would be slightly more efficient.
            //      According to NSTableView.ReloadData() documentation,
            //      only the visible rows are reloaded.
            source.RowInserted   += (sender, e) => Table.ReloadData();
            source.RowDeleted    += (sender, e) => Table.ReloadData();
            source.RowChanged    += (sender, e) => Table.ReloadData(NSIndexSet.FromIndex(e.Row), NSIndexSet.FromNSRange(new NSRange(0, Table.ColumnCount - 1)));
            source.RowsReordered += (sender, e) => Table.ReloadData();
        }
Пример #5
0
        protected override void HandleGroupsRemove(NotifyKeyGroupCollectionChangedEventArgs <TKey, TItem> args)
        {
            foreach (var sectionsRange in args.OldItemRanges)
            {
                int sectionIndex = sectionsRange.Index;

                foreach (var section in sectionsRange.OldItems)
                {
                    _tableViewRef.Target?.DeleteSections(NSIndexSet.FromIndex(sectionIndex), UITableViewRowAnimation.Automatic);

                    sectionIndex++;
                }
            }
        }
Пример #6
0
            public override bool WriteRows(NSTableView tableView, NSIndexSet rowIndexes, NSPasteboard pboard)
            {
                var h = Handler;

                if (h == null)
                {
                    return(false);
                }

                if (h.IsMouseDragging)
                {
                    h.DragInfo = null;
                    // give MouseMove event a chance to start the drag
                    h.DragPasteboard = pboard;


                    // check if the dragged rows are different than the selection so we can fire a changed event
                    var  dragRows             = rowIndexes.Select(r => (int)r).ToList();
                    bool isDifferentSelection = (nint)dragRows.Count != h.Control.SelectedRowCount;
                    if (!isDifferentSelection)
                    {
                        // same count, ensure they're not different rows
                        // typically only tests one entry here, as there's no way to drag more than a single non-selected item.
                        var selectedRows = h.Control.SelectedRows.ToArray();
                        for (var i = 0; i < selectedRows.Length; i++)
                        {
                            if (!dragRows.Contains((int)selectedRows[i]))
                            {
                                isDifferentSelection = true;
                                break;
                            }
                        }
                    }

                    if (isDifferentSelection)
                    {
                        h.CustomSelectedRows = dragRows;
                        h.Callback.OnSelectionChanged(h.Widget, EventArgs.Empty);
                    }

                    var args = MacConversions.GetMouseEvent(h, NSApplication.SharedApplication.CurrentEvent, false);
                    h.Callback.OnMouseMove(h.Widget, args);
                    h.DragPasteboard = null;

                    return(h.DragInfo != null);
                }

                return(false);
            }
Пример #7
0
        public void FetchResultObjectsAt()
        {
            var collection = PHAsset.FetchAssets(PHAssetMediaType.Image, null);

            if (collection.Count == 0)
            {
                XamagramImage.Image.SaveToPhotosAlbum(null);
                collection = PHAsset.FetchAssets(PHAssetMediaType.Image, null);
            }

            // Actual Test
            var obj = collection.ObjectsAt <NSObject> (NSIndexSet.FromNSRange(new NSRange(0, 1)));

            Assert.That(obj != null && obj.Count() > 0);
        }
Пример #8
0
 public override void SelectionDidChange(NSNotification notification)
 {
     if (Handler.SuppressSelectionChanged == 0)
     {
         Handler.Callback.OnSelectionChanged(Handler.Widget, EventArgs.Empty);
         var columns = NSIndexSet.FromNSRange(new NSRange(0, Handler.Control.TableColumns().Length));
         if (previouslySelected != null)
         {
             Handler.Control.ReloadData(previouslySelected, columns);
         }
         var selected = Handler.Control.SelectedRows;
         Handler.Control.ReloadData(selected, columns);
         previouslySelected = selected;
     }
 }
Пример #9
0
        void UpdateRowHeight(TreeItem pos)
        {
            if (updatingRowHeight)
            {
                return;
            }
            var row = Tree.RowForItem(pos);

            if (row < 0)
            {
                return;
            }
            RowHeights[pos] = CalcRowHeight(pos);
            Table.NoteHeightOfRowsWithIndexesChanged(NSIndexSet.FromIndex(row));
        }
Пример #10
0
        void IView.UpdateItems(IEnumerable <ViewItem> viewItems, ViewUpdateFlags flags)
        {
            isUpdating = true;
            var items = dataSource.items;

            items.Clear();
            items.AddRange(viewItems.Select((d, i) => new Item(this, d, i)));
            tableView.ReloadData();
            tableView.SelectRows(
                NSIndexSet.FromArray(items.Where(i => i.Data.IsSelected).Select(i => i.Index).ToArray()),
                byExtendingSelection: false
                );
            UpdateTimeDeltasColumn();
            isUpdating = false;
        }
Пример #11
0
        /// <summary>
        /// Removes a section at a specified location using the specified animation
        /// </summary>
        /// <param name="idx">
        /// A <see cref="System.Int32"/>
        /// </param>
        /// <param name="anim">
        /// A <see cref="UITableViewRowAnimation"/>
        /// </param>
        public void RemoveAt(int idx, UITableViewRowAnimation anim)
        {
            if (idx < 0 || idx >= Sections.Count)
            {
                return;
            }

            Sections.RemoveAt(idx);

            if (TableView == null)
            {
                return;
            }

            TableView.DeleteSections(NSIndexSet.FromIndex(idx), anim);
        }
Пример #12
0
		public override bool MoveItems (IKImageBrowserView aBrowser, NSIndexSet indexes, nint destinationIndex)
		{
			//indexes are not sequential, and may be on both sides of destinationIndex.
			//indexes will change, but I will put the items in after the item at destination
			//FIXME - missing methods on NSIndexSet
			//FIXME make an extension method on List<>
			int destination = (int) destinationIndex - (int)indexes.Where (x =>(int) x <(int) destinationIndex).Count ();
			List<BrowseItem> movingImages = new List<BrowseItem> ();
			foreach (int index in indexes)
				movingImages.Add (images[index]);
			foreach (BrowseItem item in movingImages)
				images.Remove (item);
			images.InsertRange (destination, movingImages);
			aBrowser.ReloadData();
			return true;
		}
Пример #13
0
 public override void ReloadSections(NSIndexSet sections)
 {
     if (TryApplyCollectionChange())
     {
         using (EnableOrDisableAnimations())
         {
             NativeLayout?.NotifyCollectionChange(new CollectionChangedOperation(
                                                      IndexPath.FromRowSection(0, (int)sections.FirstIndex),
                                                      (int)sections.Count,
                                                      NotifyCollectionChangedAction.Replace,
                                                      CollectionChangedOperation.Element.Group
                                                      ));
             base.ReloadSections(sections);
         }
     }
 }
Пример #14
0
        private void ActionEventRemove(Id aSender)
        {
            NSIndexSet rows = iTableView.SelectedRowIndexes;

            uint index = rows.LastIndex;

            while (index != FoundationFramework.NSNotFound)
            {
                if (index < iList.Count)
                {
                    iList.RemoveAt((int)index);
                    iOption.Set(StringListConverter.ListToString(iList));
                }
                index = rows.IndexLessThanIndex(index);
            }
        }
Пример #15
0
        public override bool AcceptDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
        {
            NSData rowData = info.DraggingPasteboard.GetDataForType(DungeonToolsConstants.ECOUNTER_INITIATIVE_DRAG_DROP_TYPE);

            if (rowData == null)
            {
                return(false);
            }
            NSIndexSet dataArray = NSKeyedUnarchiver.UnarchiveObject(rowData) as NSIndexSet;

            tableView.BeginUpdates();
            SwapCreatures(dataArray, (int)row);
            tableView.ReloadData();
            tableView.EndUpdates();
            return(true);
        }
Пример #16
0
            void OnSectionPropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                var currentSelected = _uiTableView.IndexPathForSelectedRow;

                var til        = (TemplatedItemsList <ItemsView <Cell>, Cell>)sender;
                var groupIndex = ((IList)TemplatedItemsView.TemplatedItems).IndexOf(til);

                if (groupIndex == -1)
                {
                    til.PropertyChanged -= OnSectionPropertyChanged;
                    return;
                }

                _uiTableView.ReloadSections(NSIndexSet.FromIndex(groupIndex), UITableViewRowAnimation.Automatic);
                _uiTableView.SelectRow(currentSelected, false, UITableViewScrollPosition.None);
            }
Пример #17
0
 public override NSIndexSet GetSelectionIndexes(NSTableView tableView, NSIndexSet proposedSelectionIndexes)
 {
     if (updating)
     {
         return(proposedSelectionIndexes);
     }
     Notify(() =>
     {
         owner.OnSelect?.Invoke(
             proposedSelectionIndexes
             .Select(row => dataSource.items[(int)row])
             .ToArray()
             );
     });
     return(proposedSelectionIndexes);
 }
Пример #18
0
        public override void RemoveItems(IKImageBrowserView aBrowser, NSIndexSet indexes)
        {
            //FIXME - add extension for List<T>
            //images.RemoveAt(indexes)
            List <BrowseItem> movingImages = new List <BrowseItem> ();

            foreach (int index in indexes)
            {
                movingImages.Add(images[index]);
            }
            foreach (BrowseItem item in movingImages)
            {
                images.Remove(item);
            }
            aBrowser.ReloadData();
        }
Пример #19
0
        void HandleExpandEvent(Chapter chapter, NSIndexPath indexPath)
        {
            try
            {
                List <Page> pageList = BooksOnDeviceAccessor.GetPages(bookID, chapter.ID);
                if (pageList != null)
                {
                    foreach (var page in pageList)
                    {
                        List <Note> notesOnPage = BooksOnDeviceAccessor.GetNotes(bookID, page.ID);
                        if (notesOnPage != null && notesOnPage.Count > 0)
                        {
                            // Sort by latest
                            notesOnPage.Sort((x, y) => x.ModifiedUtc.CompareTo(y.ModifiedUtc));

                            // headerNote
                            Note headerNote = new Note();
                            headerNote.Text   = "Header: " + page.ID;
                            headerNote.PageID = page.ID;
                            notesOnPage.Insert(0, headerNote);

                            // footerNote
                            Note footerNote = new Note();
                            footerNote.Text   = "Footer: " + page.ID;
                            footerNote.PageID = page.ID;
                            notesOnPage.Add(footerNote);

                            if (dictionary.ContainsKey(chapter))
                            {
                                List <Note> noteList = dictionary [chapter];
                                noteList.AddRange(notesOnPage);
                                dictionary [chapter] = noteList;
                            }
                        }
                    }

                    // Remove last separator
                    dictionary [chapter].RemoveAt(dictionary [chapter].Count - 1);
                }

                collectionView.ReloadSections(NSIndexSet.FromIndex(indexPath.Section));
            }
            catch (Exception ex)
            {
                Logger.WriteLineDebugging("NoteDataSource - HandleExpandEvent: {0}", ex.ToString());
            }
        }
        private NSIndexSet GetSelectionIndexesFilter(NSTableView tableView, NSIndexSet proposedSelectionIndexes)
        {
            var selectionIndexes = new NSMutableIndexSet(proposedSelectionIndexes);

            foreach (int index in proposedSelectionIndexes)
            {
                if (index < DataContext.AvailableSerialPorts.Count())
                {
                    var port = DataContext.AvailableSerialPorts[(int)index];
                    if (DataContext.DisabledSerialPorts.Contains(port.PortName))
                    {
                        selectionIndexes.Remove((nuint)index);
                    }
                }
            }
            return(selectionIndexes);
        }
Пример #21
0
        public override UITableViewCell GetCell(UITableView tableview, NSIndexPath indexpath)
        {
            var index = indexpath.Row;

            var cell = new CalTableCell(workouts, cellHt, index, calVC);

            cell.SelectionStyle = UITableViewCellSelectionStyle.None;
            UITapGestureRecognizer tapPlus = new UITapGestureRecognizer();

            tapPlus.AddTarget(() => {
                tableview.InsertSections(NSIndexSet.FromIndex((nint)index), UITableViewRowAnimation.Top);
            });
            cell.UserInteractionEnabled = true;
            cell.UpdateCell(index);

            return(cell);
        }
Пример #22
0
            public NSImage DragImageForRows(NSIndexSet dragRows, NSTableColumn[] tableColumns, NSEvent dragEvent, ref CGPoint dragImageOffset)
            {
                var dragInfo = Handler?.DragInfo;
                var img      = dragInfo?.DragImage;

                if (img != null)
                {
                    dragImageOffset = dragInfo.GetDragImageOffset();
                    return(img);
                }

                NSArray nSArray = NSArray.FromNSObjects(tableColumns);
                NSImage result  = Runtime.GetNSObject <NSImage>(Messaging.IntPtr_objc_msgSendSuper_IntPtr_IntPtr_IntPtr_ref_CGPoint(SuperHandle, selDragImageForRowsWithIndexes_TableColumns_Event_Offset_Handle, dragRows.Handle, nSArray.Handle, dragEvent.Handle, ref dragImageOffset));

                nSArray.Dispose();
                return(result);
            }
Пример #23
0
        public override void SelectionDidChange(NSNotification notification)
        {
            NSIndexSet selectedIndexs = Controller.SelectedRows;

            if (selectedIndexs.Count != 1)
            {
                Controller.RaiseClickedEvent(null);
            }
            else
            {
                var item = (Controller.DataSource as FileItemTableDataSource).Files[(int)selectedIndexs.FirstIndex];
                if (item != null)
                {
                    Controller.RaiseClickedEvent(item);
                }
            }
        }
        public void ReplaceObjectsTest()
        {
            var str1 = (NSString)"1";
            var str2 = (NSString)"2";
            var str3 = (NSString)"3";
            var str4 = (NSString)"4";

            var oSet = new NSMutableOrderedSet <NSString> (str1, str2);

            Assert.AreEqual((nint)2, oSet.Count, "ReplaceObjectsTest Count");
            Assert.AreSame(str1, oSet[0], "ReplaceObjectsTest 1 == 1");
            Assert.AreSame(str2, oSet[1], "ReplaceObjectsTest 2 == 2");

            oSet.ReplaceObjects(NSIndexSet.FromNSRange(new NSRange(0, 2)), str3, str4);
            Assert.AreSame(str3, oSet[0], "ReplaceObjectsTest 3 == 3");
            Assert.AreSame(str4, oSet[1], "ReplaceObjectsTest 4 == 4");
        }
Пример #25
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            pageDelegate            = new PageControllerDelegate(this);
            PageController.Delegate = pageDelegate;

            // load all the file card URLs by enumerating through the user's Document folder
            IEnumerable <NSUrl> fileUrls = GetFileUrls(DocumentDirectory);

            FileObject[] data = fileUrls.Where(url => !url.IsDir()).Select(url => new FileObject(url)).ToArray();

            // set the first card in our list
            if (data.Length > 0)
            {
                PageController.ArrangedObjects = data;
                TableView.SelectRows(NSIndexSet.FromIndex(0), false);
            }
        }
        public override void SelectionDidChange(NSNotification notification)
        {
            NSIndexSet selectedIndex = Controller.SelectedRows;

            if (selectedIndex.Count != 1)
            {
                Controller.RaiseClickedEvent(null);
            }
            else
            {
                var item = DataSource.Contacts[(int)selectedIndex.FirstIndex];
                if (item != null)
                {
                    Controller.RaiseClickedEvent(item);
                }
            }
        }
Пример #27
0
        /// <summary>
        /// Selections the did change.
        /// </summary>
        /// <param name="notification">Notification.</param>
        public override void SelectionDidChange(NSNotification notification)
        {
            NSIndexSet selectedIndexes = _controller.SelectedRows;

            if (selectedIndexes.Count > 1)
            {
            }
            else
            {
                var item = _controller.Data.ItemForRow((int)selectedIndexes.FirstIndex);
                if (item != null)
                {
                    item.RaiseClickedEvent();
                    _controller.RaiseItemSelected(item);
                }
            }
        }
Пример #28
0
            void UpdateStructure(IReadOnlyList <IListItem> newList)
            {
                var edits = ListEdit.GetListEdits(items, newList);

                items = newList;

                var        columns       = tableView.TableColumns();
                NSIndexSet allColumnsSet = null;

                foreach (var e in edits)
                {
                    switch (e.Type)
                    {
                    case ListEdit.EditType.Insert:
                        tableView.InsertRows(new NSIndexSet(e.Index), NSTableViewAnimation.None);
                        break;

                    case ListEdit.EditType.Delete:
                        tableView.RemoveRows(new NSIndexSet(e.Index), NSTableViewAnimation.None);
                        break;

                    case ListEdit.EditType.Reuse:
                        if (owner.OnUpdateView != null && owner.OnCreateView != null)
                        {
                            for (int col = 0; col < columns.Length; ++col)
                            {
                                var existingView = tableView.GetView(col, e.Index, makeIfNecessary: false);
                                if (existingView != null)
                                {
                                    owner.OnUpdateView(e.Item, columns[col], existingView, e.OldItem);
                                }
                            }
                        }
                        else
                        {
                            if (allColumnsSet == null)
                            {
                                allColumnsSet = NSIndexSet.FromArray(Enumerable.Range(0, columns.Length).ToArray());
                            }
                            tableView.ReloadData(new NSIndexSet(e.Index), allColumnsSet);
                        }
                        break;
                    }
                }
            }
Пример #29
0
        public void SortData(NSSortDescriptor[] descriptors)
        {
            NSIndexSet selections = tableView.SelectedRows;
            // Get a list of people to be removed
            List <Person> selectedPersons = new List <Person>();

            for (int i = 0; i < selections.Count; i++)
            {
                int    index = (int)selections.ElementAt(i);
                Person p     = Employees[index];
                selectedPersons.Add(p);
            }
            if (descriptors.Count <NSSortDescriptor>() > 0)
            {
                NSSortDescriptor descriptor = descriptors[0];
                if (descriptor.Key == "name")
                {
                    if (descriptor.Ascending)
                    {
                        _employees.Sort((emp1, emp2) => emp1.Name.ToLower().CompareTo(emp2.Name.ToLower()));
                    }
                    else
                    {
                        _employees.Sort((emp1, emp2) => emp2.Name.ToLower().CompareTo(emp1.Name.ToLower()));
                    }
                }
                else if (descriptor.Key == "expectedRaise")
                {
                    if (descriptor.Ascending)
                    {
                        _employees.Sort((emp1, emp2) => emp1.ExpectedRaise.CompareTo(emp2.ExpectedRaise));
                    }
                    else
                    {
                        _employees.Sort((emp1, emp2) => emp2.ExpectedRaise.CompareTo(emp1.ExpectedRaise));
                    }
                }
            }

            tableView.DeselectAll(this);
            foreach (Person p in selectedPersons)
            {
                tableView.SelectRow(Employees.IndexOf(p), true);
            }
        }
        public void InsertObjectsTest()
        {
            var str1 = (NSString)"1";
            var str2 = (NSString)"2";
            var str3 = (NSString)"3";
            var str4 = (NSString)"4";
            var oSet = new NSMutableOrderedSet <NSString> (str4);

            oSet.InsertObjects(new[] { str1, str2, str3 }, NSIndexSet.FromNSRange(new NSRange(0, 3)));

            Assert.AreEqual((nint)4, oSet.Count, "InsertObjectsTest Count");
            Assert.IsTrue(oSet.Contains(str1), "InsertObjectsTest Contains 1");
            Assert.IsTrue(oSet.Contains(str2), "InsertObjectsTest Contains 2");
            Assert.IsTrue(oSet.Contains(str3), "InsertObjectsTest Contains 3");
            Assert.IsTrue(oSet.Contains(str4), "InsertObjectsTest Contains 4");
            Assert.AreSame(str1, oSet[0], "InsertObjectsTest 1 == 1");
            Assert.AreSame(str4, oSet[3], "InsertObjectsTest 4 == 4");
        }
Пример #31
0
        private void UpdateSections(NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                if (e.NewStartingIndex == -1)
                {
                    goto case NotifyCollectionChangedAction.Reset;
                }

                Control.BeginUpdates();
                Control.InsertSections(NSIndexSet.FromIndex(e.NewStartingIndex), UITableViewRowAnimation.Automatic);
                Control.EndUpdates();
                break;

            case NotifyCollectionChangedAction.Remove:
                if (e.OldStartingIndex == -1)
                {
                    goto case NotifyCollectionChangedAction.Reset;
                }

                Control.BeginUpdates();
                Control.DeleteSections(NSIndexSet.FromIndex(e.OldStartingIndex), UITableViewRowAnimation.Automatic);
                Control.EndUpdates();
                break;

            case NotifyCollectionChangedAction.Replace:
                if (e.OldStartingIndex == -1)
                {
                    goto case NotifyCollectionChangedAction.Reset;
                }

                Control.BeginUpdates();
                Control.ReloadSections(NSIndexSet.FromIndex(e.OldStartingIndex), UITableViewRowAnimation.Automatic);
                Control.EndUpdates();
                break;

            case NotifyCollectionChangedAction.Move:
            case NotifyCollectionChangedAction.Reset:

                Control.ReloadData();
                return;
            }
        }
Пример #32
0
        public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, Foundation.NSIndexPath indexPath)
        {
            switch (editingStyle)
            {
            case UITableViewCellEditingStyle.Delete:
                // remove the item from the underlying data source
                int didDelete = new DatabaseContext <ImageAttributes>().Delete(tableItems[indexPath.Row].ID);
                if (didDelete > 0)
                {
                    tableItems.RemoveAt(indexPath.Row);
                    tableView.DeleteSections(NSIndexSet.FromIndex(indexPath.Section), UITableViewRowAnimation.Fade);
                }
                break;

            case UITableViewCellEditingStyle.None:
                Console.WriteLine("CommitEditingStyle:None called");
                break;
            }
        }
Пример #33
0
        public override void DidSelectRow(WKInterfaceTable table, nint rowIndex)
        {
            var newCityNames = new [] { "Saratoga", "San Jose" };

            var newCityIndexes = NSIndexSet.FromNSRange(new NSRange(rowIndex + 1, newCityNames.Length));

            // Insert new rows into the table.
            interfaceTable.InsertRows(newCityIndexes, "default");

            // Update the rows that were just inserted with the appropriate data.
            var newCityNumber = 0;

            newCityIndexes.EnumerateIndexes((nuint idx, ref bool stop) => {
                var newCityName = newCityNames [newCityNumber];
                var row         = (TableRowController)interfaceTable.GetRowController((nint)idx);
                row.RowLabel.SetText(newCityName);
                newCityNumber++;
            });
        }
Пример #34
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;
        }
		// Reloads the associated service section in the table view.
		void DidUpdateAssociatedServiceType ()
		{
			var associatedServiceTypeIndexSet = new NSIndexSet ((nuint)(int)CharacteristicTableViewSection.AssociatedServiceType);
			TableView.ReloadSections (associatedServiceTypeIndexSet, UITableViewRowAnimation.Automatic);
		}
		static NSIndexPath [] ToNSIndexPaths (NSIndexSet indexSet)
		{
			var cnt = indexSet.Count;
			var result = new NSIndexPath [(int)cnt];
			int i = 0;
			indexSet.EnumerateIndexes ((nuint idx, ref bool stop) => {
				stop = false;
				result [i++] = NSIndexPath.FromItemSection ((nint)idx, 0);
			});
			return result;
		}
		private NSIndexPath[] GetIndexesWithSection(NSIndexSet indexes, nint section) 
		{
			var indexPaths = new List<NSIndexPath>();
			indexes.EnumerateIndexes((nuint idx, ref bool stop) => {
				indexPaths.Add(NSIndexPath.FromItemSection((nint) idx, section));
			});
			return indexPaths.ToArray();
		}
 public override void DidChange(NSKeyValueChange changeKind, NSIndexSet indexes, NSString forKey)
 {
     _ctrl.SearchTextChanged();
     base.DidChange(changeKind, indexes, forKey);
 }
		List<NSIndexPath> indexPathsFromIndexSet (NSIndexSet indexSet)
		{
			List<NSIndexPath> indexPaths = new List<NSIndexPath> ();

			if (indexSet == null) return indexPaths;

			indexSet.EnumerateIndexes((nuint idx, ref bool stop) => indexPaths.Add(NSIndexPath.FromItemSection((nint)idx, 0)));

			return indexPaths;
		}
            /// <summary>
            /// Toggles the time picker cell on or off.
            /// If any other picker cells are on, turns them off.
            /// </summary>
            /// <param name="tableView">The UITableView the cell is associated with.</param>
            private void toggleTimePickerCell(UITableView tableView)
            {
                // Toggle the timePicker cell
                this.timePicker.Hidden = this.timePickerIsShowing;
                this.timePickerIsShowing = !this.timePickerIsShowing;

                // Close any other picker cells
                if (this.dayPickerIsShowing)
                    toggleDayPickerCell (tableView);

                // Reload the section
                NSIndexSet sections = new NSIndexSet (PICKER_SECTION);
                tableView.ReloadSections (sections, UITableViewRowAnimation.Fade);
            }
Пример #41
0
        public void ExtractRAR(MainWindow  window, NSTableView TableView, NSIndexSet nSelRows, string rarFile, string extractPath)
        {
            clsIOPrefs ioPrefs = new clsIOPrefs ();
            string txtRAR = ioPrefs.GetStringValue ("CaminhoRAR");
            if (txtRAR.Length > 0) {

                if (nSelRows.Count > 0) {

                    ProgressWindowController sheet = null;
                    TableView.InvokeOnMainThread (delegate {
                        sheet = new ProgressWindowController  ();
                        sheet.ShowSheet (window);
                    });

                    sheet.InvokeOnMainThread(delegate{
                        sheet.ProgressBarMinValue = 0;
                        sheet.ProgressBarMaxValue = nSelRows.Count;
                    });

                    double conta = 0;
                    bool Cancela = false;

                    nuint[] nRows = nSelRows.ToArray ();

                    ViewArquivosDataSource datasource = null;
                    TableView.InvokeOnMainThread(delegate
                        {
                            datasource = (ViewArquivosDataSource)TableView.DataSource;
                        });

                    foreach (int lRow in nRows) {
                        string NomeArq = datasource.ViewArquivos [lRow].Nome;

                        ++conta;

                        sheet.InvokeOnMainThread(delegate{
                            sheet.LabelArqValue = "Extraindo arquivo: " + NomeArq;
                            sheet.ProgressBarValue = conta;
                        });

                        string[] launchArgs = { "x", rarFile, NomeArq, extractPath };
                        NSPipe pipeOut = new NSPipe ();
                        NSTask t = new NSTask ();
                        t.LaunchPath = txtRAR;
                        t.Arguments = launchArgs;
                        t.StandardOutput = pipeOut;
                        t.Launch ();
                        t.WaitUntilExit();

                        //string txtRET = pipeOut.ReadHandle.ReadDataToEndOfFile ().ToString ();

                        sheet.InvokeOnMainThread(delegate{
                            Cancela = sheet.Canceled;
                        });
                        if(Cancela) {
                            break;
                        }

                    }

                    sheet.InvokeOnMainThread (delegate {
                        sheet.CloseSheet ();
                        sheet = null;
                    });

                    if (!Cancela)
                    {
                        TableView.InvokeOnMainThread (delegate {
                            NSAlert alert = new NSAlert () {
                                AlertStyle = NSAlertStyle.Informational,
                                InformativeText = "Arquivo(s) extraido(s) com sucesso !",
                                MessageText = "Extrair arquivos",
                            };
                            alert.RunSheetModal(window);
                        });

                    }

                }
            }
        }
Пример #42
0
 public NSArray TableViewNamesOfPromisedFilesDroppedAtDestinationForDraggedRowsWithIndexes(NSTableView aTableView, NSURL dropDestination, NSIndexSet indexSet)
 {
     throw new NotImplementedException ();
 }
		void DidUpdateSongQueue (object sender, EventArgs e)
		{
			var indexSet = new NSIndexSet (0);
			cachedSongQueue = ((SongManager)sender).SongQueue;
			DispatchQueue.MainQueue.DispatchAsync (() => {
				SongTableView.ReloadSections (indexSet, UITableViewRowAnimation.Fade);
				UpdateAlbumViewWithSong (null);
				SelectFirstRow ();
			});
		}
Пример #44
0
 public bool TableViewWriteRowsWithIndexesToPasteboard(NSTableView aTableView, NSIndexSet rowIndexes, NSPasteboard pboard)
 {
     throw new NotImplementedException ();
 }
Пример #45
0
		public override NSImage dragImageForRowsWithIndexes(NSIndexSet dragRows) tableColumns(NSArray tableColumns) @event(NSEvent dragEvent) offset(NSPointPointer dragImageOffset)
Пример #46
0
        public bool WriteRowsWithIndexesToPasteboard(NSTableView tableView, NSIndexSet rowIndexes, NSPasteboard pboard)
        {
            //Console.WriteLine(">>> WriteRowsWithIndexesToPasteboard");
            string dataType = string.Empty;
            if (tableView == tableSegments)
                dataType = "Segment";
            else if (tableView == tableMarkers)
                dataType = "Marker";

            pboard.DeclareTypes(new string[1] { dataType }, this);
            byte index = (byte)rowIndexes.Last();
            var data = NSData.FromArray(new byte[1] { index });
            pboard.SetDataForType(data, dataType);
            return true;
        }
Пример #47
0
        private void CalculateBoundingRectangle(NSIndexSet selectionIndexes, out CGRect boundingRectangle)
        {
            boundingRectangle = CGRect.Empty;

            if (selectionIndexes.Count == 0)
            {
                // No selection
                return;
            }

            var rectangles = rectanglesBinding.GetData<NSMutableArray>();

            foreach (var selectionIndex in selectionIndexes)
            {
                var rect = rectangles.GetItem<PinboardData.RectangleInfo>(selectionIndex).Rectangle;

                if (boundingRectangle.IsEmpty)
                {
                    boundingRectangle = rect;
                }
                else
                {
                    boundingRectangle = CGRect.Union(boundingRectangle, rect);
                }
            }
        }
Пример #48
-1
 public void NSIndexSet_EmptyToList()
 {
     NSIndexSet a = new NSIndexSet ();
     #pragma warning disable 0219
     var b = a.ToList ();
     #pragma warning restore 0219
 }