//set up lists public controlSpecChooser() { InitializeComponent(); dbcontext = new Context.DataContext(DataConnecter.EstablishValidConnection()); selected = new List <string>(); populateList(this.fullList); }
/// <summary> /// sets controls on canvas /// </summary> public CapabilityChooser() { //maximized InitializeComponent(); ResizeMode = System.Windows.ResizeMode.NoResize; capsSelected = new List <Context.Capabilities>(); if (dbContext == null) { dbContext = new Context.DataContext(DataConnecter.EstablishValidConnection()); } this.WindowState = System.Windows.WindowState.Maximized; //add buttons Button can = new Button(); can.Content = "Cancel"; can.IsCancel = true; can.Margin = new Thickness(85, 15, 0, 0); root.Children.Add(can); Button ok = new Button(); ok.Content = "Done"; ok.Name = "Done"; ok.IsDefault = true; ok.Margin = new Thickness(15, 15, 0, 0); ok.Click += Done; root.Children.Add(ok); root.RegisterName("Done", ok); Button all = new Button(); all.Content = "Selet all"; all.Name = "all"; all.Margin = new Thickness(168, 15, 0, 0); all.Click += new RoutedEventHandler(SelectAll); root.Children.Add(all); root.RegisterName("all", all); Label directions = new Label(); directions.Content = "Click once to add to report, again to remove. Read description by hovering on capability." + "Click done to create report."; directions.Margin = new Thickness(220, 15, 0, 0); root.Children.Add(directions); SetUpPallate(); try { //place capabilities Addcaps(); } catch (Exception e) { Console.WriteLine(e); Close(); } }
public ControlChooser() { InitializeComponent(); if (dbContext == null) { dbContext = new Context.DataContext(DataConnecter.EstablishValidConnection()); } populateList(); }
/// <summary> /// change database location /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditDB(object sender, RoutedEventArgs e) { bool accept = false; string prompt = "Enter SQL server Name: ", conectstr = ""; string CompName = System.Environment.MachineName; while (!accept) { //continue till connection is made string server = Interaction.InputBox(prompt); if (server == string.Empty) { return; } conectstr = @"Data Source=" + CompName + "\\" + server + @";Initial Catalog=ModelDB;Integrated Security=True;Persist Security Info=True"; string serversection = @"Data Source=" + CompName + @"\" + server + ";Integrated Security=True;Persist Security Info=True"; Context.DataContext connection = new Context.DataContext(serversection); try { connection.Connection.Open(); accept = true; } catch (Exception ex) { prompt = "Connection failed. Enter SQL server name: "; } } Properties.Settings.Default.Connection = conectstr; Properties.Settings.Default.Save(); //set up tables and values Waiting load = new Waiting(); load.Topmost = true; load.Show(); load.Topmost = false; DataConnecter.FirstUse(); load.Close(); MessageBox.Show("Connection updated."); ChangeReportStatus(true); }
private void btnOpenSecurityBaselinesFile_Click(object sender, RoutedEventArgs e) { bool result = OpenFile(ref BaselineFile, apppath + @"\Security Baselines", "Select a Security Baseline file to parse", this.BaselineFileName); if (result) { toggleUpload(false); ChangeReportStatus(false); DataConnecter.wipeBaselines(); this.progressBar1.Value = 0; this.percentageLabel.Text = 0 + "%"; BackgroundWorker bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += new DoWorkEventHandler(parseBaseliness); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(baselinesComplete); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerAsync(); } }
/// <summary> /// get new controls file /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOpenControlslFile_Click(object sender, RoutedEventArgs e) { bool result; result = OpenFile(ref ControlFile, apppath + @"\800-53-Controls", "Select Controls File to Parse", this.ControlFileName); if (result) { uploadControls = true; toggleUpload(false); ChangeReportStatus(false); DataConnecter.ClearData(); this.progressBar1.Value = 0; this.percentageLabel.Text = 0 + "%"; BackgroundWorker bw = new BackgroundWorker(); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += new DoWorkEventHandler(parseControls); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(controlsComplete); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerAsync(); } }
//set button and run first time set up public MainWindow() { InitializeComponent(); this.ResizeMode = System.Windows.ResizeMode.CanMinimize; TextBlock cap = new TextBlock() { Text = "This report allows you to choose what capabilities to create a shortened report of these capabilities.", Width = 200, TextWrapping = TextWrapping.Wrap }; this.capReport.ToolTip = new ToolTip() { Content = cap }; TextBlock cont = new TextBlock() { Text = "This report allows you to choose what control to list in the report. For each, there will be a list of all capabilities it is selected for." , Width = 200, TextWrapping = TextWrapping.Wrap }; this.conReport.ToolTip = new ToolTip() { Content = cont }; TextBlock tic = new TextBlock() { Text = "This report show every TIC with a list of all capabilities with that marking.", Width = 200, TextWrapping = TextWrapping.Wrap }; this.TICReport.ToolTip = new ToolTip() { Content = tic }; //setup if (Properties.Settings.Default.FirstRun) { MessageBox.Show( "Welcome to the Cloud Security Manager. \n\tBefore you can use the program, there is some simple set up to do. \n\n\t First, you must choose where " + "to put the folders that will hold input and output files. The program will create a containing folder, so just pick a easily accessible place.\n\n " + "Then, you may need to set up database connection."); Waiting load = new Waiting(); SetPath(); load.Topmost = true; load.Show(); load.Topmost = false; try { Properties.Settings.Default.FirstRun = false; Properties.Settings.Default.Save(); DataConnecter.FirstUse(); load.Close(); } catch (Exception e) { load.error.Content = e.Message; Console.WriteLine(e.Message); } } else { apppath = Properties.Settings.Default.appFolders; } dbContent = new Context.DataContext(DataConnecter.EstablishValidConnection()); CSRC.Models.Constants.ReadValues(); var con = from p in dbContent.Controls select p; if (!con.Any()) { this.updateCaps.IsEnabled = false; this.updateBaselines.IsEnabled = false; this.menuUpdateCapabilities.IsEnabled = false; this.menuUpdateBaseines.IsEnabled = false; } var ret = from p in dbContent.Capabilities select new { p.Id }; if (!(ret.Any())) { ChangeReportStatus(false); } var retdata = from p in dbContent.BaselineSecurityMappings select new { p.Id }; if (!retdata.Any()) { ChangeReportStatus(false); } CSRC.Models.Constants.ReadValues(); if (CSRC.Models.Constants.capFile3Cols) { this.cap3col.IsChecked = true; this.cap9col.IsChecked = false; } }