private void runAllConfigurationsItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (!AskQuestion("Run all configurations?")) { return; } try { navBarControl.Enabled = false; Program.PreRunTask(); var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory); listConfigurations.StatusChanged += OnStatusChanged; var configList = listConfigurations.Execute(); var runConfigsCommand = new RunAllConfigurations(); runConfigsCommand.StatusChanged += OnStatusChanged; runConfigsCommand.Execute(configList, false); Program.PreRunTask(); } catch (Exception ex) { Log.Error(string.Format("Failed to run configurations.{0}{1}", Environment.NewLine, ex.Message), ex); XtraMessageBox.Show(string.Format("Failed to run configurations.{0}{1}", Environment.NewLine, ex.Message), "Error"); } finally { navBarControl.Enabled = true; SplashManager.CloseSplashScreen(); } }
private void channelsMapItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { if (!AskQuestion(string.Format("Create {0} in output directory?", Settings.Default.ChannelsXmlFileName))) { return; } try { var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory); listConfigurations.StatusChanged += OnStatusChanged; var configList = listConfigurations.Execute(); var map = new ChannelMap(); map.Configurations = configList; var mapFileName = Path.Combine(Locations.OutputDirectory.FullName, Settings.Default.ChannelsXmlFileName); map.SaveToFile(mapFileName); } catch (Exception ex) { Log.Error(string.Format("Failed to create channels map.{0}{1}", Environment.NewLine, ex.Message), ex); XtraMessageBox.Show(string.Format("Failed to create channels map.{0}{1}", Environment.NewLine, ex.Message), "Error"); } finally { SplashManager.CloseSplashScreen(); } }
private void LoadConfigurations() { var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory); listConfigurations.StatusChanged += OnStatusChanged; var configList = listConfigurations.Execute(); SplashManager.CloseSplashScreen(); grid.DataSource = configList; }
/// <summary> /// Read Configurations name to bind with the comboBox /// </summary> private ObservableCollection <KeyValueData> ConfigurationListName() { var configFile = XDocument.Load(xmlFilePth); var confList = from configurations in configFile.Descendants("Configuration") select new { Name = configurations.Attribute("name")?.Value, KeyConf = configurations.Attribute("confId")?.Value }; foreach (var item in confList) { ListConfigurations.Add(new KeyValueData(item.KeyConf, item.Name)); } return(ListConfigurations); }
public RunBookViewModel() { //modifiy original file //xmlFilePth = @"..\..\XmlConfigurations\Configurations.xml"; //Modify file in debug xmlFilePth = @"XmlConfigurations\Configurations.xml"; ListConfigurations = ConfigurationListName(); cbList.Add("StopIIS"); //cbList.Add("StartIIS"); cbList.Add("Copy"); cbList.Add("Execute Sql"); cbList.Add("Execute Cmd"); //Default selected configuration SelectedConfiguration = ListConfigurations.FirstOrDefault(); var configurationFile = XDocument.Load(xmlFilePth); //SelectedConfiguration.Key = configurationFile.Descendants("Configuration").FirstOrDefault().Attribute("confId").Value; ReadConfiguration(SelectedConfiguration.Key); }
private static void RunAll(bool compress, bool channelsMap, bool gzip) { PreRunTask(); var listConfigurations = new ListConfigurations(Locations.UserConfigDirectory); var configList = listConfigurations.Execute(); var runConfigsCommand = new RunAllConfigurations(); runConfigsCommand.Execute(configList, true); if (compress) { foreach (var file in Locations.OutputDirectory.GetFiles("*.xml")) { if (!gzip) { using (ZipFile zip = new ZipFile()) { var zipFileName = Path.Combine(Locations.OutputDirectory.FullName, Path.GetFileNameWithoutExtension(file.Name) + ".zip"); zip.AddFile(file.FullName, ""); zip.Save(zipFileName); } } else { GZip(file.FullName, true); } } } if (channelsMap) { var map = new ChannelMap(); map.Configurations = configList; var mapFileName = Path.Combine(Locations.OutputDirectory.FullName, Settings.Default.ChannelsXmlFileName); map.SaveToFile(mapFileName); } PostRunTask(); }