Exemple #1
0
        public async void OnAddLoadbalanceClicked(object sender, EventArgs e)
        {
            List <string> hosts = null;

            if (addedOrEdit)
            {
                hosts = hostsModel.Items
                        .Where(h => h.EnablePipeline &&
                               !LoadBalance.Contains(h.HostName))
                        .Select(h => h.HostName)
                        .ToList();
            }
            else
            {
                hosts = hostsModel.Items
                        .Where(h => h.EnablePipeline &&
                               !LoadBalance.Contains(h.HostName) &&
                               !h.HostName.Equals(Item.HostName))
                        .Select(h => h.HostName)
                        .ToList();
            }

            if (hosts.Count == 0)
            {
                await DisplayAlert(
                    Resx.TextResource.Common_ErrorTitle,
                    Resx.TextResource.New_LoadBalanceHost_Error,
                    Resx.TextResource.Common_Yes);

                return;
            }

            string action = await DisplayActionSheet(
                Resx.TextResource.New_LoadBalanceHost_Title,
                Resx.TextResource.Common_Cancel,
                null,
                hosts.ToArray());

            if (hosts.Contains(action))
            {
                LoadBalance.Add(action);
            }
        }
Exemple #2
0
        public HostEditPage(HostsViewModel viewModel, HostModel editHost)
        {
            InitializeComponent();

            hostsModel  = viewModel;
            addedOrEdit = editHost == null;
            Item        = editHost ?? new HostModel()
            {
                SSLVerify = true
            };
            ShowDeleteBtn      = !addedOrEdit;
            EnableEditHostName = addedOrEdit;

            foreach (var h in Item.LoadBalance)
            {
                LoadBalance.Add(h);
            }

            BindingContext = this;
        }