public SettingsForm() { InitializeComponent(); pgSettings.SelectedObject = _appSettings; System.Configuration.UserScopedSettingAttribute userAttr = new System.Configuration.UserScopedSettingAttribute(); System.ComponentModel.AttributeCollection attrs = new System.ComponentModel.AttributeCollection(userAttr); pgSettings.BrowsableAttributes = attrs; }
void AddProperty(String propertyName, Color defaultValue, Type propertyType) { String providerName = "LocalFileSettingsProvider"; var attributes = new System.Configuration.SettingsAttributeDictionary(); var attr = new System.Configuration.UserScopedSettingAttribute(); attributes.Add(attr.TypeId, attr); SettingsProvider settingProvider = Properties.Settings.Default.Providers[providerName]; var prop = new System.Configuration.SettingsProperty( new System.Configuration.SettingsProperty(propertyName, propertyType, settingProvider, false, defaultValue, System.Configuration.SettingsSerializeAs.String, attributes, false, false)); MYAPPCS.Properties.Settings.Default.Properties.Add(prop); }
private void Form1_Load(object sender, EventArgs e) { // Add event handler for settings changes appSettings.SettingChanging += new SettingChangingEventHandler(appSettings_SettingChanging); propertyGrid1.SelectedObject = appSettings; System.Configuration.UserScopedSettingAttribute userAttr = new System.Configuration.UserScopedSettingAttribute(); System.ComponentModel.AttributeCollection attrs = new System.ComponentModel.AttributeCollection(userAttr); propertyGrid1.BrowsableAttributes = attrs; // Add event handler for summary grid this.dgvStatusSummary.CellContentClick += new DataGridViewCellEventHandler(dgvStatusSummary_CellContentClick); // Add data grid views to process objects _loadIBIProcess.AddGridView(eDWWfResultsTableDataGridView, _loadIBIProcess.GetEDWWorkflowData); _loadIBIProcess.AddGridView(dgvLatestEDWLoad, _loadIBIProcess.GetLatestEDWLoad); _loadIBIProcess.AddGridView(dgvLatestODSLoad, _loadIBIProcess.GetLatestODSLoad); _loadIBIProcess.AddGridView(dgvEDWMetrics, _loadIBIProcess.GetEDWMetrics); _loadIBIProcess.AddGridView(dgvODSMetrics, _loadIBIProcess.GetODSMetrics); _loadIBIProcess.AddGridView(dgvC8ReportsRan, _loadIBIProcess.GetNumberC8ReportsRan); _projectionsProcess.AddGridView(dgvProjections, _projectionsProcess.GetProjectionsRuns); _projectionsProcess.AddGridView(dgvProjectionsLoads, _projectionsProcess.GetLatestDataLoads); _cinciDataTransferProcess.AddGridView(dgvCinciDataLoads, _cinciDataTransferProcess.GetLatestCinciDataLoad); _cinciSavingsTransferProcess.AddGridView(dgvCinciSavingsLoads, _cinciSavingsTransferProcess.GetLatestCinciSavingsLoad); _ELECReportFilesProcess.AddGridView(dgvELECFiles, _ELECReportFilesProcess.UpdateELECFilesListView); _PPEDataLoadProcess.AddGridView(dgvPPEDataLoad, _PPEDataLoadProcess.GetLatestDataLoads); _Infa80ProdStats.AddGridView(dgvWFLastWeek, _Infa80ProdStats.GetWFPast7Days); _Infa80ProdStats.AddGridView(dgvProdWFScheduled, _Infa80ProdStats.GetWFScheduled); _Infa80ProdStats.AddGridView(dgvProdWFRunning, _Infa80ProdStats.GetWFRunning); _Infa80DevStats.AddGridView(dgvDevWFPast7Days, _Infa80DevStats.GetWFPast7Days); _Infa80DevStats.AddGridView(dgvDevWFScheduled, _Infa80DevStats.GetWFScheduled); _Infa80DevStats.AddGridView(dgvDevWFRunning, _Infa80DevStats.GetWFRunning); _Infa86ProdStats.AddGridView(dgvProd86WFLastWeek, _Infa86ProdStats.GetWFPast7Days); _Infa86ProdStats.AddGridView(dgvProd86WFScheduled, _Infa86ProdStats.GetWFScheduled); _Infa86ProdStats.AddGridView(dgvProd86WFRunning, _Infa86ProdStats.GetWFRunning); _Infa86DevStats.AddGridView(dgvDev86WFLastWeek, _Infa86DevStats.GetWFPast7Days); _Infa86DevStats.AddGridView(dgvDev86WFScheduled, _Infa86DevStats.GetWFScheduled); _Infa86DevStats.AddGridView(dgvDev86WFRunning, _Infa86DevStats.GetWFRunning); _PDSProd.AddGridView(dgvPDSProdLatestestWfs, _PDSProd.GetLatestPDSRun); _PDSDev.AddGridView(dgvPDSDevLatestWfs, _PDSDev.GetLatestPDSRun); _FIQBIProcess.AddGridView(dgvFIQBISummary, _FIQBIProcess.GetFIQBISummary); // Add web pages _FIQBIProcess.AddWebPages("ADVBI2", wbADVBI2); _FIQBIProcess.AddWebPages("ADVBI3", wbADVBI3); _FIQBIProcess.AddWebPages("ADVCOG1", wbADVCOG1); _FIQBIProcess.AddWebPages("ADVIBI2", wbADVIBI2); _cognos8App.AddWebPages("Cognos 8", webBrowserCognos8); _FIQBIProcess.StatusUpdateEvent += new BaseProcess.StatusUpdatedEventHandler(_FIQBIProcess_StatusUpdateEvent); _cognos8App.StatusUpdateEvent += new BaseProcess.StatusUpdatedEventHandler(_cognos8App_StatusUpdateEvent); _ELECReportFilesProcess.ELECFilesLogFile = tbELECFilesLogFile; // Add processes to process array _BIProcesses.Add(_loadIBIProcess); _BIProcesses.Add(_ELECReportFilesProcess); _BIProcesses.Add(_FIQBIProcess); _BIProcesses.Add(_PPEDataLoadProcess); _BIProcesses.Add(_projectionsProcess); _BIProcesses.Add(_cinciDataTransferProcess); _BIProcesses.Add(_cinciSavingsTransferProcess); _BIProcesses.Add(_cognos8App); _BIProcesses.Add(_Infa86ProdStats); //_BIProcesses.Add(_Infa86DevStats); //_BIProcesses.Add(_Infa80DevStats); _BIProcesses.Add(_PDSProd); _BIProcesses.Add(_PDSDev); _PDSDev.ShowSummaryStatus = false; // don't show the process in the summary grid // Add scheduled workflows to Infa objects //_Infa86ProdStats.AddRequiredScheduledWorkflow("Cincinnati Data Transfer", "wf_DataTransfer_Daily"); //_Infa86ProdStats.AddRequiredScheduledWorkflow("Cincinnati Data Transfer", "wf_ImageTransfer_Daily"); _Infa86ProdStats.AddRequiredScheduledWorkflow("Data Warehouse", "wf_EDW_DataLoad"); _Infa86ProdStats.AddRequiredScheduledWorkflow("Operational Data Store", "wf_ODS_DataLoad_IDL"); _Infa86ProdStats.AddRequiredScheduledWorkflow("Production Data Subsetting", "wf_RunDataloads"); _Infa86ProdStats.AddRequiredScheduledWorkflow("Savings Transfer To Cincinnati", "wf_SavingsTransfer_Daily"); _Infa86ProdStats.AddRequiredScheduledWorkflow("Telecom - Interm", "wf_SiteAccount"); //_Infa86DevStats.AddRequiredScheduledWorkflow("Production Data Subsetting", "wf_RunDataloads"); //BuildSummaryStatusDataset(); timerRefresh.Interval = 60000 * appSettings.RefreshRateMin; timerRefresh.Start(); // Propagate app settings to all processes UpdateAppSettings(null); RefreshFormData(); }
} // OnValueLoading // ---------------------------------------------------------------------- protected void CreateSettingProperty(string name, Type type, SettingsSerializeAs serializeAs, object defaultValue) { ApplicationSettings applicationSettings = ApplicationSettings; if (applicationSettings == null || applicationSettings.DefaultProvider == null) { return; } SettingsProperty settingsProperty = applicationSettings.Properties[name]; if (settingsProperty != null) { return; // already present } SettingsAttributeDictionary attributes = new SettingsAttributeDictionary(); SettingAttribute attribute; switch (Scope) { case SettingScope.Application: // attribute = new ApplicationScopedSettingAttribute(); throw new NotImplementedException(); // currently not supported case SettingScope.User: attribute = new UserScopedSettingAttribute(); break; default: return; } attributes.Add(attribute.TypeId, attribute); settingsProperty = new SettingsProperty( name, // name type, // type applicationSettings.DefaultProvider, // settings provider false, // is readonly defaultValue, // default serializeAs, // serialize as attributes, // attribute ThrowOnErrorDeserializing, // throw on deserialization ThrowOnErrorSerializing); // throw on serialization applicationSettings.Properties.Add(settingsProperty); } // CreateSettingProperty
public void GetUserScopedPropertyValues () { SettingsAttributeDictionary dict = new SettingsAttributeDictionary (); UserScopedSettingAttribute attr = new UserScopedSettingAttribute (); dict.Add (attr.GetType(), attr); LocalFileSettingsProvider prov = new LocalFileSettingsProvider (); SettingsContext ctx = new SettingsContext (); SettingsProperty p = new SettingsProperty ("property", typeof (int), prov, false, 10, SettingsSerializeAs.Binary, dict, false, false); SettingsPropertyCollection col = new SettingsPropertyCollection (); SettingsPropertyValueCollection vals; col.Add (p); prov.Initialize (null, null); vals = prov.GetPropertyValues (ctx, col); Assert.IsNotNull (vals, "A1"); Assert.AreEqual (1, vals.Count, "A2"); }