当前位置: 首页>>代码示例>>C#>>正文


C# NSTableView类代码示例

本文整理汇总了C#中NSTableView的典型用法代码示例。如果您正苦于以下问题:C# NSTableView类的具体用法?C# NSTableView怎么用?C# NSTableView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NSTableView类属于命名空间,在下文中一共展示了NSTableView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AwakeFromNib

		public override void AwakeFromNib ()
		{
			base.AwakeFromNib ();
			this.BtnClose.Activated += (object sender, EventArgs e) => {
				this.Close ();
				NSApplication.SharedApplication.StopModalWithCode (0);
			};
			TableView = new NSTableView ();
			TableView.Delegate = new TableDelegate ();
			TableView.Frame = new CoreGraphics.CGRect (20, 20, 450, 450);
			this.MainTableView.AddSubview (TableView);
			IList<ComputerDto> computers = new List<ComputerDto> ();
			ActionHelper.Execute (delegate() {
				var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken (ServerDto.ServerName);
				computers = SnapInContext.Instance.ServiceGateway.Server.GetComputers (ServerDto, auth.Token);
			});
			var listView = new ComputersDataSource { Entries = computers };
			var columnNames = new List<ColumnOptions> {
				new ColumnOptions{ Id = "Name", DisplayName = "Computer Name", DisplayOrder = 1, Width = 300 },
				new ColumnOptions{ Id = "DomainController", DisplayName = "Domain Controller", DisplayOrder = 2, Width = 130 }
			};
			var columns = ListViewHelper.ToNSTableColumns (columnNames);
			foreach (var column in columns) {
				TableView.AddColumn (column);
			}
			TableView.DataSource = listView;
			TableView.ReloadData ();
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:28,代码来源:ShowComputersController.cs

示例2: InitializeTable

 private void InitializeTable(NSTableView table)
 {
     var columns = table.TableColumns();
     columns[0].SetIdentifier(PreviewTableDelegate.CellIdentifiers[0]);
     columns[0].MinWidth = 50;
     columns[0].MaxWidth = 200;
     columns[0].Width = 60;
     var bc = new NSButtonCell();
     bc.SetButtonType(NSButtonType.OnOff);
  //   columns[0].DataCell = bc;
     columns[0].Title = Configuration.Settings.Language.General.Apply;
     columns[1].SetIdentifier(PreviewTableDelegate.CellIdentifiers[1]);
     columns[1].MinWidth = 50;
     columns[1].MaxWidth = 200;
     columns[1].Width = 60;
     columns[1].Title = Configuration.Settings.Language.General.LineNumber;
     table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[2]) 
         {
             MinWidth = 100,
             MaxWidth = 2000,
             Width = 250,
             Title = Configuration.Settings.Language.General.Before,
         });
     table.AddColumn(new NSTableColumn(PreviewTableDelegate.CellIdentifiers[3]) 
         {
             MinWidth = 100,
             MaxWidth = 2000,
             Width = 250,
             Title = Configuration.Settings.Language.General.After,
         });                             
 }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:31,代码来源:RemoveTextForHearingImpaired.cs

示例3: ObjectValueForTableColumn

 public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
 {
     try {
         if (Entries != null) {
             X509Certificate2 cert = Entries [row].Cert;
             switch (col.Identifier) {
             case "Alias":
                 return (NSString)Entries [row].Alias;
             case VMIdentityConstants.CERT_ISSUED_BY:
                 return (NSString)cert.Issuer;
             case VMIdentityConstants.CERT_ISSUED_DATE:
                 return (NSString)cert.NotBefore.ToShortDateString ();
             case VMIdentityConstants.CERT_EXPIRATION_DATE:
                 return (NSString)cert.NotAfter.ToShortDateString ();
             case VMIdentityConstants.CERT_INTENDED_PURPOSES:
                 return (NSString)cert.GetKeyUsage ();
             case VMIdentityConstants.CERT_STATUS:
                 break;
             case VMIdentityConstants.CERT_ISSUED_TO:
                 return (NSString)cert.Subject;
             }
         }
     } catch (Exception e) {
         System.Diagnostics.Debug.WriteLine ("Error in fetching data : " + e.Message);
     }
     return null;
 }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:27,代码来源:CertificateDetailsListView.cs

示例4: GetObjectValue

        public NSObject GetObjectValue(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            if (IsViewReady) {
                Employee emp = DataStore.Employees[(int)row];
                switch (tableColumn.Identifier)
                {
                    case "FirstName":
                        return new NSString(emp.FirstName);

                    case "LastName":
                        return new NSString(emp.LastName);

                    case "DepartmentName":
                        NSPopUpButtonCell button = tableColumn.DataCellForRow(row) as NSPopUpButtonCell;
                        button.RemoveAllItems();
                        foreach(Department dep in DataStore.Departments) {
                            button.Menu.AddItem(dep.Name, new ObjCRuntime.Selector("departmentSelected:"), "");
                        }
                        return button;

                    default:
                        return new NSString("");
                }
            }
            else return new NSString("");
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:26,代码来源:EmployeeViewController.cs

示例5: GetViewForItem

        public override NSView GetViewForItem(NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;
            if (tableColumn.Identifier == CellIdentifierEnabled)
            {
                NSButton v = null;
                if (v == null)
                {
                    v = new NSButton();
                    v.Title = string.Empty;
                    v.SetButtonType(NSButtonType.Switch);
                    if (_dataSource.Items[r].Checked)
                    {
                        v.State = NSCellStateValue.On;
                    }
                    else
                    {
                        v.State = NSCellStateValue.Off;
                    }
                    v.Activated += (object sender, EventArgs e) =>
                    {
                        var b = v.State == NSCellStateValue.On;
                        _dataSource.Items[r].Checked = b;
                        _controller.SaveRuleState(r, b);
                    };
                }
                return v;
            }


            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView(CellIdentifier, this);
            if (view == null)
            {
                view = new NSTextField();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }

            // Setup view based on the column selected
            switch (tableColumn.Identifier)
            {
                case CellIdentifierEnabled:
                    view.StringValue = _dataSource.Items[r].Checked.ToString();
                    break;
                case CellIdentifierFixWhat:
                    view.StringValue = _dataSource.Items[r].Name;
                    break;
                case CellIdentifierExample:
                    view.StringValue = _dataSource.Items[r].Example;
                    break;
            }

            return view;
        }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:60,代码来源:FixCommonErrorsTableDelegate.cs

示例6: NumberOfRowsInTableView

		public int NumberOfRowsInTableView (NSTableView table)
		{
			var groups = (Groups != null) ? Groups.Count : 0;
			var users = (Users != null) ? Users.Count : 0;
			var solutionUsers = (SolutionUsers != null) ? SolutionUsers.Count : 0;
			return groups + users + solutionUsers;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:7,代码来源:GroupMembershipDataSource.cs

示例7: ObjectValueForTableColumn

		public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
		{
			var value = (NSString)string.Empty;
			ActionHelper.Execute (delegate() {
				if (Entries != null) {
					var obj = (this.Entries [row]) as UserDto;

					switch (col.Identifier) {
					case "Name":
						value = (NSString)obj.Name;
						break;
					case "FirstName":
						value = (NSString)obj.PersonDetails.FirstName;
						break;
					case "LastName": 
						value = (NSString)obj.PersonDetails.LastName;
						break;
					case "Email": 
						value = (NSString)obj.PersonDetails.EmailAddress;
						break;
					case "Description":
						value = (NSString)obj.PersonDetails.Description;
						break;
					default:
						break;
					}
				}
			});
			return value;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:30,代码来源:UsersDataSource.cs

示例8: ObjectValueForTableColumn

		public NSObject ObjectValueForTableColumn (NSTableView table, NSTableColumn col, int row)
		{
			var value = (NSString)string.Empty;
			ActionHelper.Execute (delegate() {
				if (Entries != null) {
					var obj = (this.Entries [row]) as AssertionConsumerServiceDto;

					switch (col.Identifier) {
					case "Name":
						value = (NSString)obj.Name;
						break;
					case "Index":
						value = (NSString)obj.Index.ToString ();
						break;
					case "Binding":
						value = (NSString)obj.Binding;
						break;
					case "Endpoint":
						value = (NSString)obj.Endpoint;
						break;
					case "IsDefault":
						value = (NSString)obj.IsDefault.ToString ();
						break;
					default:
						break;
					}
				}
			});
			return value;
		}
开发者ID:saberlilydian,项目名称:lightwave,代码行数:30,代码来源:AssertionConsumerServiceDataSource.cs

示例9: NumberOfRowsInTableView

 public int NumberOfRowsInTableView (NSTableView table)
 {
     if (data != null)
         return data.Count;
     else
         return 0;
 }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:7,代码来源:PropertiesTableViewDataSource.cs

示例10: GetViewForItem

        public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;
            if (tableColumn.Identifier == CellIdentifierApply)
            {
                //var v = (NSButton)tableView.MakeView (CellIdentifier, this);
                NSButton v = null;
                if (v == null)
                {
                    v = new NSButton();
                    v.Title = string.Empty;
                    v.SetButtonType(NSButtonType.Switch);
                    if (_dataSource.Items[r].Apply)
                    {
                        v.State = NSCellStateValue.On;
                    }
                    else
                    {
                        v.State = NSCellStateValue.Off;
                    }
                    v.Activated += (object sender, EventArgs e) =>
                    {
                        _dataSource.Items[r].Apply = v.State == NSCellStateValue.On;
                    };
                }
                return v;
            }


            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this);
            if (view == null) {
                view = new NSTextField ();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }

            // Setup view based on the column selected
            switch (tableColumn.Identifier) {
                case CellIdentifierApply:
                    view.StringValue = _dataSource.Items[r].Apply.ToString();
                    break;
                case CellIdentifierLineNumber:
                    view.StringValue = _dataSource.Items[r].LineNumber;
                    break;
                case CellIdentifierBefore:
                    view.StringValue = _dataSource.Items[r].Before.ToListViewString();
                    break;
                case CellIdentifierAfter:
                    view.StringValue = _dataSource.Items[r].After.ToListViewString();
                    break;
            }

            return view;
        }  
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:60,代码来源:PreviewTableDelegate.cs

示例11: NumberOfRowsInTableView

 public int NumberOfRowsInTableView (NSTableView table)
 {
     if (Entries != null)
         return this.Entries.Count;
     else
         return 0;
 }
开发者ID:saberlilydian,项目名称:lightwave,代码行数:7,代码来源:SecretKeysListView.cs

示例12: GetViewForItem

        public override NSView GetViewForItem (NSTableView tableView, NSTableColumn tableColumn, nint row)
        {
            int r = (int)row;

            // This pattern allows you reuse existing views when they are no-longer in use.
            // If the returned view is null, you instance up a new view
            // If a non-null view is returned, you modify it enough to reflect the new data
            NSTextField view = (NSTextField)tableView.MakeView (CellIdentifier, this);
            if (view == null) {
                view = new NSTextField ();
                view.Identifier = CellIdentifier;
                view.BackgroundColor = NSColor.Clear;
                view.Bordered = false;
                view.Selectable = false;
                view.Editable = false;
            }
                
            // Setup view based on the column selected
            switch (tableColumn.Identifier) {
                case CellIdentifierFirst:
                    view.StringValue = DataSource.Items[r];
                    break;
            }

            return view;
        }  
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:26,代码来源:StringListTableDelegate.cs

示例13: ValidateDrop

 public override NSDragOperation ValidateDrop(NSTableView tableView, NSDraggingInfo info, nint row, NSTableViewDropOperation dropOperation)
 {
     if (_openSubtitleAction != null)
     {
         return NSDragOperation.Copy;
     }
     return NSDragOperation.None;
 }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:8,代码来源:SubtitleTableDataSource.cs

示例14: InitializeTable

 private void InitializeTable(NSTableView table)
 {
     var columns = table.TableColumns();
     columns[0].SetIdentifier(StringListTableDelegate.CellIdentifiers[0]);
     columns[0].MinWidth = 50;
     columns[0].MaxWidth = 20000;
     columns[0].Width = 2060;
 }
开发者ID:SubtitleEdit,项目名称:subtitleedit-mac,代码行数:8,代码来源:SpellCheck.cs

示例15: CocoaResultViewHelper

 public CocoaResultViewHelper(NSTableView resultView)
 {
     _resultView = resultView;
     _resultView.SetDelegate(d => {
         d.TableViewSelectionDidChange += HandleResultViewTableViewSelectionDidChange;
     });
     _results = new CocoaResultsDataSource();
     _resultView.DataSource = _results;
 }
开发者ID:alfar,项目名称:WordBuilder,代码行数:9,代码来源:CocoaResultViewHelper.cs


注:本文中的NSTableView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。