public void DeleteCheat(NSWindow window) { if (CheatTableView.SelectedRow == -1) { var alert = new NSAlert { AlertStyle = NSAlertStyle.Critical, InformativeText = NSBundle.MainBundle.LocalizedString("Please select the cheat to remove from the list of cheats.", null), MessageText = NSBundle.MainBundle.LocalizedString("Delete Cheat", null), }; alert.BeginSheet(window); } else { SelectedCheat = _cheats.GetItem <CheatModel>((nuint)CheatTableView.SelectedRow); var message = NSBundle.MainBundle.LocalizedString("Are you sure you want to delete cheat `{0:X}` from the table?", null); // Confirm delete var alert = new NSAlert { AlertStyle = NSAlertStyle.Critical, InformativeText = string.Format(message, SelectedCheat.Address), MessageText = NSBundle.MainBundle.LocalizedString("Delete Cheat", null), }; alert.AddButton(NSBundle.MainBundle.LocalizedString("OK", null)); alert.AddButton(NSBundle.MainBundle.LocalizedString("Cancel", null)); alert.BeginSheetForResponse(window, (result) => { // Delete? if (result == 1000) { RemoveCheat(CheatTableView.SelectedRow); } }); } }
public void DeletePerson(NSWindow window) { if (View.SelectedRow == -1) { var alert = new NSAlert() { AlertStyle = NSAlertStyle.Critical, InformativeText = "Please select the person to remove from the list of people.", MessageText = "Delete Person", }; alert.BeginSheet(window); } else { // Grab person SelectedPerson = _people.GetItem <PersonModel> ((nuint)View.SelectedRow); // Confirm delete var alert = new NSAlert() { AlertStyle = NSAlertStyle.Critical, InformativeText = string.Format("Are you sure you want to delete person `{0}` from the table?", SelectedPerson.Name), MessageText = "Delete Person", }; alert.AddButton("Ok"); alert.AddButton("Cancel"); alert.BeginSheetForResponse(window, (result) => { // Delete? if (result == 1000) { RemovePerson(View.SelectedRow); } }); } }
public override void WindowControllerDidLoadNib(NSWindowController windowController) { base.WindowControllerDidLoadNib(windowController); // Add code to here after the controller has loaded the document window // Populate the popup menu NSMenu menu = popup.Menu; NSViewController vc = viewControllers.GetItem <NSViewController>(0); NSMenuItem mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-B as the key equvialent // NSMenuItem mi = new NSMenuItem(vc.Title, null, "b"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); vc = viewControllers.GetItem <NSViewController>(1); mi = new NSMenuItem(vc.Title, null, ""); // Set CMD-A as the key equvialent // mi = new NSMenuItem(vc.Title, null, "a"); // mi.KeyEquivalentModifierMask = NSEventModifierMask.CommandKeyMask; menu.AddItem(mi); // Initially show the first controller. popup.SelectItem(0); DisplayViewController(viewControllers.GetItem <NSViewController>(0)); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); for (nuint i = 0; i < _users.Count; i++) { NSObject val = null; var tempDict = NSUserDefaults.StandardUserDefaults.DictionaryForKey(ApplicationDefaults.ScoreDictionaryKey); tempDict.TryGetValue(_users.GetItem <NSString>(i), out val); _names[(int)i].Text = _users.GetItem <NSString>(i) + "\nScore: " + (((NSNumber)val).ToString() ?? "0"); _nameMap[i] = (int)i; } }
// Attempt to resubmit the scoress public void resubmitSotredScores() { if (GKLocalPlayer.LocalPlayer.Authenticated && storedScores.Count != 0) { nuint index = storedScores.Count - 1; while (index >= 0) { var score = storedScores.GetItem <GKScore> (index); score.ShouldSetDefaultLeaderboard = true; if (score == null) { return; } score.ReportScore(new Action <NSError> ((error) => { if (error == null) { new UIAlertView("Score Submitted", "Score submitted successfully ", null, "OK", null).Show(); } else { this.storeScore(score); new UIAlertView("Score Stored", "Score Stored ", null, "OK", null).Show(); } })); storedScores.RemoveObject((nint)index); index--; } } }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { nuint row = (nuint)indexPath.Row; Control ctrl = controls.GetItem <Control> (row); string sampleListPathString = NSBundle.MainBundle.BundlePath + "/SampleList.plist"; sampleDict = new NSDictionary(); sampleDict = NSDictionary.FromFile(sampleListPathString); NSMutableArray dictArray = sampleDict.ValueForKey(new NSString(ctrl.name)) as NSMutableArray; NSMutableArray sampArray = new NSMutableArray(); for (nuint i = 0; i < dictArray.Count; i++) { NSDictionary dict = dictArray.GetItem <NSDictionary> (i); sampArray.Add(dict.ValueForKey(new NSString("SampleName"))); } SampleViewController sampleController = new SampleViewController(); sampleController.selectedControl = ctrl.name; sampleController.sampleDictionaryArray = dictArray; sampleController.sampleArray = sampArray; controller.NavigationController.PushViewController(sampleController, true); }
public void UnsubscribeAll() { for (nuint i = 0; i < currentTopics.Count; i++) { Unsubscribe(currentTopics.GetItem <NSString>(i)); } }
public void Show() { NSMutableString message = new NSMutableString(); NSIndexPath[] selected = appearAnimationsList.IndexPathsForSelectedItems(); if (selected.Length > 0) { NSIndexPath indexPath = selected [0]; message.Append(new NSString("Alert did ")); message.Append(new NSString(showAnimations.GetItem <NSString> ((uint)indexPath.Row))); message.Append(new NSString("\n")); } selected = hideAnimationsList.IndexPathsForSelectedItems(); if (selected.Length > 0) { NSIndexPath indexPath = selected [0]; message.Append(new NSString("It will ")); message.Append(new NSString(dismissAnimations.GetItem <NSString> ((uint)indexPath.Row))); message.Append(new NSString(" when close")); } alert.Message = message; alert.Show(true); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { NSDictionary item = menuArray.GetItem <NSDictionary> ((nuint)indexPath.Section); var cell = tableView.DequeueReusableCell(CellIdentifier); if (cell == null) { if (indexPath.Section < 2) { cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier); cell.TextLabel.TextAlignment = UITextAlignment.Center; } else { cell = new UITableViewCell(UITableViewCellStyle.Subtitle, CellIdentifier); cell.Accessory = UITableViewCellAccessory.DisclosureIndicator; cell.DetailTextLabel.Lines = 0; cell.DetailTextLabel.Text = (NSString)item ["description"]; } } cell.TextLabel.Text = (NSString)item ["title"]; return(cell); }
public override UITableViewCell GetCell(UITableView tableView, Foundation.NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell("Cell", indexPath); cell.TextLabel.Text = pois.GetItem <CRPOI>((System.nuint)indexPath.Row).Name; return(cell); }
void SendFile(string documentPathForFile, NSMutableArray appDetail, ServiceController svcController) { NSError error = null; var attachments = new[] { documentPathForFile }; GDServiceProvider serviceProvider = null; for (nuint i = 0; i < appDetail.Count; i++) { var detail = appDetail.GetItem <GDServiceProvider>(0); if (detail.Identifier == "com.good.gd.example.appkinetics.saveeditservice") { serviceProvider = detail; break; } } var isRequested = svcController.SendSaveEditFileRequest(out error, serviceProvider.Identifier, null, attachments, "openFileForEdit"); if (!isRequested) { Console.WriteLine("Request was not accepted"); } if (error != null) { UIAlertView alertView = new UIAlertView("Error", error.LocalizedDescription, null, "Ok", null); alertView.Show(); } }
private void GetDocumentSaved() { NSUserDefaults defaults = NSUserDefaults.StandardUserDefaults; NSData encodedObject = (NSData)defaults.ValueForKey(DocumentSavedKey); // Check if there are documents saved if (encodedObject == null) { return; } // Get documents saved and build the list NSMutableArray listDoc = (NSMutableArray)NSKeyedUnarchiver.UnarchiveObject(encodedObject); DocumentsList = new List <Document>(); for (nuint i = 0; i < listDoc.Count; i++) { DocumentArchive docSaved = listDoc.GetItem <DocumentArchive>(i); // Build Document c# object form DocumentArchive NsObject Document doc = new Document(); doc.Name = docSaved.Name; doc.ServerRelativeUrl = docSaved.ServerRelativeUrl; doc.BytesArray = docSaved.BytesArray; DocumentsList.Add(doc); } // Load data and reload TableView tableView.Source = new DocumentTableDataSource(this.DocumentsList, this); tableView.ReloadData(); }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { if (seriesIndex == 1) { return(_expenseAverage.GetItem <SFChartDataPoint>((nuint)index)); } return(_category.GetItem <SFChartDataPoint>((nuint)index)); }
private void Databases_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (var database in SessionData.Current.Databases) { var dbNav = new DbNavigationNode { InstanceId = database.InstanceId, Name = database.Name, NodeType = DbNavigationNodeType.Database }; foreach (var collection in database.Collections) { var nodeType = collection is FileCollectionReference ? DbNavigationNodeType.FileCollection : DbNavigationNodeType.Collection; dbNav.AddChildren(new DbNavigationNode { InstanceId = collection.InstanceId, Name = collection.Name, NodeType = nodeType }); } AddDatabase(dbNav); } } else if (e.Action == NotifyCollectionChangedAction.Remove) { if (e.OldItems == null) { return; } var indexToRemove = new HashSet <nuint>(); foreach (var dbRef in e.OldItems.OfType <DatabaseReference>()) { for (nuint i = 0; i < _databases.Count; i++) { var dbNavNode = _databases.GetItem <DbNavigationNode>(i); if (dbNavNode != null && dbNavNode.InstanceId.Equals(dbRef.InstanceId)) { indexToRemove.Add(i); } } } foreach (var index in indexToRemove) { RemoveDatabase((nint)index); } } else if (e.Action == NotifyCollectionChangedAction.Reset) { ClearDatabases(); } }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { if (seriesIndex == 0) { return(DataPoints.GetItem <SFChartDataPoint> ((nuint)index)); } else { return(DataPoints1.GetItem <SFChartDataPoint> ((nuint)index)); } }
public void DeletePerson(NSWindow window) { // Anything to process? if (SelectedPerson == null) { var alert = new NSAlert() { AlertStyle = NSAlertStyle.Critical, InformativeText = "Please select the person to remove from the collection of people.", MessageText = "Delete Person", }; alert.BeginSheet(window); } else { // Confirm delete var alert = new NSAlert() { AlertStyle = NSAlertStyle.Critical, InformativeText = string.Format("Are you sure you want to delete person `{0}` from the collection?", SelectedPerson.Name), MessageText = "Delete Person", }; alert.AddButton("Ok"); alert.AddButton("Cancel"); alert.BeginSheetForResponse(window, (result) => { // Delete? if (result == 1000) { // Grab person SelectedPerson = _people.GetItem <PersonModel> ((nuint)View.SelectionIndex); // Remove from database SelectedPerson.Delete(_conn); RemovePerson(View.SelectionIndex); } }); } }
public void EditPerson(NSWindow window) { if (SelectedPerson == null) { var alert = new NSAlert() { AlertStyle = NSAlertStyle.Informational, InformativeText = "Please select the person to edit from the collection of people.", MessageText = "Edit Person", }; alert.BeginSheet(window); } else { // Grab person SelectedPerson = _people.GetItem <PersonModel> ((nuint)View.SelectionIndex); var sheet = new PersonEditorSheetController(SelectedPerson, false); // Display sheet sheet.ShowSheet(window); } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Build list of employees AddPerson(new PersonModel("Craig Dunn", "Documentation Manager", true)); AddPerson(new PersonModel("Amy Burns", "Technical Writer")); AddPerson(new PersonModel("Joel Martinez", "Web & Infrastructure")); AddPerson(new PersonModel("Kevin Mullins", "Technical Writer")); AddPerson(new PersonModel("Mark McLemore", "Technical Writer")); AddPerson(new PersonModel("Tom Opgenorth", "Technical Writer")); AddPerson(new PersonModel("Larry O'Brien", "API Documentation Manager", true)); AddPerson(new PersonModel("Mike Norman", "API Documentor")); // Watch for the selection value changing PeopleArray.AddObserver("selectionIndexes", NSKeyValueObservingOptions.New, (sender) => { // Inform caller of selection change try { SelectedPerson = _people.GetItem <PersonModel>((nuint)SelectionIndex); } catch { SelectedPerson = null; } }); }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { if (seriesIndex == 0) { return(DataPoints1.GetItem <SFChartDataPoint> ((nuint)index)); //returns the datapoint for each series. } else if (seriesIndex == 1) { return(DataPoints2.GetItem <SFChartDataPoint> ((nuint)index)); } else { return(DataPoints3.GetItem <SFChartDataPoint> ((nuint)index)); } }
// Important method. Called to generate a cell to display public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { // request a recycled cell to save memory UITableViewCell cell = tableView.DequeueReusableCell(strings.deviceTypeCell); // if there are no cells to reuse, create a new one if (cell == null) { // Generate a default table cell cell = new UITableViewCell(UITableViewCellStyle.Default, "serverdiscoverycell"); } // The text to display on the cell is the plugin name cell.TextLabel.Text = services.GetItem <NSNetService>((nuint)indexPath.Row).HostName; return(cell); }
void Initialize() { serverModeArray = new NSMutableArray(); if (MacUI.AppDelegate.HasBuiltinFramework) { serverModeArray.Add(new ServerModeModel(ServerMode.Builtin, "Builtin test framework")); } else { serverModeArray.Add(new ServerModeModel(ServerMode.WaitForConnection, "Wait for connection")); serverModeArray.Add(new ServerModeModel(ServerMode.Local, "Run locally")); serverModeArray.Add(new ServerModeModel(ServerMode.Android, "Connect to Android")); serverModeArray.Add(new ServerModeModel(ServerMode.iOS, "Connect to iOS")); } string currentMode; if (!SettingsBag.TryGetValue("ServerMode", out currentMode)) { currentMode = MacUI.AppDelegate.HasBuiltinFramework ? "Builtin" : "WaitForConnection"; } SettingsBag.DisableTimeouts = SettingsBag.LogLevel > SettingsBag.DisableTimeoutsAtLogLevel; for (nuint i = 0; i < serverModeArray.Count; i++) { var model = serverModeArray.GetItem <ServerModeModel> (i); if (currentServerMode == null || model.Mode.ToString().Equals(currentMode)) { currentServerMode = model; } } testCategoriesArray = new NSMutableArray(); allCategory = new TestCategoryModel(TestCategory.All); globalCategory = new TestCategoryModel(TestCategory.Global); martinCategory = new TestCategoryModel(TestCategory.Martin); currentCategory = allCategory; testCategoriesArray.Add(allCategory); testCategoriesArray.Add(globalCategory); testCategoriesArray.Add(martinCategory); testFeaturesArray = new NSMutableArray(); }
public void exitMask() { mReader.UseSelectionMask = backupUseMask; for (int i = define.MIN_SELECTION_MASK; i < define.MAX_SELECTION_MASK; i++) { if ((int)backupSelectMasks.Count < i + 1) { mReader.RemoveSelectionMask(i); break; } AsSelectMaskParam param = backupSelectMasks.GetItem <AsSelectMaskParam>((nuint)i); if (param == null) { break; } mReader.SetSelectionMask(i, param); } backupSelectMasks.RemoveAllObjects(); }
public void setSlider(NSMutableArray imageArray) { int width = (int)scrollView.Frame.Size.Width; int height = (int)scrollView.Frame.Size.Height; int count = 0; if (imageArray != null) { count = (int)imageArray.Count; } scrollView.ContentSize = new CoreGraphics.CGSize(width * count, height); pageControl.CurrentPage = 0; pageControl.Pages = count; scrollView.PagingEnabled = true; scrollView.Delegate = new ImageScrollDelegate(this); for (int i = 0; i < count; i++) { UIImageView imageView = new UIImageView(new CoreGraphics.CGRect(width * i, 0, width, height)); imageView.Image = imageArray.GetItem <UIImage>((System.nuint)i); scrollView.AddSubview(imageView); } }
public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath) { Control control = samplesCollections.GetItem <Control>((nuint)indexPath.Row); NSString sampleName = control.Name; NSString dispName = control.DisplayName; NSString name = string.IsNullOrEmpty(dispName) ? sampleName : dispName; UIStringAttributes attribs = new UIStringAttributes { Font = UIFont.SystemFontOfSize(15) }; CGSize size = name.GetSizeUsingAttributes(attribs); if (string.IsNullOrEmpty(control.Tag)) { return(new CGSize(size.Width + 20, 50)); } else { return(new CGSize(size.Width + 40, 50)); } }
public override CGSize GetSizeForItem(UICollectionView collectionView, UICollectionViewLayout layout, NSIndexPath indexPath) { Control control = samplesCollections.GetItem <Control>((nuint)indexPath.Row); NSString sampleName = control.name; NSString dispName = control.dispName; NSString name = (dispName != null && dispName != "") ? dispName : sampleName; UIStringAttributes attribs = new UIStringAttributes { Font = UIFont.SystemFontOfSize(15) }; CGSize size = name.GetSizeUsingAttributes(attribs); if (control.tag != "") { return(new CGSize(size.Width + 40, 50)); } else { return(new CGSize(size.Width + 20, 50)); } }
public void RemoveChild(TestListNode child) { WillChangeValue("isLeaf"); WillChangeValue("childNodes"); InitializeChildren(); var length = children.Count; for (nuint i = 0; i < length; i++) { if (children.GetItem <TestListNode> (i) == child) { children.RemoveObject((nint)i); break; } } child.parent = null; DidChangeValue("isLeaf"); DidChangeValue("childNodes"); }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { return(DataPoints.GetItem <SFChartDataPoint> ((nuint)index)); //returns the datapoint for each series. }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { return(seriesIndex == 1 ? _fieldDataPoints.GetItem <SFChartDataPoint>((nuint)index) : _scheduledDataPoints.GetItem <SFChartDataPoint>((nuint)index)); }
public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { UICollectionViewCell cell = (UICollectionViewCell)collectionView.DequeueReusableCell("textReuseCell", indexPath); cell.BackgroundColor = UIColor.Clear; UIButton label = (UIButton)cell.ViewWithTag(500); UIButton labelX = (UIButton)cell.ViewWithTag(510); labelX.TouchUpInside += (sender, e) => { if (controller.TypesIndexPath != indexPath) { HighlightCell(label, labelX, collectionView, indexPath); } }; label.TouchUpInside += (sender, e) => { if (controller.TypesIndexPath != indexPath) { HighlightCell(label, labelX, collectionView, indexPath); } }; label.SetTitle(string.Empty, UIControlState.Normal); labelX.SetTitle(string.Empty, UIControlState.Normal); Control item = samplesCollections.GetItem <Control>((nuint)indexPath.Row); NSString sampleName = item.Name; NSString dispName = item.DisplayName; dispName = string.IsNullOrEmpty(dispName) ? sampleName : dispName; UIImageView tag = (UIImageView)cell.ViewWithTag(502); if (item.Tag == "NEW") { label.SetTitle(dispName, UIControlState.Normal); tag.Image = UIImage.FromBundle("Controls/Tags/x_new.png"); } else if (item.Tag == "UPDATED") { label.SetTitle(dispName, UIControlState.Normal); tag.Image = UIImage.FromBundle("Controls/Tags/x_update.png"); } else { labelX.SetTitle(dispName, UIControlState.Normal); tag.Image = null; } label.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Normal); labelX.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Normal); label.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Highlighted); labelX.SetTitleColor(UIColor.FromRGB(45.0f / 255.0f, 45.0f / 255.0f, 45.0f / 255.0f), UIControlState.Highlighted); if (indexPath.Row == (int)controller.TypesIndexPath.Row) { label.SetTitleColor(Utility.ThemeColor, UIControlState.Normal); labelX.SetTitleColor(Utility.ThemeColor, UIControlState.Normal); } return(cell); }
public override SFChartDataPoint GetDataPoint(SFChart chart, nint index, nint seriesIndex) { return(_dataPoints.GetItem <SFChartDataPoint>((nuint)index)); }