protected override async void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);
            if (e.Parameter != null)
            {
                if (e.Parameter.GetType() == typeof(string))
                {
                    string value = (string)e.Parameter;
                    linkedAccount = await LinkedAccounts.Obtener(value);

                    foreach (LinkedAccountField item in linkedAccount.linkedAccountFields)
                    {
                        if (item.Tipo == "text")
                        {
                            TextBlock textBlock = new TextBlock();
                            textBlock.Margin = new Thickness(20, 5, 20, 5);
                            textBlock.Text   = item.Titulo;
                            stackElems.Children.Add(textBlock);

                            TextBox textBox = new TextBox();
                            textBox.Margin = new Thickness(20, 5, 20, 5);
                            textBox.Tag    = item.Nombre;
                            textBox.Text   = item.Valor;
                            stackElems.Children.Add(textBox);
                        }
                        else if (item.Tipo == "bool")
                        {
                        }
                    }
                }
            }
        }
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            foreach (LinkedAccountField campo in linkedAccount.linkedAccountFields)
            {
                foreach (UIElement element in stackElems.Children)
                {
                    if (element.GetType() == typeof(TextBox))
                    {
                        TextBox textBox = (TextBox)element;
                        if (((string)textBox.Tag) == campo.Nombre)
                        {
                            campo.Valor = textBox.Text;
                            break;
                        }
                    }
                }
            }

            var response = await LinkedAccounts.Save(linkedAccount);

            if (response.GetNamedString("Error") == "")
            {
                CloureManager.GoBack("reload");
            }
            else
            {
                CloureManager.ShowDialog(response.GetNamedString("Error"));
            }
        }
Пример #3
0
        private async void LoadData()
        {
            GenericResponse genericResponse = await LinkedAccounts.GetList();

            if (genericResponse.Items.Count > 0)
            {
                grdNoRegisters.Visibility = Visibility.Collapsed;
            }
            else
            {
                grdNoRegisters.Visibility = Visibility.Visible;
            }

            grdItems.ItemsSource = genericResponse.Items;
        }