public static Intent CreateBasicDialog(Activity activity, DialogBuilder.DialogRequestCode request, DialogBuilder.DialogContentType type, int titleId, int messageId, int posTextId, int negTextId, EventHandler posAction, EventHandler negAction) { string title = parseId(activity, titleId); string message = parseId(activity, messageId); string posText = parseId(activity, posTextId); string negText = parseId(activity, negTextId); return CreateBasicDialog(activity, request, type, title, message, posText, negText, posAction, negAction); }
public static Intent CreateBasicDialog(Activity activity, DialogBuilder.DialogRequestCode request, DialogBuilder.DialogContentType type, string title, string message, string posText, string negText, EventHandler posAction, EventHandler negAction) { DialogBuilder builder = new DialogBuilder(activity); builder.RequestCode = request; builder.ContentType = type; if(!String.IsNullOrEmpty(title)) { builder.Title = title; } if(!String.IsNullOrEmpty(message)) { builder.Message = message; } return InitializeDialog(activity, builder, posText, negText, posAction, negAction); }
public static Intent CreateCustomDialog(Activity activity, View[] content, string posText, string negText, EventHandler posAction, EventHandler negAction) { DialogBuilder builder = new DialogBuilder(activity); builder.ContentType = DialogBuilder.DialogContentType.None; builder.RequestCode = DialogBuilder.DialogRequestCode.PosOrNeg; builder.Content.AddRange(content); return InitializeDialog(activity, builder, posText, negText, posAction, negAction); }
protected static Intent InitializeDialog(Activity activity, DialogBuilder builder, string posText, string negText, EventHandler posAction, EventHandler negAction) { if(!String.IsNullOrEmpty(posText)) { builder.PositiveText = posText; } if(posAction != null) { builder.PositiveAction += posAction; } if(!String.IsNullOrEmpty(negText)) { builder.NegativeText = negText; } if(negAction != null) { builder.NegativeAction += negAction; } DialogActivity.Builder = builder; return new Intent(activity, typeof(DialogActivity)); }
//-------------------------------------------------------------- // EVENT CATCHING METHODS //-------------------------------------------------------------- protected override void OnCreate(Bundle bundle) { Builder = new DialogBuilder(this); Builder.PositiveText = null; Builder.PositiveAction = null; Builder.NegativeText = null; Builder.NegativeAction = null; Builder.Message = null; Builder.Title = Resources.GetString(Resource.String.reconnect_activity); base.OnCreate (bundle); _root.SetMinimumWidth(0); _root.SetMinimumHeight(0); CloseAllDialog -= Finish; // Set result CANCELED in case the user backs out SetResult (Android.App.Result.Canceled); // We retrieve the old device we were connected to so we can try to reconnect to it later // (this value will be reinitialized during enabling) _deviceAddress = Network.Instance.CommunicationWay._deviceAddress; // We hook on the event before trying to re-enable the bluetooth Network.Instance.StateConnectedEvent += OnConnected; Network.Instance.StateConnectingEvent += OnConnecting; Network.Instance.StateNoneEvent += OnFail; Network.Instance.RestartMessage += OnRestartReceived; Network.Instance.WriteEvent += WriteMessageEventReceived; // We restart the bluetooth manager and then we try to reconnect restartBluetooth(); }