Ejemplo n.º 1
0
        private void createBacklogButton_Click(object sender, RoutedEventArgs e)
        {
            // Create a new window to input new information about the new Backlog
            NewBacklogWindow myWindow = new NewBacklogWindow();

            myWindow.Closing += MyWindow_Closing;
            myWindow.ShowDialog();
        }
Ejemplo n.º 2
0
        private void MyWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            NewBacklogWindow win = sender as NewBacklogWindow;

            // If the Tag is TRUE (no UNIQUE constraints errors) then proceed as normal
            if ((Boolean)win.Tag)
            {
                try
                {
                    // Obtain the newly created row
                    SQLiteConnection sqlConnection1 = new SQLiteConnection(connectionString);
                    sqlConnection1.Open();
                    SQLiteCommand myCommand = new SQLiteCommand("SELECT * FROM [backlogs] WHERE [name] = @param", sqlConnection1);
                    myCommand.Parameters.Add(new SQLiteParameter("@param", win.Title.ToString()));
                    SQLiteDataReader myReader = myCommand.ExecuteReader();

                    // Create a Button for the newly inserted row
                    Button myButton = new Button();

                    // Set Button properties
                    myReader.Read();
                    myButton.Style   = Application.Current.FindResource("BacklogButton") as Style;
                    myButton.Content = myReader["name"].ToString();
                    myButton.Tag     = myReader["summary"].ToString();
                    myButton.Click  += new RoutedEventHandler(myButton_Click);
                    myReader.Close();

                    // Add created DockPanel to the StackPanel
                    DockPanel myDockPanel = createBacklogDockPanel(myButton);
                    BacklogsStackPanel.Children.Add(myDockPanel);

                    sqlConnection1.Close();
                }
                catch (Exception excep)
                {
                    Console.WriteLine(excep.ToString());
                }
            }
        }