コード例 #1
0
        partial void okButtonCkicked(Foundation.NSObject sender)
        {
            spinner.Hidden = false;
            spinner.StartAnimation(this);

            if (CurrentInterface == null)
            {
                return;
            }

            NSError error;

            CurrentInterface.AssociateToNetwork(NetworkToJoin, passphraseTextField.StringValue, out error);

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

            if (error != null)
            {
                NSAlert.WithError(error).RunModal();
            }
            else
            {
                Window.Close();
            }
        }
コード例 #2
0
        partial void joinOKButtonPressed(NSObject sender)
        {
            CW8021XProfile profile = null;

            joinSpinner.Hidden = false;
            joinSpinner.StartAnimation(Window);

            if (joinUser8021XProfilePopupButton.Enabled)
            {
                if (String.Equals(joinUser8021XProfilePopupButton, "Default"))
                {
                    profile                 = CW8021XProfile.Profile;
                    profile.Ssid            = joinNetworkNameField.StringValue;
                    profile.UserDefinedName = joinNetworkNameField.StringValue;
                    profile.Username        = !String.IsNullOrEmpty(joinUsernameField.StringValue) ? joinUsernameField.StringValue : null;
                    profile.Password        = !String.IsNullOrEmpty(joinPassphraseField.StringValue) ? joinPassphraseField.StringValue : null;
                }
                else
                {
                    var index = joinUser8021XProfilePopupButton.IndexOfSelectedItem;
                    if (index >= 0)
                    {
                        profile = CW8021XProfile.AllUser8021XProfiles[index];
                    }
                }
            }

            if (JoinDialogContext)
            {
                NSMutableDictionary param = new NSMutableDictionary();
                if (profile != null)
                {
                    param.SetValueForKey(profile, CWConstants.CWAssocKey8021XProfile);
                }

                else
                {
                    param.SetValueForKey(!String.IsNullOrEmpty(joinPassphraseField.StringValue) ? joinPassphraseField.ObjectValue: null, CWConstants.CWAssocKeyPassPhrase);
                }

                NSError error  = null;
                bool    result = CurrentInterface.AssociateToNetwork(SelectedNetwork, NSDictionary.FromDictionary(param), out error);

                joinSpinner.StopAnimation(Window);
                joinSpinner.Hidden = true;

                if (!result)
                {
                    NSAlert.WithError(error).RunModal();
                }

                else
                {
                    joinCancelButtonPressed(this);
                }
            }
        }