Exemplo n.º 1
0
        private void AddAccount_Click(object sender, RoutedEventArgs e)
        {
            SetAccount acc_new      = new SetAccount();
            Button     deleteButton = new Button();

            deleteButton.Content = "X";
            deleteButton.SetValue(NameProperty, "delBut");
            deleteButton.Margin     = new Thickness(10, 0, 0, 0);
            deleteButton.Width      = 20;
            deleteButton.Click     += deleteButton_Click;
            deleteButton.Background = new SolidColorBrush(Color.FromRgb(156, 42, 42));
            deleteButton.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
            acc_new.accRow.Children.Add(deleteButton);
            AccountsList.Children.Add(acc_new);
        }
Exemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                DataTable tableLoad = new DataTable()
                {
                    TableName = "accounts"
                };
                tableLoad.Columns.Add("Owner");
                tableLoad.Columns.Add("Path");
                StringReader reader = new StringReader(Properties.Settings.Default.TableXml);
                tableLoad.ReadXml(reader);
                for (int i = 0; i < tableLoad.Rows.Count; i++)
                {
                    SetAccount acc_new      = new SetAccount();
                    Button     deleteButton = new Button();
                    deleteButton.Content = "X";
                    deleteButton.SetValue(NameProperty, "delBut");
                    deleteButton.Margin     = new Thickness(10, 0, 0, 0);
                    deleteButton.Width      = 20;
                    deleteButton.Click     += deleteButton_Click;
                    deleteButton.Background = new SolidColorBrush(Color.FromRgb(156, 42, 42));
                    deleteButton.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255));
                    acc_new.accRow.Children.Add(deleteButton);
                    AccountsList.Children.Add(acc_new);
                }

                int xL = 0;
                foreach (SetAccount el in AccountsList.Children)
                {
                    DataRow row = tableLoad.Rows[xL];
                    el.Owner.Text    = (string)row["Owner"];
                    el.filePath.Text = (string)row["Path"];
                    xL++;
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 3
0
        private void deleteButton_Click(object sender, RoutedEventArgs e)
        {
            SetAccount elem = (SetAccount)((FrameworkElement)((FrameworkElement)(((FrameworkElement)sender).Parent)).Parent).Parent;

            AccountsList.Children.Remove(elem);
        }