Exemplo n.º 1
0
        partial void ibssOKButtonPressed(NSObject sender)
        {
            ibssSpinner.Hidden = false;
            ibssSpinner.StartAnimation(this);

            string   networkName = ibssNetworkNameField.StringValue;
            NSNumber channel     = new NSNumber(Convert.ToInt32(ibssChannelPopupButton.SelectedItem.Title));
            string   passPhrase  = ibssPassphraseField.StringValue;

            NSMutableDictionary ibssParams = new NSMutableDictionary();

            if (!(String.IsNullOrEmpty(networkName)))
            {
                ibssParams.SetValueForKey(ibssNetworkNameField.ObjectValue, CWConstants.CWIBSSKeySSID);
            }


            if (channel.IntValue > 0)
            {
                ibssParams.SetValueForKey(channel, CWConstants.CWIBSSKeyChannel);
            }

            if (!(String.IsNullOrEmpty(passPhrase)))
            {
                ibssParams.SetValueForKey(ibssPassphraseField.ObjectValue, CWConstants.CWIBSSKeyPassphrase);
            }

            NSError error = null;

            bool created = CurrentInterface.EnableIBSSWithParameters(NSDictionary.FromDictionary(ibssParams), out error);

            ibssSpinner.StopAnimation(this);
            ibssSpinner.Hidden = true;

            if (!created)
            {
                NSAlert.WithError(error).RunModal();
            }
            else
            {
                ibssCancelButtonPressed(this);
            }
        }