// CircleLayout circleLayout; public SplitViewContoller() : base() { sd = new SplitDelegate(); Delegate = sd; animalsController = new AnimalsController(); flowLayout = new UICollectionViewFlowLayout() { SectionInset = new UIEdgeInsets(20, 20, 20, 20) }; animalImageController = new BingImageGridViewController(flowLayout); // circleLayout = new CircleLayout (); // animalImageController = new BingImageGridViewController (circleLayout); animalsController.AnimalSelected += (sender, e) => { animalImageController.LoadImages(e.Animal); }; ViewControllers = new UIViewController[] { animalsController, animalImageController }; }
public SplitViewContoller() : base() { splitDelegate = new SplitDelegate (); Delegate = splitDelegate; masterController = new MasterController (); flowLayout = new UICollectionViewFlowLayout (){ HeaderReferenceSize = new SizeF (UIScreen.MainScreen.Bounds.Width, 50), SectionInset = new UIEdgeInsets (20,20,20,20), ItemSize = new SizeF (100, 100) }; baseballLayout = new BaseballLayout (){ ItemSize = new SizeF (100, 100) }; decoratedFlowLayout = new DecoratedFlowLayout () { HeaderReferenceSize = new SizeF (UIScreen.MainScreen.Bounds.Width, 50), SectionInset = new UIEdgeInsets (25,100,25,100), MinimumInteritemSpacing = 5, MinimumLineSpacing = 5, ItemSize = new System.Drawing.SizeF (100, 100) }; layoutController = new BaseballPlayerController (flowLayout); masterController.LayoutSelected += (object sender, LayoutSelectedEventArgs e) => { if (e.LayoutName == "Flow Layout") { layoutController.CollectionView.SetCollectionViewLayout (flowLayout, true); layoutController.CollectionView.SetContentOffset(new System.Drawing.PointF(0,0), false); } else if (e.LayoutName == "Baseball Layout") { layoutController.CollectionView.SetCollectionViewLayout (baseballLayout, true); } else if (e.LayoutName == "Decorated Layout") { layoutController.CollectionView.SetCollectionViewLayout (decoratedFlowLayout, true); layoutController.CollectionView.SetContentOffset(new PointF(0,0), false); } }; ViewControllers = new UIViewController[] { masterController, layoutController }; }
public SplitView() : base() { // create our master and detail views masterView = new SecondViewController (); detailView = new FirstViewController (); fv = (FirstViewController)detailView; sd = new SplitDelegate (); Delegate = sd; // create an array of controllers from them and then // assign it to the controllers property ViewControllers = new UIViewController[] { masterView, detailView }; // order is important }
public SplitViewContoller () : base() { sd = new SplitDelegate (); Delegate = sd; animalsController = new AnimalsController (); layout = new UICollectionViewFlowLayout (){ SectionInset = new UIEdgeInsets (20,20,20,20) }; animalImageController = new BingImageGridViewController (layout); animalsController.AnimalSelected+= (sender, e) => { animalImageController.LoadImages (e.Animal); }; ViewControllers = new UIViewController[] { animalsController, animalImageController }; }
public SplitViewContoller() : base() { sd = new SplitDelegate(); Delegate = sd; colorsController = new ColorsController(); redVC = new UIViewController(); redVC.View.BackgroundColor = UIColor.Red; colorsController.ColorSelected += (sender, e) => { if (e.Color == "Red") { detailContainer = redVC; } else if (e.Color == "Green") { if (greenVC == null) { greenVC = new UIViewController(); greenVC.View.BackgroundColor = UIColor.Green; } detailContainer = greenVC; } ViewControllers = new UIViewController[] { colorsController, detailContainer }; }; detailContainer = redVC; ViewControllers = new UIViewController[] { colorsController, detailContainer }; }
public SplitViewContoller() : base() { sd = new SplitDelegate (); Delegate = sd; colorsController = new ColorsController (); redVC = new UIViewController (); redVC.View.BackgroundColor = UIColor.Red; colorsController.ColorSelected += (sender, e) => { if (e.Color == "Red") { detailContainer = redVC; } else if (e.Color == "Green") { if (greenVC == null) { greenVC = new UIViewController (); greenVC.View.BackgroundColor = UIColor.Green; } detailContainer = greenVC; } ViewControllers = new UIViewController[] { colorsController, detailContainer }; }; detailContainer = redVC; ViewControllers = new UIViewController[] { colorsController, detailContainer }; }
public static Dictionary <TLabel, Package <TLabel, TItem> > FromArray <TArrayItem, TDelimiter>(IList <TArrayItem> array, SplitDelegate <TArrayItem, TDelimiter> splitDelegate, params TDelimiter[] delimiters) { Dictionary <TLabel, Package <TLabel, TItem> > packages = new Dictionary <TLabel, Package <TLabel, TItem> >(); for (int i = 0; i < array.Count; i++) { TLabel label; TItem item; if (splitDelegate(array[i], out label, out item, delimiters)) { if (packages.ContainsKey(label)) { packages[label].Items.Add(item); } else { packages.Add(label, new Package <TLabel, TItem>(label, item)); } } } return(packages); }
// To embed quotes use: // "test\"test" (\") // 'includeQuotes': if true, "one two three" will be returned as "one two three" i.e. with the quotes embedded // if false it will be returned as: one two three public static TokenAndPosition[] QuoteAwareSplit( string input, SplitDelegate splitDelegate, bool includeQuotes) { // The output list of tokens List <TokenAndPosition> list = new List <TokenAndPosition>(); // Are we inside quotes? bool insideQuotes = false; // The beginning position of the current token int beginPos = 0; // The position of the last non-whitespace character that doesn't match the delegate int lastNonWhitespacePos = 0; // Iterate the input string character by character for (int i = 0; i < input.Length; ++i) { char thisChar = input[i]; // Update the last non-whitespace position if this isn't whitespace bool isWhitespace = char.IsWhiteSpace(input[i]); if (!isWhitespace) { lastNonWhitespacePos = i; } if (insideQuotes) { // Look for the ending quote if (thisChar == '\"' && input[i - 1] != '\\') { // Add this segment if (includeQuotes) { list.Add(CreateTokenAndPosition(input, beginPos - 1, i + 1)); } else { list.Add(CreateTokenAndPosition(input, beginPos, i)); } beginPos = i + 1; insideQuotes = false; } } else { if (thisChar == '\"') { insideQuotes = true; beginPos = i + 1; } else { if (splitDelegate(thisChar)) { // Split here // This won't include any whitespace at the end of the token due to 'lastNonWhitespacePos' list.Add(CreateTokenAndPosition(input, beginPos, lastNonWhitespacePos + 1)); beginPos = i + 1; } } } } if (insideQuotes) { // No ending quote string text = string.Format("Missing closing quote in input string: {0}", input); throw new System.Exception(text); } // Add remaining token/segment int endCurrentToken = lastNonWhitespacePos + 1; if (endCurrentToken > beginPos) { list.Add(CreateTokenAndPosition(input, beginPos, endCurrentToken)); } return(list.ToArray()); }