public void AddPerson(PersonModel person) { WillChangeValue("personModelArray"); isManager = true; _people.Add(person); DidChangeValue("personModelArray"); }
public void addingSourceList() { sizeDetails.Add((NSString)"100%"); sizeDetails.Add((NSString)"125%"); sizeDetails.Add((NSString)"150%(Recommended)"); sizeDetails.Add((NSString)"175%"); resolutionDetails.Add((NSString)"1920 x 1080 (Recommended)"); resolutionDetails.Add((NSString)"1680 x 1050"); resolutionDetails.Add((NSString)"1600 x 900"); resolutionDetails.Add((NSString)"1440 x 900"); resolutionDetails.Add((NSString)"1400 x 1050"); resolutionDetails.Add((NSString)"1366 x 768"); resolutionDetails.Add((NSString)"1360 x 768"); resolutionDetails.Add((NSString)"1280 x 1024"); resolutionDetails.Add((NSString)"1280 x 960"); resolutionDetails.Add((NSString)"1280 x 720"); resolutionDetails.Add((NSString)"854 x 480"); resolutionDetails.Add((NSString)"800 x 480"); resolutionDetails.Add((NSString)"480 X 640"); resolutionDetails.Add((NSString)"480 x 320"); resolutionDetails.Add((NSString)"432 x 240"); resolutionDetails.Add((NSString)"360 X 640"); resolutionDetails.Add((NSString)"320 x 240"); orientationDetails.Add((NSString)"Landscape"); orientationDetails.Add((NSString)"Portrait"); orientationDetails.Add((NSString)"Landscape (flipped)"); orientationDetails.Add((NSString)"Portrait (flipped)"); }
void SetColorMapping(SFShapeSetting setting) { NSMutableArray colorMappings = new NSMutableArray(); SFEqualColorMapping colorMapping1 = new SFEqualColorMapping(); colorMapping1.Value = (NSString)"Vegetables"; colorMapping1.LegendLabel = (NSString)"Vegetables"; colorMapping1.Color = UIColor.FromRGB(0x29, 0xBB, 0x9C); colorMappings.Add(colorMapping1); SFEqualColorMapping colorMapping2 = new SFEqualColorMapping(); colorMapping2.Value = (NSString)"Rice"; colorMapping2.LegendLabel = (NSString)"Rice"; colorMapping2.Color = UIColor.FromRGB(0xFD, 0x8C, 0x48); colorMappings.Add(colorMapping2); SFEqualColorMapping colorMapping3 = new SFEqualColorMapping(); colorMapping3.Value = (NSString)"Wheat"; colorMapping3.LegendLabel = (NSString)"Wheat"; colorMapping3.Color = UIColor.FromRGB(0xE5, 0x4D, 0x42); colorMappings.Add(colorMapping3); SFEqualColorMapping colorMapping4 = new SFEqualColorMapping(); colorMapping4.Value = (NSString)"Grains"; colorMapping4.LegendLabel = (NSString)"Grains"; colorMapping4.Color = UIColor.FromRGB(0x3A, 0x99, 0xD9); colorMappings.Add(colorMapping4); setting.ColorMappings = colorMappings; }
public static NSArray ToArray(object[] values) { var list = new NSMutableArray(); foreach (object o in values) { if (o is NSMutableArray) { var ary = (NSMutableArray)o; nuint i; nuint max = ary.Count; for (i = 0; i < max; i++) { list.Add(ary.GetItem <NSObject>(i)); } } // Check if we have a matching strategy. else { if (!_Strategies.TryGetValue(o.GetType(), out Func <object, NSObject> action)) { Debug.WriteLine("Unknown Object Type " + o.GetType()); throw new ArgumentException("Unknown object of type " + o.GetType()); } list.Add(action(o)); } } return(list); }
void SetColorMapping(SFShapeSetting setting) { NSMutableArray colorMappings = new NSMutableArray(); SFEqualColorMapping colorMapping1 = new SFEqualColorMapping(); colorMapping1.Value = (NSString)"1"; colorMapping1.Color = UIColor.FromRGB(255, 165, 0); colorMappings.Add(colorMapping1); SFEqualColorMapping colorMapping2 = new SFEqualColorMapping(); colorMapping2.Value = (NSString)"2"; colorMapping2.Color = UIColor.FromRGB(255, 165, 0); colorMappings.Add(colorMapping2); SFEqualColorMapping colorMapping3 = new SFEqualColorMapping(); colorMapping3.Value = (NSString)"8"; colorMapping3.Color = UIColor.FromRGB(255, 165, 0); colorMappings.Add(colorMapping3); SFEqualColorMapping colorMapping4 = new SFEqualColorMapping(); colorMapping4.Value = (NSString)"9"; colorMapping4.Color = UIColor.FromRGB(255, 165, 0); colorMappings.Add(colorMapping4); setting.ColorMappings = colorMappings; }
public override void ViewDidLoad() { base.ViewDidLoad(); this.listViewDelegate = new NotificationsListViewDelegate(this); NSMutableArray types = new NSMutableArray(); types.Add(new NSString("Error")); types.Add(new NSString("Warning")); types.Add(new NSString("Success")); types.Add(new NSString("Info")); dataSource = new TKDataSource(types); listView = new TKListView(); listView.Frame = this.View.Bounds; listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; listView.Delegate = listViewDelegate; listView.WeakDataSource = dataSource; this.View.AddSubview(listView); titles = new NSMutableArray(); titles.Add(new NSString("Oh no!")); titles.Add(new NSString("Warning!")); titles.Add(new NSString("Well done!")); titles.Add(new NSString("Info.")); messages = new NSMutableArray(); messages.Add(new NSString("Change this and try again!")); messages.Add(new NSString("e careful next time")); messages.Add(new NSString("You successfully read this message")); messages.Add(new NSString("This is TKAlert dialog")); colors = new NSMutableArray(); colors.Add(new UIColor(1f, 0f, 0.282f, 1f)); colors.Add(new UIColor(1f, 0.733f, 0f, 1f)); colors.Add(new UIColor(0.478f, 0.988f, 0.157f, 1f)); colors.Add(new UIColor(0.231f, 0.678f, 1f, 1f)); alert = new TKAlert(); alert.Style.ContentSeparatorWidth = 0; alert.Style.TitleColor = new UIColor(1f, 1f, 1f, 1f); alert.Style.MessageColor = new UIColor(1f, 1f, 1f, 1f); alert.Style.CornerRadius = 0; alert.Style.ShowAnimation = TKAlertAnimation.SlideFromTop; alert.Style.DismissAnimation = TKAlertAnimation.SlideFromTop; // >> alert-bg-cs alert.Style.BackgroundStyle = TKAlertBackgroundStyle.None; // << alert-bg-cs // >> alert-dismiss-cs alert.DismissMode = TKAlertDismissMode.Tap; // << alert-dismiss-cs // >> alert-layout-cs alert.ActionsLayout = TKAlertActionsLayout.Vertical; // << alert-layout-cs }
void SetupProductTour() { productTour = new ProductTour(); productTour.Frame = new RectangleF(0, 0, View.Bounds.Width, View.Bounds.Height); var bubble = new Bubble(AwesomeButton, "THE FIRST BUTTON", "Click this button for more\nawesome all around!", ArrowPosition.Top, null); bubble.FontName = "SourceSansPro-Bold"; var bubble2 = new Bubble(KindaAwesomeButton, "THE SECOND BUTTON", "Click this button. Just do it.", ArrowPosition.Bottom, null); bubble2.FontName = "SourceSansPro-Bold"; var bubble3 = new Bubble(HelpButton, "HELP BUTTON", "Click to toggle.", ArrowPosition.Right, null); bubble3.FontName = "SourceSansPro-Bold"; var bubbleArray = new NSMutableArray(3); bubbleArray.Add(bubble); bubbleArray.Add(bubble2); bubbleArray.Add(bubble3); productTour.Bubbles = bubbleArray; Add(productTour); }
void GetPopulationData() { NSMutableArray array = new NSMutableArray(); NSMutableArray regional1 = new NSMutableArray(); regional1.Add(getDictionary("United States", "New York", 2353, 2000)); regional1.Add(getDictionary("United States", "Los Angeles", 3453, 3000)); regional1.Add(getDictionary("United States", "San Francisco", 8456, 8000)); regional1.Add(getDictionary("United States", "Chicago", 6785, 7000)); regional1.Add(getDictionary("United States", "Miami", 7045, 6000)); NSMutableArray regional2 = new NSMutableArray(); regional2.Add(getDictionary("Canada", "Toronto", 7045, 7000)); regional2.Add(getDictionary("Canada", "Vancouver", 4352, 4000)); regional2.Add(getDictionary("Canada", "Winnipeg", 7843, 7500)); NSMutableArray regional3 = new NSMutableArray(); regional3.Add(getDictionary("Mexico", "Mexico City", 7843, 6500)); regional3.Add(getDictionary("Mexico", "Cancun", 6683, 6000)); regional3.Add(getDictionary("Mexico", "Acapulco", 2454, 2000)); array.Add(getDictionary1("United States", 98456, 87000, regional1)); array.Add(getDictionary1("Canada", 43523, 40000, regional2)); array.Add(getDictionary1("Mexico", 45634, 46000, regional3)); PopulationDetails = array; }
public override void ViewDidLoad() { // >> listview-groups-cs NSMutableArray items = new NSMutableArray(); items.Add(new DataSourceItem("John", 50f, "A")); items.Add(new DataSourceItem("Abby", 33f, "A")); items.Add(new DataSourceItem("Smith", 42f, "B")); items.Add(new DataSourceItem("Peter", 28f, "B")); items.Add(new DataSourceItem("Paula", 25f, "B")); this.dataSource = new TKDataSource(); this.dataSource.ItemSource = items; this.dataSource.GroupWithKey("Group"); dataSource.DisplayKey = "Name"; TKListView listView = new TKListView(new CGRect(20, 20, this.View.Bounds.Size.Width - 40, this.View.Bounds.Size.Height - 40)); listView.WeakDataSource = dataSource; this.View.AddSubview(listView); var layout = listView.Layout as TKListViewLinearLayout; layout.HeaderReferenceSize = new CGSize(200, 22); // << listview-groups-cs }
public GettingStarted () { view = new UIView (); label = new UILabel (); label.Text = "Getting Started"; label.Frame=new CGRect(0,0,300,30); //view.AddSubview (label); tree = new SFTreeMap (); tree.LeafItemSettings = new SFLeafItemSetting (); tree.LeafItemSettings.LabelStyle = new SFStyle () { Font = UIFont.SystemFontOfSize (12), Color = UIColor.White }; tree.LeafItemSettings.LabelPath = (NSString)"Label"; tree.LeafItemSettings.ShowLabels = true; tree.LeafItemSettings.Gap = 2; tree.LeafItemSettings.BorderColor=UIColor.Gray; tree.LeafItemSettings.BorderWidth = 1; NSMutableArray ranges = new NSMutableArray (); ranges.Add (new SFRange () { LegendLabel = (NSString)"1 % Growth", From = 0, To = 1, Color = UIColor.FromRGB (0x77, 0xD8, 0xD8) }); ranges.Add (new SFRange () { LegendLabel = (NSString)"2 % Growth", From = 0, To = 2, Color = UIColor.FromRGB (0xAE, 0xD9, 0x60) }); ranges.Add (new SFRange () { LegendLabel = (NSString)"3 % Growth", From = 0, To = 3, Color = UIColor.FromRGB (0xFF, 0xAF, 0x51) }); ranges.Add (new SFRange () { LegendLabel = (NSString)"4 % Growth", From = 0, To = 4, Color = UIColor.FromRGB (0xF3, 0xD2, 0x40) }); tree.LeafItemColorMapping = new SFRangeColorMapping () { Ranges = ranges }; CGSize legendSize = new CGSize (this.Frame.Size.Width, 60); CGSize iconSize = new CGSize (17, 17); UIColor legendColor = UIColor.Gray; tree.LegendSettings = new SFLegendSetting () { LabelStyle = new SFStyle () { Font = UIFont.SystemFontOfSize (12), Color = legendColor }, IconSize = iconSize, ShowLegend = true, Size = legendSize }; GetPopulationData (); tree.Items = PopulationDetails; AddSubview (view); control = this; }
NSString PushTypeString() { UANotificationOptions options = UAirship.Push.AuthorizedNotificationOptions; NSMutableArray typeArray = new NSMutableArray(3); if ((options & UANotificationOptions.Alert) > 0) { typeArray.Add(new NSString("Alert")); } if ((options & UANotificationOptions.Badge) > 0) { typeArray.Add(new NSString("Badge")); } if ((options & UANotificationOptions.Sound) > 0) { typeArray.Add(new NSString("Sound")); } if (!(typeArray.Count > 0)) { return(new NSString("Pushes Currently Disabled")); } return(new NSString(string.Join(",", typeArray))); }
NSMutableArray CreateAppointments() { NSDate today = new NSDate(); NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents components = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components.Hour = 10; components.Minute = 0; components.Second = 0; NSDate startDate = calendar.DateFromComponents(components); // Get the year, month, day from the date NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents.Hour = 12; endDateComponents.Minute = 0; endDateComponents.Second = 0; NSDate endDate = calendar.DateFromComponents(endDateComponents); ScheduleAppointment appointment = new ScheduleAppointment(); appointment.StartTime = startDate; appointment.EndTime = endDate; appointment.Subject = new NSString("Jeni's B'Day Celebration"); appointment.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39); NSDateComponents components1 = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components1.Hour = 11; components1.Minute = 0; components1.Second = 0; components1.Day = components1.Day + 1; NSDate startDate1 = calendar.DateFromComponents(components1); // Get the year, month, day from the date NSDateComponents endDateComponents1 = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents1.Hour = 13; endDateComponents1.Minute = 30; endDateComponents1.Second = 0; endDateComponents1.Day = endDateComponents1.Day + 1; NSDate endDate1 = calendar.DateFromComponents(endDateComponents1); ScheduleAppointment appointment1 = new ScheduleAppointment(); appointment1.StartTime = startDate1; appointment1.EndTime = endDate1; appointment1.Subject = new NSString("Checkup"); appointment1.AppointmentBackground = UIColor.FromRGB(0xD8, 0x00, 0x73); NSMutableArray appCollection = new NSMutableArray(); appCollection.Add(appointment); appCollection.Add(appointment1); return(appCollection); }
private void Schedule_VisibleDatesChanged(object sender, VisibleDatesChangedEventArgs e) { var visibleDates = e.VisibleDates; var randomNumber = new Random(); var startDate = NSDate.Now; var endDate = NSDate.Now; appointmentCollection = new NSMutableArray(); for (nuint i = 0; i < visibleDates.Count; i++) { if (GetDayOfWeek(visibleDates.GetItem <NSDate>(i)) == 1 || GetDayOfWeek(visibleDates.GetItem <NSDate>(i)) == 7) { schedule.DayViewSettings.NonAccessibleBlockCollection = null; } else { schedule.DayViewSettings.NonAccessibleBlockCollection = CreateNonAccescibleBlock(); } if (GetDayOfWeek(visibleDates.GetItem <NSDate>(i)) == 1 || GetDayOfWeek(visibleDates.GetItem <NSDate>(i)) == 7) { continue; } for (int j = 0; j < startTimeCollection.Count; j++) { startDate = GetDate(visibleDates.GetItem <NSDate>(i), startTimeCollection[j]); endDate = GetDate(visibleDates.GetItem <NSDate>(i), endTimeCollection[j]); var subject = subjectCollection[randomNumber.Next(subjectCollection.Count)]; appointmentCollection.Add(new ScheduleAppointment() { StartTime = startDate, EndTime = endDate, Subject = (NSString)(subject + " (" + (GetStartDateHour(startDate).ToString()) + " - " + (GetEndDateHour(endDate).ToString()) + " Hour" + ") \n" + GetStaff(subject)), AppointmentBackground = GetColors(subject), }); } // Break Timings startDate = GetBreakDate(visibleDates.GetItem <NSDate>(i), 11, 01, 0); endDate = GetBreakDate(visibleDates.GetItem <NSDate>(i), 11, 10, 0); appointmentCollection.Add(new ScheduleAppointment() { StartTime = startDate, EndTime = endDate, AppointmentBackground = UIColor.LightGray }); startDate = GetBreakDate(visibleDates.GetItem <NSDate>(i), 15, 01, 0); endDate = GetBreakDate(visibleDates.GetItem <NSDate>(i), 15, 10, 0); appointmentCollection.Add(new ScheduleAppointment() { StartTime = startDate, EndTime = endDate, AppointmentBackground = UIColor.LightGray }); } schedule.Appointments = appointmentCollection; }
void OnTestSessionChanged(TestSession session) { var newCategoriesArray = new NSMutableArray(); newCategoriesArray.Add(allCategory); newCategoriesArray.Add(globalCategory); newCategoriesArray.Add(martinCategory); var newCurrentCategory = allCategory; if (session != null) { Configuration = session.Configuration; foreach (var category in Configuration.Categories) { var model = new TestCategoryModel(category); newCategoriesArray.Add(model); if (category == Configuration.CurrentCategory) { newCurrentCategory = model; } } if (fullyLoaded) { foreach (var feature in Configuration.Features) { var model = new TestFeatureModel(feature); FeaturesController.AddObject(model); } } } else { Configuration = null; if (fullyLoaded) { var featureRange = new NSRange(0, FeaturesController.ArrangedObjects().Length); FeaturesController.Remove(NSIndexSet.FromNSRange(featureRange)); } } WillChangeValue(CurrentCategoryKey); WillChangeValue(TestCategoriesArrayKey); currentCategory = newCurrentCategory; testCategoriesArray = newCategoriesArray; DidChangeValue(TestCategoriesArrayKey); DidChangeValue(CurrentCategoryKey); if (SessionChangedEvent != null) { SessionChangedEvent(this, session); } }
public override void ViewDidLoad() { base.ViewDidLoad(); table.EstimatedRowHeight = 55; table.RowHeight = UITableView.AutomaticDimension; NSMutableArray tableArray = new NSMutableArray(); // tableArray.Add(new string[] { "CPI Certificate", "is expiring", "15 days"}); tableArray.Add(new NSMutableSet("NRP Certificate", "is expiring", "43 days")); tableArray.Add(new NSMutableSet("BLS Certificate", "is expiring", "67 days")); table.Source = new AlertTableSource(tableArray); }
public override void ViewDidLoad() { base.ViewDidLoad(); NSMutableArray tableArray = new NSMutableArray(); tableArray.Add(new NSMutableSet("Licenses", "3")); tableArray.Add(new NSMutableSet("Licenses", "3")); table.Source = new SaveLocationSource(tableArray); table.EstimatedRowHeight = 55; table.RowHeight = UITableView.AutomaticDimension; }
public void AddTest() { var v1 = (NSString)"1"; var v2 = (NSString)"2"; using (var arr = new NSMutableArray <NSString> (v1)) { Assert.AreEqual(1, arr.Count, "Count 1"); Assert.Throws <ArgumentNullException> (() => arr.Add(null), "Add ANE"); arr.Add(v2); Assert.AreEqual(2, arr.Count, "Count 2"); Assert.AreSame(v2, arr [1], "idx[1]"); } }
public override void ViewDidLoad() { base.ViewDidLoad(); table.EstimatedRowHeight = 55; table.RowHeight = UITableView.AutomaticDimension; NSMutableArray tableArray = new NSMutableArray(); tableArray.Add(new NSMutableSet("NRP Certificate", "is expiring", "43 days")); tableArray.Add(new NSMutableSet("BLS Certificate", "is expiring", "67 days")); table.Source = new SearchTableSource(tableArray); searchBar.BecomeFirstResponder(); searchBar.BackgroundImage = new UIImage(); searchBar.CancelButtonClicked += SearchBar_CancelButtonClicked; }
public override void ViewDidLoad () { base.ViewDidLoad (); this.listViewDelegate = new NotificationsListViewDelegate(this); NSMutableArray types = new NSMutableArray (); types.Add (new NSString ("Error")); types.Add (new NSString ("Warning")); types.Add (new NSString ("Success")); types.Add (new NSString("Info")); dataSource = new TKDataSource(types); listView = new TKListView (); listView.Frame = this.View.Bounds; listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; listView.Delegate = listViewDelegate; listView.WeakDataSource = dataSource; this.View.AddSubview (listView); titles = new NSMutableArray (); titles.Add (new NSString ("Oh no!")); titles.Add (new NSString ("Warning!")); titles.Add (new NSString ("Well done!")); titles.Add (new NSString ("Info.")); messages = new NSMutableArray (); messages.Add (new NSString ("Change this and try again!")); messages.Add (new NSString ("e careful next time")); messages.Add (new NSString ("You successfully read this message")); messages.Add (new NSString ("This is TKAlert dialog")); colors = new NSMutableArray (); colors.Add(new UIColor(1f, 0f, 0.282f, 1f)); colors.Add(new UIColor(1f, 0.733f, 0f, 1f)); colors.Add(new UIColor(0.478f, 0.988f, 0.157f, 1f)); colors.Add(new UIColor(0.231f, 0.678f, 1f, 1f)); alert = new TKAlert (); alert.Style.ContentSeparatorWidth = 0; alert.Style.TitleColor = new UIColor (1f, 1f, 1f, 1f); alert.Style.MessageColor = new UIColor (1f, 1f, 1f, 1f); alert.Style.CornerRadius = 0; alert.Style.ShowAnimation = TKAlertAnimation.SlideFromTop; alert.Style.DismissAnimation = TKAlertAnimation.SlideFromTop; alert.Style.BackgroundStyle = TKAlertBackgroundStyle.None; alert.DismissMode = TKAlertDismissMode.Tap; }
public override NSArray AttachmentsWithCrashes(iOSCrashes crashes, MSACErrorReport msReport) { if (GetErrorAttachments == null) { return(null); } var report = new ErrorReport(msReport); var attachments = GetErrorAttachments(report); if (attachments != null) { var nsArray = new NSMutableArray(); foreach (var attachment in attachments) { if (attachment != null) { nsArray.Add(attachment.internalAttachment); } else { AppCenterLog.Warn(LogTag, "Skipping null ErrorAttachmentLog in Crashes.GetErrorAttachments."); } } return(nsArray); } return(null); }
public override void SetupSlide (PresentationViewController presentationViewController) { // Create a node to own the "sign" model, make it to be close to the camera, rotate by 90 degree because it's oriented with z as the up axis var intermediateNode = SCNNode.Create (); intermediateNode.Position = new SCNVector3 (0, 0, 7); intermediateNode.Rotation = new SCNVector4 (1, 0, 0, -(float)(Math.PI / 2)); GroundNode.AddChildNode (intermediateNode); // Load the "sign" model var signNode = Utils.SCAddChildNode (intermediateNode, "sign", "Scenes/intersection/intersection", 30); signNode.Position = new SCNVector3 (4, -2, 0.05f); // Re-parent every node that holds a camera otherwise they would inherit the scale from the "sign" model. // This is not a problem except that the scale affects the zRange of cameras and so it would be harder to get the transition from one camera to another right var cameraNodes = new NSMutableArray (); foreach (SCNNode child in signNode) { if (child.Camera != null) cameraNodes.Add (child); } for (nuint i = 0; i < cameraNodes.Count; i++) { var cameraNode = new SCNNode (cameraNodes.ValueAt ((uint)i)); var previousWorldTransform = cameraNode.WorldTransform; intermediateNode.AddChildNode (cameraNode); // re-parent cameraNode.Transform = intermediateNode.ConvertTransformFromNode (previousWorldTransform, null); cameraNode.Scale = new SCNVector3 (1, 1, 1); } }
public void Sort() { comparator_count = 0; using (var obj1 = new NSObject()) using (var obj2 = new NSObject()) using (var a = new NSMutableArray()) { a.Add(obj1); a.Add(a); a.Add(obj2); using (var s = a.Sort(Comparator)) { Assert.That((long)(IntPtr)s.ValueAt(0), Is.GreaterThan((long)(IntPtr)s.ValueAt(1)), "0"); Assert.That((long)(IntPtr)s.ValueAt(1), Is.GreaterThan((long)(IntPtr)s.ValueAt(2)), "1"); } } Assert.That(comparator_count, Is.GreaterThanOrEqualTo(2), "2+"); }
/** * Wrapper to add loginuser to a specific contact group * */ public void AddLoginUserToContactGroup(String ContactGroupId) { NSMutableArray memberArray = new NSMutableArray(); memberArray.Add(new NSString(ALUserDefaultsHandler.UserId)); AddToMembersToContactGroupList(memberArray, ContactGroupId); }
public override void DidEnterBackground(UIApplication application) { var subViews = mapViewController.View.Subviews; MKMapView mapView = subViews[0] as MKMapView; Console.WriteLine("mapView: {0}", mapView); var tempArray = mapView.Annotations; NSMutableArray annotations = new NSMutableArray(); Console.WriteLine("tempArray: {0}", tempArray.ToString()); for (int i = 0; i < tempArray.Length; i++) { if (tempArray[i].GetType() == typeof(MKUserLocation)) { Console.WriteLine("MKUserLocation: {0}", tempArray[i]); } else { Console.WriteLine("MKMapPoint added: {0}", tempArray[i]); annotations.Add(tempArray[i]); } } var documentDirectories = NSSearchPath.GetDirectories(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User, true); string documentDirectory = documentDirectories[0]; string path = Path.Combine(documentDirectory, "annotations.archive"); Console.WriteLine("Path: {0}", path); bool success = NSKeyedArchiver.ArchiveRootObjectToFile(annotations, path); if (success) { Console.WriteLine("Saved Annotations {0}", annotations.ToString()); } }
public RatingControl() { Rating = ratingControlMinimumRating; var blurredEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light); backgroundView = new UIVisualEffectView(blurredEffect); backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha(0.7f, 0.3f); Add(backgroundView); var imageViews = new NSMutableArray(); for (nint rating = ratingControlMinimumRating; rating <= ratingControlMaximumRating; rating++) { UIImageView imageView = new UIImageView(); imageView.UserInteractionEnabled = true; imageView.Image = UIImage.FromBundle("ratingInactive"); imageView.HighlightedImage = UIImage.FromBundle("ratingActive"); imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysTemplate); imageView.AccessibilityLabel = string.Format("{0} stars", rating + 1); Add(imageView); imageViews.Add(imageView); } ImageViews = imageViews; UpdateImageViews(); SetupConstraints(); }
public AAPLRatingControl() { Rating = AAPLRatingControlMinimumRating; var blurredEffect = UIBlurEffect.FromStyle(UIBlurEffectStyle.Light); backgroundView = new UIVisualEffectView(blurredEffect); backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha(0.7f, 0.2f); Add(backgroundView); var append = ""; var imageViews = new NSMutableArray(); for (int rating = AAPLRatingControlMinimumRating; rating <= AAPLRatingControlMaximumRating; rating++) { var imageView = new UIImageView { UserInteractionEnabled = true, Image = UIImage.FromBundle("ratingInactive" + append), HighlightedImage = UIImage.FromBundle("ratingActive" + append).ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), AccessibilityLabel = string.Format("{0} bananas", rating + 1) }; imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal); Add(imageView); imageViews.Add(imageView); } ImageViews = imageViews; UpdateImageViews(); SetupConstraints(); }
partial void BtnShutter_TouchUpInside(UIButton sender) { var Settings = new AVCaptureBracketedStillImageSettings[] { AVCaptureAutoExposureBracketedStillImageSettings.Create(0f) }; // Tell the camera that we are getting ready to do a bracketed capture ThisApp.StillImageOutput.PrepareToCaptureStillImageBracket(ThisApp.StillImageOutput.Connections[0], Settings, (ready, err) => { // Was there an error, if so report it if (err != null) { Console.WriteLine("Error: {0}", err.LocalizedDescription); } }); // Ask the camera to snap a bracketed capture ThisApp.StillImageOutput.CaptureStillImageBracket(ThisApp.StillImageOutput.Connections[0], Settings, (sampleBuffer, settings, err) => { // Convert raw image stream into a Core Image Image var imageData = AVCaptureStillImageOutput.JpegStillToNSData(sampleBuffer); var image = CIImage.FromData(imageData); // Display the resulting image imageArray.Add(UIImage.FromImage(image)); btnCheck.Hidden = false; lblCount.Hidden = false; lblCount.Text = imageArray.Count.ToString(); }); }
public static void SaveToDictionary(this IStateBundle state, NSMutableDictionary bundle) { var formatter = new BinaryFormatter(); foreach (var kv in state.Data.Where(x => x.Value != null)) { var value = kv.Value; if (value.GetType().IsSerializable) { using (var stream = new MemoryStream()) { formatter.Serialize(stream, value); stream.Position = 0; var bytes = stream.ToArray(); var array = new NSMutableArray(); foreach (var b in bytes) { array.Add(NSNumber.FromByte(b)); } bundle.Add(new NSString(kv.Key), array); } } } }
public override void ViewDidLoad() { base.ViewDidLoad (); var r = new Random (); var generator = new LoremIpsumGenerator (); items = new NSMutableArray (); for (int i = 0; i < 20; i++) { items.Add (new NSString(generator.GenerateString (2 + r.Next (30)))); } dataSource = new TKDataSource (items); dataSource.Settings.ListView.DefaultCellClass = new ObjCRuntime.Class (typeof(ListViewVariableSizeCell)); dataSource.Settings.ListView.InitCell ((TKListView listView, NSIndexPath indexPath, TKListViewCell cell, NSObject item) => { var myCell = cell as ListViewVariableSizeCell; myCell.label.Text = item.Description; }); var list = new TKListView (this.View.Bounds); list.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; list.WeakDataSource = dataSource; this.View.AddSubview (list); var layout = list.Layout as TKListViewLinearLayout; layout.DynamicItemSize = true; }
private void SetDataForArray(IEnumerable <Ocupability> ocupabilities) { foreach (var ocupability in ocupabilities) { _dataPoints.Add(new SFChartDataPoint(FromObject(Utils.GetUserStatusText(ocupability.UserStatus)), FromObject(ocupability.Percentage))); } }
public Carousel_Tablet() { //Carousel carousel = new SFCarousel(); carousel.ItemHeight = 350; carousel.ItemWidth = 200; carousel.SelectedItemOffset = 20; //CarouselItem collection creation NSMutableArray <SFCarouselItem> carouselItemCollection = new NSMutableArray <SFCarouselItem>(); for (int i = 1; i <= 7; i++) { carouselItem = new SFCarouselItem(); carouselItem.ImageName = "image" + i + ".png"; carouselItemCollection.Add(carouselItem); } carousel.DataSource = carouselItemCollection; carousel.SelectedIndex = 2; carousel.Frame = new CGRect(125, 190, 350, 650); this.AddSubview(carousel); variableDeclaration(); autoHide(); loadOptionView(); }
private void SetDataForArray(IEnumerable <OrdersPerClient> orders, NSMutableArray array) { foreach (var order in orders) { array.Add(new SFChartDataPoint(FromObject(order.CompanyName), FromObject(order.Quantity))); } }
public void initMask(string maskValue, MaskType maskType) { if (maskValue != null) { if (maskType == MaskType.Selection) { backupUseMask = mReader.UseSelectionMask; for (int i = define.MIN_SELECTION_MASK; i < define.MAX_SELECTION_MASK; i++) { if (!mReader.UsedSelectionMask(i)) { break; } AsSelectMaskParam maskParam = mReader.GetSelectionMask(i); backupSelectMasks.Add(maskParam); } } AsSelectMaskParam param = new AsSelectMaskParam(0, MaskTargetType.L, MaskActionType.Ab, MemoryBank.Epc, 32, maskValue.Substring(4), true); mReader.SetSelectionMask(0, param); mReader.UseSelectionMask = SelectFlag.Sl; for (int i = 1; i < define.MAX_SELECTION_MASK; i++) { mReader.SetMaskUsed(i, false); } } }
public static void SaveUser(UserProfile user, bool isNeedNotification) { if (Const.Offline) { return; } var data = CreateSaveData(user); data = AddNotifyInfo(isNeedNotification, data); var margeTargets = new NSMutableArray(); foreach (var property in user.GetType().GetRuntimeProperties()) { var storageTarget = property.GetCustomAttribute <StorageTarget>(); if (storageTarget == null) { continue; } if (storageTarget.CanMarge) { margeTargets.Add(new NSString(property.Name)); } } Instance.GetDocument("UserProfile/" + user.Id).SetData(data, true); }
public override void SetupSlide(PresentationViewController presentationViewController) { // Create a node to own the "sign" model, make it to be close to the camera, rotate by 90 degree because it's oriented with z as the up axis var intermediateNode = SCNNode.Create(); intermediateNode.Position = new SCNVector3(0, 0, 7); intermediateNode.Rotation = new SCNVector4(1, 0, 0, -(float)(Math.PI / 2)); GroundNode.AddChildNode(intermediateNode); // Load the "sign" model var signNode = Utils.SCAddChildNode(intermediateNode, "sign", "Scenes/intersection/intersection", 30); signNode.Position = new SCNVector3(4, -2, 0.05f); // Re-parent every node that holds a camera otherwise they would inherit the scale from the "sign" model. // This is not a problem except that the scale affects the zRange of cameras and so it would be harder to get the transition from one camera to another right var cameraNodes = new NSMutableArray(); foreach (SCNNode child in signNode) { if (child.Camera != null) { cameraNodes.Add(child); } } for (nuint i = 0; i < cameraNodes.Count; i++) { var cameraNode = new SCNNode(cameraNodes.ValueAt((uint)i)); var previousWorldTransform = cameraNode.WorldTransform; intermediateNode.AddChildNode(cameraNode); // re-parent cameraNode.Transform = intermediateNode.ConvertTransformFromNode(previousWorldTransform, null); cameraNode.Scale = new SCNVector3(1, 1, 1); } }
public RatingControl () { Rating = AAPLRatingControlMinimumRating; var blurredEffect = UIBlurEffect.FromStyle (UIBlurEffectStyle.Light); backgroundView = new UIVisualEffectView (blurredEffect); backgroundView.ContentView.BackgroundColor = UIColor.FromWhiteAlpha (0.7f, 0.3f); Add (backgroundView); var imageViews = new NSMutableArray (); for (nint rating = AAPLRatingControlMinimumRating; rating <= AAPLRatingControlMaximumRating; rating++) { UIImageView imageView = new UIImageView (); imageView.UserInteractionEnabled = true; imageView.Image = UIImage.FromBundle ("ratingInactive"); imageView.HighlightedImage = UIImage.FromBundle ("ratingActive"); imageView.HighlightedImage = imageView.HighlightedImage.ImageWithRenderingMode (UIImageRenderingMode.AlwaysTemplate); imageView.AccessibilityLabel = string.Format ("{0} stars", rating + 1); Add (imageView); imageViews.Add (imageView); } ImageViews = imageViews; UpdateImageViews (); SetupConstraints (); }
public void saveNotes(Collection<string> notes) { NSMutableArray arrayNotes = new NSMutableArray (); for (int i = 0; i < notes.Count; i++) { arrayNotes.Add (new NSString (notes [i])); } NSUserDefaults.StandardUserDefaults.SetValueForKey (arrayNotes, new NSString (NOTES)); NSUserDefaults.StandardUserDefaults.Synchronize (); }
// Shared initialization code void Initialize () { repeatCount = 1; categoryArray = new NSMutableArray (); categories = TestSuite.Categories; foreach (var category in categories) { categoryArray.Add ((NSString)category.Name); } }
public void Copy(string data) { NSPasteboard glob = NSPasteboard.GeneralPasteboard; NSMutableArray types = new NSMutableArray(); types.Add(NSPasteboard.NSStringPboardType); glob.DeclareTypesOwner(types, null); glob.SetStringForType(data, NSPasteboard.NSStringPboardType); }
public override void ViewDidLoad () { base.ViewDidLoad (); dataSource = new TKDataSource (); dataSource.AddFilterDescriptor (new TKDataSourceFilterDescriptor ("NOT (Name like 'John')")); dataSource.AddSortDescriptor (new TKDataSourceSortDescriptor ("Name", true)); dataSource.AddGroupDescriptor (new TKDataSourceGroupDescriptor ("Group")); var array = new NSMutableArray (); array.Add (new DSItem () { Name = "John", Value = 22.0f, Group = "one" }); array.Add (new DSItem () { Name = "Peter", Value = 15.0f, Group = "one" }); array.Add (new DSItem () { Name = "Abby", Value = 47.0f, Group = "one" }); array.Add (new DSItem () { Name = "Robert", Value = 45.0f, Group = "two" }); array.Add (new DSItem () { Name = "Alan", Value = 17.0f, Group = "two" }); array.Add (new DSItem () { Name = "Saly", Value = 33.0f, Group = "two" }); dataSource.DisplayKey = "Name"; dataSource.ValueKey = "Value"; dataSource.ItemSource = array; var tableView = new UITableView (this.View.Bounds); tableView.DataSource = dataSource; this.View.AddSubview (tableView); }
// // Save support: // Override one of GetAsData, GetAsFileWrapper, or WriteToUrl. // // This method should store the contents of the document using the given typeName // on the return NSData value. public override NSData GetAsData(string documentType, out NSError outError) { outError = null; NSMutableArray array = new NSMutableArray(); foreach (Oval o in Ovals) { array.Add(o); } // Create an NSData object from the employees array NSData data = NSKeyedArchiver.ArchivedDataWithRootObject(array); return data; }
public ChartSplineAreaDataSource () { DataPoints1 = new NSMutableArray (); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(2.2))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(3.4))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(2.8))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(1.6))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.3))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(2.5))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(2.9))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(3.8))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.4))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(3.1))); DataPoints2 = new NSMutableArray (); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(2.0))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(1.7))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(1.8))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(2.1))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.3))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(1.7))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(1.5))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(2.8))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.5))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(2.3))); DataPoints3 = new NSMutableArray (); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2002"), NSObject.FromObject(0.8))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2003"), NSObject.FromObject(1.3))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2004"), NSObject.FromObject(1.1))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2005"), NSObject.FromObject(1.6))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2006"), NSObject.FromObject(2.0))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2007"), NSObject.FromObject(1.7))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2008"), NSObject.FromObject(2.3))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2009"), NSObject.FromObject(2.7))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2010"), NSObject.FromObject(1.1))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject ("2011"), NSObject.FromObject(2.3))); }
public static Conversation ConversationWithDictionary (NSDictionary dictionary) { var photoValues = (NSArray)dictionary.ObjectForKey (new NSString ("photos")); var photos = new NSMutableArray (photoValues.Count); for (nint i = 0; i < (nint)photoValues.Count; i++) { var photo = Photo.PhotoWithDictionary (photoValues.GetItem <NSDictionary> (i)); photos.Add (photo); } return new Conversation { Name = (NSString)dictionary.ObjectForKey (new NSString ("name")), Photos = photos }; }
public ChartTrackballDataSource () { DataPoints1 = new NSMutableArray (); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(54))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(24))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(53))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(63))); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(35))); DataPoints2 = new NSMutableArray (); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(34))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(20))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(43))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(53))); DataPoints2.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(25))); DataPoints3 = new NSMutableArray (); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (1), NSObject.FromObject(24))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (2), NSObject.FromObject(14))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (3), NSObject.FromObject(33))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (4), NSObject.FromObject(43))); DataPoints3.Add (new SFChartDataPoint (NSObject.FromObject (5), NSObject.FromObject(15))); }
void AddItem(NSMutableArray array, string name, float value, string group, int day, UIImage image) { NSCalendar calendar = NSCalendar.CurrentCalendar; NSDateComponents components = new NSDateComponents (); components.Day = day; NSDate date = calendar.DateByAddingComponents (components, NSDate.Now, NSCalendarOptions.None); DSItem item = new DSItem () { Name = name, Value = value, Group = group, Date = date, Image = image }; array.Add (item); }
public static AAPLUser UserWithDictionary (NSDictionary dictionary) { string name = (NSString)dictionary.ObjectForKey (new NSString ("name")); var conversationDictionaries = (NSArray)dictionary.ObjectForKey (new NSString ("conversations")); var conversations = new NSMutableArray (conversationDictionaries.Count); for (int i = 0; i < conversationDictionaries.Count; i++) { var conversation = AAPLConversation.ConversationWithDictionary (conversationDictionaries.GetItem<NSDictionary> (i)); conversations.Add (conversation); } var lastPhotoDictionary = NSDictionary.FromDictionary ((NSDictionary)dictionary.ObjectForKey (new NSString ("lastPhoto"))); return new AAPLUser { Name = name, Conversations = conversations, LastPhoto = AAPLPhoto.PhotoWithDictionary (lastPhotoDictionary) }; }
ProductTour BuildProductTourView(UITableView tableView) { var productTour = new ProductTour (); productTour.Frame = new RectangleF (0, 0, 320, tableView.Frame.Height); var bubble = new Bubble (new UIView (new RectangleF (0, 0, 320, 0)), "SCHEDULE MEMEMORIZATION", "Tap the verses you wish to memorize,\nthen tap the\"Move\" button and a day\nto schedule memorization.", ArrowPosition.Top, null); bubble.FontName = "SourceSansPro-Bold"; var bubbleArray = new NSMutableArray (1); bubbleArray.Add (bubble); productTour.Bubbles = bubbleArray; return productTour; }
private NSArray ToNSArray(PHAssetMediaType[] managed) { var mediaTypes = new NSMutableArray ((nuint) _picker.MediaTypes.Length); for (int i = 0; i < _picker.MediaTypes.Length; i++) { mediaTypes.Add (NSObject.FromObject(_picker.MediaTypes [i])); } return mediaTypes; }
private NSMutableArray ReadRectanglesXml(PinboardData.RectangleInfo screenRectangle) { var list = new NSMutableArray(); // Read <Rectangles> reader.ReadStartElement(rectanglesAtom); reader.MoveToContent(); while (true) { if (String.ReferenceEquals(reader.Name, rectanglesAtom)) { reader.ReadEndElement(); reader.MoveToContent(); break; } var rectInfo = ReadRectangleXml(); // Flip the rectangle top to bottom relative to the screen rectangle rectInfo.Y = screenRectangle.Height - rectInfo.Y - rectInfo.Height; list.Add(rectInfo); } return list; }
public override void ViewDidLoad () { AddOption ("Show Alert", Show); base.ViewDidLoad (); this.listViewDelegate = new ListViewDelegate (this); alert = new TKAlert (); alert.Title = "Animations"; alert.Style.BackgroundStyle = TKAlertBackgroundStyle.Blur; alert.AddActionWithTitle("Close", (TKAlert al, TKAlertAction action) => true); showAnimations = new NSMutableArray (); showAnimations.Add (new NSString ("Scale in")); showAnimations.Add (new NSString ("Fade in")); showAnimations.Add (new NSString ("Slide from left")); showAnimations.Add (new NSString ("Slide from top")); showAnimations.Add (new NSString ("Slide from right")); showAnimations.Add (new NSString ("Slide from bottom")); dismissAnimations = new NSMutableArray (); dismissAnimations.Add (new NSString ("Scale out")); dismissAnimations.Add (new NSString ("Fade out")); dismissAnimations.Add (new NSString ("Slide to left")); dismissAnimations.Add (new NSString ("Slide to top")); dismissAnimations.Add (new NSString ("Slide to right")); dismissAnimations.Add (new NSString ("Slide to bottom")); appearAnimations = new TKDataSource (showAnimations); hideAnimations = new TKDataSource (dismissAnimations); appearAnimationsList = new TKListView (); appearAnimationsList.WeakDataSource = appearAnimations; appearAnimationsList.Delegate = listViewDelegate; appearAnimationsList.Tag = 0; appearAnimationsList.AutoresizingMask = UIViewAutoresizing.None; this.View.AddSubview (appearAnimationsList); NSIndexPath selected = NSIndexPath.FromItemSection (3, 0); appearAnimationsList.SelectItem (selected, true, UICollectionViewScrollPosition.None); hideAnimationsList = new TKListView (); hideAnimationsList.WeakDataSource = hideAnimations; hideAnimationsList.Tag = 1; hideAnimationsList.Delegate = listViewDelegate; hideAnimationsList.AutoresizingMask = UIViewAutoresizing.None; this.View.AddSubview (hideAnimationsList); selected = NSIndexPath.FromItemSection (5, 0); hideAnimationsList.SelectItem (selected, true, UICollectionViewScrollPosition.None); appearLabel = new UILabel (); appearLabel.Text = "Show animation:"; appearLabel.TextColor = new UIColor (0f, 0f, 0f, 1f); appearLabel.Font = UIFont.SystemFontOfSize (12); appearLabel.TextAlignment = UITextAlignment.Center; this.View.AddSubview (appearLabel); hideLabel = new UILabel (); hideLabel.Text = "Hide animation:"; hideLabel.TextColor = new UIColor (0f, 0f, 0f, 1f); hideLabel.Font = UIFont.SystemFontOfSize (12); hideLabel.TextAlignment = UITextAlignment.Center; this.View.AddSubview (hideLabel); }
public override void LayoutSubviews(){ base.LayoutSubviews(); CGRect bounds = new CGRect(){ Size = this.Bounds.Size }; NSDictionary buttonDictionary = this.buttonDictionary; // Settings. /*const*/ UIUserInterfaceIdiom interfaceIdiom = UI_USER_INTERFACE_IDIOM(); /*const*/ nfloat spacing = (interfaceIdiom == UIUserInterfaceIdiom.Pad) ? MMNumberKeyboardPadBorder : 0.0f; /*const*/ nfloat maximumWidth = (interfaceIdiom == UIUserInterfaceIdiom.Pad) ? (nfloat)400.0 : bounds.Width; /*const*/ bool allowsDecimalPoint = this.allowsDecimalPoint; /*const*/ nfloat width = (nfloat)Math.Min(maximumWidth, bounds.Width); /*const*/ CGRect contentRect = new CGRect(){ X = (nfloat)Math.Round((bounds.Width - width) / (nfloat)2.0f), Y = spacing, Size = new CGSize(){ Width = width, Height = bounds.Height - spacing * 2.0f } }; // Layout. /*const*/ nfloat columnWidth = contentRect.Width / 4.0f; /*const*/ nfloat rowHeight = MMNumberKeyboardRowHeight; CGSize numberSize = new CGSize(columnWidth, rowHeight); // Layout numbers. /*const*/ MMNumberKeyboardButton numberMin = MMNumberKeyboardButton.NumberMin; /*const*/ MMNumberKeyboardButton numberMax = MMNumberKeyboardButton.NumberMax; /*const*/ nint numbersPerLine = 3; for (MMNumberKeyboardButton key = numberMin; key < numberMax; key++) { UIButton button = (UIButton)buttonDictionary[""+key]; nint digit = key - numberMin; CGRect rect = new CGRect(){ Size = numberSize }; if (digit == 0f) { rect.Y = numberSize.Height * 3f; rect.X = numberSize.Width; if (!allowsDecimalPoint) { rect.Size= new CGSize(){Width = numberSize.Width * 2.0f}; button.ContentEdgeInsets = new UIEdgeInsets(0f, 0f, 0f, numberSize.Width); } } else { nint idx = (digit - 1); nint line = idx / numbersPerLine; nint pos = idx % numbersPerLine; rect.Y = line * numberSize.Height; rect.X = pos * numberSize.Width; } button.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout special key. UIButton specialKey = (UIButton) buttonDictionary[""+MMNumberKeyboardButton.Special]; if (specialKey!=null) { CGRect rect = new CGRect(){ Size = numberSize }; rect.Y = numberSize.Height * 3f; specialKey.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout decimal point. UIButton decimalPointKey = (UIButton) buttonDictionary[""+MMNumberKeyboardButton.DecimalPoint]; if (decimalPointKey!=null) { CGRect rect = new CGRect(){ Size = numberSize }; rect.Y = numberSize.Height * 3f; rect.X = numberSize.Width * 2f; decimalPointKey.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); decimalPointKey.Hidden = !allowsDecimalPoint; } // Layout utility column. /*const*/ MMNumberKeyboardButton []utilityButtonKeys = new MMNumberKeyboardButton[] { MMNumberKeyboardButton.Backspace, MMNumberKeyboardButton.Done }; /*const*/ CGSize utilitySize = new CGSize(columnWidth, rowHeight * 2.0f); for (nint idx = 0; idx < utilityButtonKeys.Length; idx++) { MMNumberKeyboardButton key = utilityButtonKeys[idx]; UIButton button = (UIButton) buttonDictionary[""+key]; CGRect rect = new CGRect(){ Size = utilitySize }; rect.X = columnWidth * 3.0f; rect.Y = idx * utilitySize.Height; button.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); } // Layout separators if phone. if (interfaceIdiom != UIUserInterfaceIdiom.Pad) { NSArray separatorViews = this.separatorViews; /*const*/ nuint totalColumns = 4; /*const*/ nuint totalRows = (nuint) numbersPerLine + 1; /*const*/ nuint numberOfSeparators = totalColumns * totalRows - 1; if (separatorViews.Count != numberOfSeparators) { separatorViews.PerformSelector(new Selector("makeObjectsPerformSelector"),NSObject.FromObject(new Selector("removeFromSuperview"))); NSMutableArray neueSeparatorViews = new NSMutableArray(numberOfSeparators); for (nuint idx = 0; idx < numberOfSeparators; idx++) { UIView separator = new UIView(CGRect.Empty); separator.BackgroundColor = UIColor.FromWhiteAlpha(0.0f ,/*alpha*/ 0.1f); this.AddSubview(separator); neueSeparatorViews.Add(separator); } this.separatorViews = neueSeparatorViews; } /*const*/ nfloat separatorDimension = 1.0f / ((this.Window.Screen.Scale != 0) ? this.Window.Screen.Scale: 1.0f); separatorViews.enumerateObjectsUsingBlock( (object obj, nuint idx, out bool stop) =>{ UIView separator = (UIView)obj; CGRect rect = CGRect.Empty; if (idx < totalRows) { rect.Y = idx * rowHeight; if (idx % 2 != 0) { rect.Size = new CGSize(rect.Size){ Width = contentRect.Width - columnWidth}; } else { rect.Size = new CGSize(rect.Size){ Width = contentRect.Width}; } rect.Size = new CGSize(rect.Size){ Height = separatorDimension}; } else { nuint col = (idx - totalRows); rect.X = (col + 1) * columnWidth; rect.Size = new CGSize(rect.Size){ Width = separatorDimension}; if (col == 1 && !allowsDecimalPoint) { rect.Size = new CGSize(rect.Size){ Height = contentRect.Height - rowHeight}; } else { rect.Size = new CGSize(rect.Size){ Height = contentRect.Height}; } } separator.Frame = MMButtonRectMake(rect, contentRect, interfaceIdiom); stop = false; }); } }
void SetupTour() { var tour = Tour.Instance; if (tour.IsEnabled) { productTour = new ProductTour (); productTour.Frame = new RectangleF (0, 0, View.Bounds.Width, View.Bounds.Height); var step = tour.Step; if (step == 1) { var view = new UIView (new RectangleF(backingComposeButton.Frame.X, backingComposeButton.Frame.Y - 44, backingComposeButton.Frame.Width, backingComposeButton.Frame.Height)); var bubble = new Bubble (view, "DOWNLOAD", "Add a new verse\nto your library.", ArrowPosition.Top, null); bubble.FontName = "SourceSansPro-Bold"; var bubbles = new NSMutableArray (1); bubbles.Add (bubble); productTour.Bubbles = bubbles; Add (productTour); } else if (step == 2) { var view = new UIView (ViewForTab (1)); var bubble = new Bubble (view, "SWITCH TABS", "Tap the memorization tab.", ArrowPosition.Bottom, null); bubble.FontName = "SourceSansPro-Bold"; var bubbles = new NSMutableArray (1); bubbles.Add (bubble); productTour.Bubbles = bubbles; Add (productTour); } } }
public void ReloadData(TKAutoCompleteTextView autocomplete) { NSMutableArray suggestions = new NSMutableArray (); if (airports == null) { NSUrl url = new NSUrl (urlStr); NSUrlRequest req = new NSUrlRequest (url); NSUrlResponse res; NSData dataVal = new NSData (); NSDictionary jsonResult = new NSDictionary (); NSError error; NSError errorReq; dataVal = NSUrlConnection.SendSynchronousRequest (req, out res, out errorReq); if (dataVal != null) { jsonResult = (NSDictionary)NSJsonSerialization.Deserialize (dataVal, NSJsonReadingOptions.MutableContainers, out error); if (error == null) { airports = (NSArray)jsonResult.ObjectForKey (new NSString ("airports")); } for (nuint i = 0; i < airports.Count; i++) { NSDictionary item = airports.GetItem<NSDictionary> (i); NSString name = (NSString)item.ValueForKey (new NSString ("FIELD2")); NSString shortName = (NSString)item.ValueForKey (new NSString ("FIELD5")); string result = String.Format ("{0}, {1}", name.ToString (), shortName.ToString ()); if (result.ToUpper ().StartsWith (prefix.ToUpper ())) { suggestions.Add (new TKAutoCompleteToken (new NSString (result))); } } } DispatchQueue queue = DispatchQueue.MainQueue; queue.DispatchAfter (DispatchTime.Now, delegate {autocomplete.CompleteSuggestionViewPopulation (suggestions);}); } }
// // Save support: // Override one of GetAsData, GetAsFileWrapper, or WriteToUrl. // // This method should store the contents of the document using the given typeName // on the return NSData value. public override NSData GetAsData(string typeName, out NSError outError) { outError = null; // End editing tableView.Window.EndEditingFor(null); NSMutableArray array = new NSMutableArray(); foreach (Person p in Employees) { array.Add(p); } // Create an NSData object from the employees array NSData data = NSKeyedArchiver.ArchivedDataWithRootObject(array); return data; // Default template code // outError = NSError.FromDomain(NSError.OsStatusErrorDomain, -4); // return null; }
public static int OpenApplication (ApplicationStartInfo application) { if (application == null) throw new ArgumentNullException ("application"); if (string.IsNullOrEmpty (application.Application) || !System.IO.Directory.Exists (application.Application)) throw new ArgumentException ("Application is not valid"); NSUrl appUrl = NSUrl.FromFilename (application.Application); // TODO: Once the above bug is fixed, we can replace the code below with //NSRunningApplication app = NSWorkspace.SharedWorkspace.LaunchApplication (appUrl, 0, new NSDictionary (), null); var config = new NSMutableDictionary (); if (application.Args != null && application.Args.Length > 0) { var args = new NSMutableArray (); foreach (string arg in application.Args) { args.Add (new NSString (arg)); } config.Add (new NSString ("NSWorkspaceLaunchConfigurationArguments"), args); } if (application.Environment != null && application.Environment.Count > 0) { var envValueStrings = application.Environment.Values.Select (t => new NSString (t)).ToArray (); var envKeyStrings = application.Environment.Keys.Select (t => new NSString (t)).ToArray (); var envDict = new NSMutableDictionary (); for (int i = 0; i < envValueStrings.Length; i++) { envDict.Add (envKeyStrings[i], envValueStrings[i]); } config.Add (new NSString ("NSWorkspaceLaunchConfigurationEnvironment"), envDict); } UInt32 options = 0; if (application.Async) options |= (UInt32) LaunchOptions.NSWorkspaceLaunchAsync; if (application.NewInstance) options |= (UInt32) LaunchOptions.NSWorkspaceLaunchNewInstance; IntPtr error; var appHandle = IntPtr_objc_msgSend_IntPtr_UInt32_IntPtr_IntPtr (NSWorkspace.SharedWorkspace.Handle, launchApplicationAtURLOptionsConfigurationErrorSelector, appUrl.Handle, options, config.Handle, out error); NSRunningApplication app = (NSRunningApplication)ObjCRuntime.Runtime.GetNSObject (appHandle); return app.ProcessIdentifier; }
NSMutableArray GetDataSource() { NSMutableArray array = new NSMutableArray (); array.Add(getDictionary("Alabama" , "Vegetables" , 42)); array.Add(getDictionary( "Alaska" , "Vegetables" , 0 )); array.Add(getDictionary( "Arizona" , "Rice" , 36 )); array.Add(getDictionary( "Arkansas" , "Vegetables" , 46 )); array.Add(getDictionary( "California" , "Rice" , 24 )); array.Add(getDictionary( "Colorado" , "Rice" , 31)); array.Add(getDictionary( "Connecticut" , "Grains" , 18 )); array.Add(getDictionary( "Delaware" , "Grains" , 28 )); array.Add(getDictionary( "District of Columbia" , "Grains" , 27 )); array.Add(getDictionary( "Florida" , "Rice" , 48 )); array.Add(getDictionary( "Georgia" , "Rice" , 44)); array.Add(getDictionary( "Hawaii" , "Grains" , 49 )); array.Add(getDictionary( "Idaho" , "Grains" , 8 )); array.Add(getDictionary( "Illinois" , "Vegetables" , 26 )); array.Add(getDictionary( "Indiana" , "Grains" , 21 )); array.Add(getDictionary( "Iowa" , "Vegetables" , 13 )); array.Add(getDictionary( "Kansas" , "Rice" , 33 )); array.Add(getDictionary( "Kentucky" , "Grains" , 32 )); array.Add(getDictionary( "Louisiana" , "Rice" , 47 )); array.Add(getDictionary( "Maine" , "Grains" , 3 )); array.Add(getDictionary( "Maryland" , "Grains" , 30 )); array.Add(getDictionary( "Massachusetts" , "Grains" , 14 )); array.Add(getDictionary( "Michigan" , "Grains" , 50 )); array.Add(getDictionary( "Minnesota" , "Wheat" , 10 )); array.Add(getDictionary( "Mississippi" , "Vegetables" , 43 )); array.Add(getDictionary( "Missouri" , "Vegetables" , 35 )); array.Add(getDictionary( "Montana" , "Grains" , 2 )); array.Add(getDictionary( "Nebraska" , "Rice" , 15 )); array.Add(getDictionary( "Nevada" , "Wheat" , 22 )); array.Add(getDictionary( "New Hampshire" , "Grains" , 12 )); array.Add(getDictionary( "New Jersey" , "Vegetables" , 20 )); array.Add(getDictionary( "New Mexico" , "Rice" , 41 )); array.Add(getDictionary( "New York" , "Vegetables" , 16 )); array.Add(getDictionary( "North Carolina" , "Rice" , 38 )); array.Add(getDictionary( "North Dakota" , "Grains" , 4 )); array.Add(getDictionary( "Ohio" , "Vegetables" , 25 )); array.Add(getDictionary( "Oklahoma" , "Rice" , 37 )); array.Add(getDictionary( "Oregon" , "Wheat" , 11 )); array.Add(getDictionary( "Pennsylvania" , "Vegetables" , 17 )); array.Add(getDictionary( "Rhode Island" , "Grains" , 19 )); array.Add(getDictionary( "South Carolina" , "Rice" , 45 )); array.Add(getDictionary( "South Dakota" , "Grains" , 5 )); array.Add(getDictionary( "Tennessee" , "Vegetables" , 39 )); array.Add(getDictionary( "Texas" , "Vegetables" , 40 )); array.Add(getDictionary( "Utah" , "Rice" , 23 )); array.Add(getDictionary( "Vermont" , "Grains" , 9 )); array.Add(getDictionary( "Virginia" , "Rice" , 34 )); array.Add(getDictionary( "Washington" , "Vegetables" , 1 )); array.Add(getDictionary( "West Virginia" , "Grains" , 29 )); array.Add(getDictionary( "Wisconsin" , "Grains" , 7 )); array.Add(getDictionary( "Wyoming" , "Wheat" , 6 )); return array; }
void SetColorMapping(SFShapeSetting setting) { NSMutableArray colorMappings = new NSMutableArray (); SFEqualColorMapping colorMapping1= new SFEqualColorMapping(); colorMapping1.Value= (NSString)"Vegetables"; colorMapping1.LegendLabel= (NSString)"Vegetables"; colorMapping1.Color = UIColor.FromRGB (0x29, 0xBB, 0x9C); colorMappings.Add(colorMapping1); SFEqualColorMapping colorMapping2= new SFEqualColorMapping(); colorMapping2.Value=(NSString) "Rice"; colorMapping2.LegendLabel= (NSString)"Rice"; colorMapping2.Color = UIColor.FromRGB (0xFD, 0x8C, 0x48); colorMappings.Add(colorMapping2); SFEqualColorMapping colorMapping3= new SFEqualColorMapping(); colorMapping3.Value=(NSString) "Wheat"; colorMapping3.LegendLabel= (NSString)"Wheat"; colorMapping3.Color =UIColor.FromRGB (0xE5, 0x4D, 0x42); colorMappings.Add(colorMapping3); SFEqualColorMapping colorMapping4= new SFEqualColorMapping(); colorMapping4.Value= (NSString)"Grains"; colorMapping4.LegendLabel= (NSString)"Grains"; colorMapping4.Color =UIColor.FromRGB (0x3A, 0x99, 0xD9); colorMappings.Add(colorMapping4); setting.ColorMappings = colorMappings; }
public LiveUpdateDataSource () { DataPoints = new NSMutableArray (); DataPoints1 = new NSMutableArray (); for (int i = 1; i <= 180; i++) { double value = Math.Sin(wave1 * (Math.PI / 180.0)); DataPoints.Add (new SFChartDataPoint (NSObject.FromObject (i), NSObject.FromObject(value))); wave1++; } for (int i = 1; i <= 180; i++) { double value = Math.Sin(wave2 * (Math.PI / 180.0)); DataPoints1.Add (new SFChartDataPoint (NSObject.FromObject (i), NSObject.FromObject(value))); wave2++; } }
public override void Filtering(XuniAutoComplete sender, XuniAutoCompleteFilteringEventArgs eventArgs) { sender.CollectionView.Filter = (item) => { Countries d = (Countries)item; string s = d.Name.Substring(0, 1).ToLower(); if (s == "b") { return true; } return false; }; NSMutableArray data = null; if (sender.CollectionView.Items != null) { data = new NSMutableArray(); foreach (var item in sender.CollectionView.Items) { data.Add(NSObject.FromObject(item)); } } sender.ItemsSource = data ; //filterAuto.FilteringArgs.Cancel = false; }