示例#1
0
		public override void AwakeFromNib ()
		{
			// hide progress indicators
			refreshSpinner.Hidden = true;
			joinSpinner.Hidden = true;
			ibssSpinner.Hidden = true;

			// quit if no wireless interfaces exist
			var interfaces = CWInterface.SupportedInterfaces;
			if (interfaces == null || interfaces.Length == 0) {
				BeginInvokeOnMainThread (() => {
					var alert = new NSAlert {
						AlertStyle = NSAlertStyle.Critical,
						MessageText = "No Wireless Interfaces Available",
						InformativeText = "This application requires at least one wireless interface.",
					};
					alert.AddButton ("Quit");
					alert.RunSheetModal (Window);
					NSApplication.SharedApplication.Terminate (this);
				});
				return;
			}

			// populate interfaces popup with all supported interfaces
			supportedInterfacesPopup.RemoveAllItems ();
			supportedInterfacesPopup.AddItems (interfaces);

			// setup scan results table
			scanResultsTable.DataSource = new ScanResultsTableDataSource (this);
			
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWBSSIDDidChangeNotification, HandleNotification);
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWCountryCodeDidChangeNotification, HandleNotification);
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWLinkDidChangeNotification, HandleNotification);
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWModeDidChangeNotification, HandleNotification);
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWPowerDidChangeNotification, HandleNotification);
			NSNotificationCenter.DefaultCenter.AddObserver(CWConstants.CWSSIDDidChangeNotification, HandleNotification);
		}
示例#2
0
		void Run (NSAlert alert)
		{
			switch (AlertOptions.SelectedTag) {
			case 0:
				alert.BeginSheet (Window, response => ShowResponse (alert, response));
				break;
			case 1:
				ShowResponse (alert, alert.RunSheetModal (Window));
				break;
			case 2:
				ShowResponse (alert, alert.RunModal ());
				break;
			default:
				ResultLabel.StringValue = "Unknown Alert Option";
				break;
			}
		}