Esempio n. 1
0
        private void SaveDataTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            winControls.TextBox textBox = (winControls.TextBox)sender;
            if (textBox.Name == "TenantIdTextBox")
            {
                if (textBox.Text.Length < textBox.MaxLength)
                {
                    MessageBox.Show("Tenant Id should contain exactly 36 characters." + Environment.NewLine +
                                    "Format: 00112233-4455-6677-8899-aabbccddeeff");
                    return;
                }
            }

            string configKey   = GetConfigKey(textBox.Name, textBox.GetType());
            string configValue = textBox.Text;

            _updatedConfigValues[configKey] = configValue;
        }
Esempio n. 2
0
        private void ChangeConfigValue(object sender, bool isFile = false)
        {
            if (isFile)
            {
                winControls.TextBox textBox = (winControls.TextBox)sender;

                winForms.OpenFileDialog fileBrowser = new winForms.OpenFileDialog();
                fileBrowser.InitialDirectory = Path.GetDirectoryName(textBox.Text);
                winForms.DialogResult dialogResult = fileBrowser.ShowDialog();

                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    string configKey   = GetConfigKey(textBox.Name, textBox.GetType());
                    string configValue = fileBrowser.FileName;

                    _updatedConfigValues[configKey] = configValue;

                    textBox.Text = configValue;
                }
            }
            else
            {
                winControls.TextBox textBox = (winControls.TextBox)sender;

                winForms.FolderBrowserDialog folderBrowser = new winForms.FolderBrowserDialog();
                folderBrowser.SelectedPath = Path.GetFullPath(textBox.Text);
                winForms.DialogResult dialogResult = folderBrowser.ShowDialog();

                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    string configKey   = GetConfigKey(textBox.Name, textBox.GetType());
                    string configValue = folderBrowser.SelectedPath;

                    _updatedConfigValues[configKey] = configValue;

                    if (configKey == "ScreenshotOnFail")
                    {
                        configValue += @"\template.failed.png";
                    }

                    textBox.Text = configValue;
                }
            }
        }
        void btnCalcular_Click(object sender, RoutedEventArgs e)
        {
            TextBox txtPrueba = new TextBox();
            int contador=1;
            int valorSuma = 0;
            stackPanel.Children.Clear();
            foreach (Object x in panelControl.Children.ToList())
            {
                if (x.GetType().Equals(txtPrueba.GetType()))
                {
                    int cantidad = Convert.ToInt32(((TextBox)x).Text);

                    int valorTotalConVuelto = valorVuelto + valorTotal;
                    int valorPorcentaje = (cantidad * 100) / valorTotalConVuelto;
                    int valorVueltoPersona = (valorVuelto*valorPorcentaje)/100;

                    valorSuma = valorSuma + valorVueltoPersona;

                    TextBlock txtValorVuelto = new TextBlock();
                    txtValorVuelto.Text = "El Vuelto de la Persona " + contador + " es:\n $" + valorVueltoPersona;
                    contador++;
                    stackPanel.Children.Add(txtValorVuelto);
                    
                }
            }
            
            int diferencia = valorVuelto -valorSuma;
            TextBlock txtDiferencia = new TextBlock();
            txtDiferencia.Text = "Hubo una diferencia de: $" + diferencia;
            stackPanel.Children.Add(txtDiferencia);
            
        }