public void ConnectToVpn(int selection)
        {
            //Reconnect onto the Graphic Thread
            try
            {
                string[] vpns = request_.ListAvaliableVpns().ToArray();
                if (selection < vpns.Length && selection >= 0)
                {
                    request_.ConnectToVpn(vpns[selection]);
                }
                else
                {
                    UIThreadHook.HookOntoGuiThead(() =>
                    {
                        Global.BasicNotificationAlert("Invalid Selection", "You selected an invalid entry", MainPageController);
                    });

                    Console.WriteLine("Please select a valid option");
                }
            }
            catch (Exception ex)
            {
                UIThreadHook.HookOntoGuiThead(() =>
                {
                    Global.BasicNotificationAlert("Something Broke", "We were unable to process a request",
                                                  MainPageController, ex.ToString());
                });
            }
        }
 /// <summary>
 /// Broadcast ExceptionMessage For connect to vpn being compleated
 /// </summary>
 /// <param name="response"></param>
 public void ConnectedToVpn(ConnectToVpnResponse response)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(response.Status))
         {
             Console.WriteLine("Vpn Connected to: " + response.VpnLocation);
             UIThreadHook.HookOntoGuiThead(() =>
             {
                 Global.BasicNotificationAlert("Connected", "Vpn Connected to: " + response.VpnLocation,
                                               MainPageController);
             });
         }
         else
         {
             Console.WriteLine("Connection Attempted failed to " + response.VpnLocation + " Reason:" +
                               response.Status);
         }
     }
     catch (Exception ex)
     {
         UIThreadHook.HookOntoGuiThead(() =>
         {
             Global.BasicNotificationAlert("Something Broke", "We were unable to process a request",
                                           MainPageController, ex.ToString());
         });
     }
 }
 /// <summary>
 /// Broadcast ExceptionMessage For vpn being disconnected
 /// </summary>
 /// <param name="response"></param>
 public void DisconnectedFromVpn(DisconnectFromVpnResponse response)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(response.Status))
         {
             UIThreadHook.HookOntoGuiThead(() =>
             {
                 Global.BasicNotificationAlert("\nVpn was disconnected: ", response.Reason, MainPageController);
                 MainPageController.LblStatus.Text      = "Not Connected";
                 MainPageController.LblStatus.TextColor = UIColor.Red;
             });
             connected_ = false;
         }
         else
         {
             UIThreadHook.HookOntoGuiThead(() =>
             {
                 Global.BasicNotificationAlert("\nVpn was unable to disconnect: ",
                                               response.Status + " Reason: " + response.Reason, MainPageController);
             });
         }
     }
     catch (Exception ex)
     {
         UIThreadHook.HookOntoGuiThead(() =>
         {
             Global.BasicNotificationAlert("Something Broke", "We were unable to process a request",
                                           MainPageController, ex.ToString());
         });
     }
 }
 public void DisconnectFromVpn()
 {
     try
     {
         request_.DisconnectFromVpn();
     }
     catch (Exception ex)
     {
         UIThreadHook.HookOntoGuiThead(() =>
         {
             Global.BasicNotificationAlert("Something Broke", "We were unable to process a request",
                                           MainPageController, ex.ToString());
         });
     }
 }
        //public NSIndexPath[] SelectedItems { get { return _selectedItems.ToArray(); } }
        //readonly List<NSIndexPath> _selectedItems = new List<NSIndexPath>();

        public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
        {
            if (!inMethod)
            {
                inMethod = true;
                Task.Run(() =>
                {
                    bool disconnect      = false;
                    int connectionNumber = -1;
                    UIThreadHook.HookOntoGuiThead(() =>
                    {
                        VpnSelectorModel model = Source.Vpns.FirstOrDefault(x => x.Selected);
                        if (model != null)
                        {
                            if (model == Source.Vpns[indexPath.Row]
                                ) //if it's the same model that is already selected then there is no point in marking it again
                            {
                                return;
                            }
                            //TODO: move the index selection code the broadcast response
                            model.Selected = false;
                            disconnect     = true;
                            //RouterVpnManagerWrapper.Instance.DisconnectFromVpn();
                        }

                        Source.Vpns[indexPath.Row].Selected = true;

                        connectionNumber = Source.Vpns[indexPath.Row].ConnectionNumber;
                    });

                    if (connectionNumber == -2)
                    {
                        RouterVpnManagerWrapper.Instance.DisconnectFromVpn();
                    }
                    else
                    {
                        RouterVpnManagerWrapper.Instance.ConnectToVpn(connectionNumber);
                    }

                    UIThreadHook.HookOntoGuiThead(() => {
                        Controller.CollectionView.ReloadData();
                        inMethod = false;
                    });
                });
            }
        }