private void BuildNewLoadfileView(LoadfileBase selectedloadfile) { try { Frame NewLoadfileFrame = new Frame(); Views.LoadfilePage NewLoadfilePage = new Views.LoadfilePage(selectedloadfile); // NewLoadfilePage.StatusUpdate += OnStatusUpdate; NewLoadfilePage.StatusUpdate += OnRefreshMainWindow; NewLoadfilePage.LoadLoadfile(); NewLoadfileFrame.Content = NewLoadfilePage; // we have to add a textblock to the tabitem header because the table names contain underscores // default tabitem header will treat FIRST underscore as indication of following character being a shortcut like ampersand used to function in winforms TextBlock NewTabTitle = new TextBlock(); NewTabTitle.Text = selectedloadfile.FileInformation.Name; Button NewTabCloseButton = new Button(); NewTabCloseButton.Content = (char)215; NewTabCloseButton.FontSize = 10; NewTabCloseButton.Height = 15; NewTabCloseButton.Width = 15; NewTabCloseButton.Click += tabHeaderCloseButton_OnClick; NewTabCloseButton.Margin = new Thickness(5, 0, 0, 0); NewTabCloseButton.Padding = new Thickness(0); NewTabCloseButton.BorderThickness = new Thickness(0); NewTabCloseButton.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; NewTabCloseButton.ToolTip = "Close"; StackPanel NewTabHeader = new StackPanel(); NewTabHeader.Orientation = Orientation.Horizontal; NewTabHeader.Children.Add(NewTabTitle); NewTabHeader.Children.Add(NewTabCloseButton); TabItem NewTab = new TabItem(); NewTab.Header = NewTabHeader; NewTab.Content = NewLoadfileFrame; this.tabcontrolMain.Items.Add(NewTab); this.tabcontrolMain.SelectedItem = NewTab; } catch (Exception Ex) { this.tblStatus.Text = "Failed to open new loadfile."; Log.ErrorLog.AddMessage("Failed to open new loadfile."); } if (this.tabcontrolMain.Items.Count > 0) { this.btnSqlConsole.IsEnabled = true; } else { this.btnSqlConsole.IsEnabled = false; } }
public void BuildNewSelectView(string selectcommandstring, out int rowcount) { TabItem NewTab = new TabItem(); TextBlock NewTabTitle = new TextBlock(); // NewTabTitle.Text = Db.Connect.GetTableName(selectedloadfile.FileInformation.FullName); // let's use the name of the file instead NewTabTitle.Text = "Ad Hoc Select"; Button NewTabCloseButton = new Button(); NewTabCloseButton.Content = (char)215; NewTabCloseButton.FontSize = 10; NewTabCloseButton.Height = 15; NewTabCloseButton.Width = 15; NewTabCloseButton.Click += tabHeaderCloseButton_OnClick; NewTabCloseButton.Margin = new Thickness(5, 0, 0, 0); NewTabCloseButton.Padding = new Thickness(0); NewTabCloseButton.BorderThickness = new Thickness(0); NewTabCloseButton.VerticalContentAlignment = System.Windows.VerticalAlignment.Center; NewTabCloseButton.ToolTip = "Close"; StackPanel NewTabHeader = new StackPanel(); NewTabHeader.Orientation = Orientation.Horizontal; NewTabHeader.Children.Add(NewTabTitle); NewTabHeader.Children.Add(NewTabCloseButton); NewTab.Header = NewTabHeader; Views.LoadfilePage LoadFilePageSelect = new Views.LoadfilePage(); LoadFilePageSelect.LoadAdHocSelect(selectcommandstring, out rowcount); NewTab.Content = LoadFilePageSelect.Content; TabControlMain.Items.Add(NewTab); TabControlMain.SelectedItem = NewTab; }