コード例 #1
0
        public void UpdateDocumentColor(NSUrl documentUrl, ListColor newColor)
        {
            ListInfo listInfo = new ListInfo(documentUrl);

            int index = listInfos.IndexOf(listInfo);

            if (index != -1)
            {
                listInfo       = listInfos[index];
                listInfo.Color = newColor;

                NSIndexPath indexPath = NSIndexPath.FromRowSection(index, 0);
                ListCell    cell      = (ListCell)TableView.CellAt(indexPath);
                cell.ListColorView.BackgroundColor = AppColors.ColorFrom(newColor);
            }
        }
コード例 #2
0
        void RemoveListInfo(ListInfo listInfo, Action <int> completionHandler)
        {
            int index = listInfos.IndexOf(listInfo);

            if (index < 0)
            {
                return;
            }

            listInfos.RemoveAt(index);

            if (completionHandler != null)
            {
                completionHandler(index);
            }
        }
コード例 #3
0
        void InsertListInfo(ListInfo listInfo, Action <int> completionHandler)
        {
            ComparisionComparer <ListInfo> comparer = new ComparisionComparer <ListInfo>((left, right) => {
                return(left.Name.CompareTo(right.Name));
            });
            // read more about return value http://msdn.microsoft.com/en-us/library/ftfdbfx6(v=vs.110).aspx
            int index = listInfos.BinarySearch(listInfo, comparer);

            index = index >= 0 ? index : ~index;

            listInfos.Insert(index, listInfo);

            if (completionHandler != null)
            {
                completionHandler(index);
            }
        }
コード例 #4
0
        public async void ConfigureWith(ListInfo listInfo)
        {
            await listInfo.FetchInfoAsync();

            if (document != null)
            {
                document.DocumentDeleted -= OnListDocumentWasDeleted;
                document.Close(null);
            }

            document = new ListDocument(listInfo.Url);
            document.DocumentDeleted += OnListDocumentWasDeleted;

            NavigationItem.Title = listInfo.Name;

            TextAttributes = new UIStringAttributes {
                Font            = UIFont.PreferredHeadline,
                ForegroundColor = AppColors.ColorFrom(listInfo.Color.Value)
            };
        }
コード例 #5
0
        public void SaveAction(NSObject sender)
        {
            ListInfo listInfo = new ListInfo(FileUrl);

            listInfo.Color = selectedColor;
            listInfo.Name  = selectedTitle;

            listInfo.CreateAndSaveWithCompletionHandler(success => {
                if (success)
                {
                    MasterController.OnNewListInfo(listInfo);
                }
                else
                {
                    // In your app, you should handle this error gracefully.
                    Console.WriteLine("Unable to create new document at URL: {0}", FileUrl.AbsoluteString);
                    throw new InvalidProgramException();
                }
                DismissViewController(true, null);
            });
        }
コード例 #6
0
        // ListInfo objects may originate from local URLs or NSMetadataItems representing document in the cloud.
        void InsertListInfoWithProvider(NSUrl provider, Action <int> completionHandler)
        {
            ListInfo listInfo = new ListInfo(provider);

            InsertListInfo(listInfo, completionHandler);
        }
コード例 #7
0
        void RemoveListInfo(NSUrl url, Action <int> completionHandler)
        {
            ListInfo listInfo = new ListInfo(url);

            RemoveListInfo(listInfo, completionHandler);
        }
コード例 #8
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            ListInfo listInfo = listInfos[indexPath.Row];

            SelectListWithListInfo(listInfo);
        }