forked from xamarin/mac-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScanResultsTableDataSource.cs
More file actions
48 lines (44 loc) · 1.46 KB
/
Copy pathScanResultsTableDataSource.cs
File metadata and controls
48 lines (44 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using MonoMac.Foundation;
namespace CoreWLANWirelessManager
{
// Copyright Ashok Gelal (http://ashokgelal.com)
partial class MainWindowController
{
private class ScanResultsTableDataSource : MonoMac.AppKit.NSTableViewDataSource
{
private MainWindowController MyController { get; set;}
public ScanResultsTableDataSource (MainWindowController controller)
{
MyController = controller;
}
public override int GetRowCount (MonoMac.AppKit.NSTableView tableView)
{
return MyController == null ? 0 : MyController.ScanResults.Length;
}
public override MonoMac.Foundation.NSObject GetObjectValue (MonoMac.AppKit.NSTableView tableView, MonoMac.AppKit.NSTableColumn tableColumn, int row)
{
var valueKey = (NSString)tableColumn.Identifier.ToString ();
var dataRow = MyController.ScanResults[row];
switch (valueKey)
{
case "NETWORK_NAME":
return (NSString)dataRow.Ssid;
case "BSSID":
return (NSString)dataRow.Bssid;
case "CHANNEL":
return (NSString)dataRow.Channel.StringValue;
case "PHY_MODE":
return (NSString)dataRow.PhyMode.StringValue;
case "NETWORK_MODE":
return (NSString)(dataRow.IsIBSS?"Yes":"No");
case "RSSI":
return (NSString)dataRow.Rssi.StringValue;
case "SECURITY_MODE":
return (NSString)dataRow.SecurityMode.StringValue;
}
throw new Exception(string.Format("Incorrect value requested '{0}'", valueKey));
}
}
}
}