static void Main() { EdgeServicesConfiguration.Load("Edge.Application.ProductionManagmentTools.exe.config"); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new DeliverySearch()); }
private List <AccountItem> getAccounts(string SystemDatabase) { EdgeServicesConfiguration.Load("Edge.Applications.PM.Suite.MeasureEditor.exe.config"); string p = EdgeServicesConfiguration.Current.CurrentConfiguration.FilePath; using (SqlConnection sqlCon = new SqlConnection(AppSettings.GetConnectionString(typeof(Measure), SystemDatabase))) { sqlCon.Open(); Dictionary <int, Account> accounts = Account.GetAccounts(sqlCon); _accountsList = new List <AccountItem>(); Account generalAccount = new Account() { ID = -1, Name = "Unkwon" }; _accountsList.Add(new AccountItem() { id = -1, name = "Select Account", account = generalAccount }); foreach (KeyValuePair <int, Account> a in accounts) { _accountsList.Add(new AccountItem() { id = a.Value.ID, name = string.Format("{1}({0})", a.Key, a.Value.Name), account = a.Value }); } } return(_accountsList); }
static void Main(string[] args) { // Get an alternate file name try { string configFileName = EdgeServicesConfiguration.DefaultFileName; if (args.Length > 0 && args[0].StartsWith("/") && args[0].Length > 1) { configFileName = args[0].Substring(1); } EdgeServicesConfiguration.Load(configFileName); //DeliveryServer = new DeliveryDBServer(); //DeliveryServer.Start(null); AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(currentDomain_UnhandledException); Application.ThreadExit += new EventHandler(Application_ThreadExit); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmSchedulingControl()); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace + ex.InnerException + ex.Data + ex.TargetSite); } }
static void Main() { EdgeServicesConfiguration.Load("Edge.Applications.PM.Suite.DataChecks.exe.config"); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new Edge.Applications.PM.Suite.DataChecks.DataChecksForm()); }
/*=========================*/ public ServiceStart(string configurationFileName) { if (configurationFileName != null) { EdgeServicesConfiguration.Load(configurationFileName); } }
/// <summary> /// Getting Profile from configuration file. /// </summary> /// <param name="key">AppSetting Configuration Key of the full configuration path ( including file name and extension )</param> /// <param name="serviceElement" >OUT param. The function will return the service element that was found. (NULL if account doesnt exists in this configuration)</param> /// <returns>True if found, otherwise:False</returns> internal bool TryGetProfilesFromConfiguration(string key, ComboBox profilesCombo, List <AccountServiceElement> serviceElement) { //saving current configuration string currentConfigurationFullPath = EdgeServicesConfiguration.Current.CurrentConfiguration.FilePath; try { //Getting configuration path from configuration. _currentConfigPath = ConfigurationManager.AppSettings.Get(key); AccountElement account; TryGetAccountFromExtrernalConfig(_currentConfigPath, accountId: -1, accountElement: out account); foreach (AccountServiceElement service in account.Services) { if (service.Options.ContainsKey("ProfileName")) { serviceElement.Add(service); profilesCombo.Items.Add(service.Options["ProfileName"]); } } } catch { //Loading original configuration EdgeServicesConfiguration.Load(currentConfigurationFullPath); //Directory.SetCurrentDirectory((Path.GetDirectoryName(currentConfigurationFullPath))); return(false); } //Loading original configuration EdgeServicesConfiguration.Load(currentConfigurationFullPath); //Directory.SetCurrentDirectory((Path.GetDirectoryName(currentConfigurationFullPath))); return(true); }
static void Main(string[] args) { LS = AppDomain.CurrentDomain.FriendlyName; // Get an alternate file name string configFileName = EdgeServicesConfiguration.DefaultFileName; if (args.Length > 0 && args[0].StartsWith("/") && args[0].Length > 1) { configFileName = args[0].Substring(1); } try { EdgeServicesConfiguration.Load(configFileName); } catch (Exception ex) { MessageBox.Show(String.Format("{0}\n({1})", ex.Message, ex.GetType().Name), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmSchedulingControl()); }
protected override void OnStartup(StartupEventArgs e) { // Get an alternate file name string configFileName = EdgeServicesConfiguration.DefaultFileName; if (e.Args.Length > 0 && e.Args[0].StartsWith("/") && e.Args[0].Length > 1) { configFileName = e.Args[0].Substring(1); } #if !DEBUG // change to !DEBUG try { EdgeServicesConfiguration.Load(configFileName); } catch (Exception ex) { MessageBox.Show ( messageBoxText: String.Format("Error loading the configuration file {0}\n\n({1}: {2})", Path.Combine(Directory.GetCurrentDirectory(), configFileName), ex.GetType().Name, ex.Message), caption: "Error", button: MessageBoxButton.OK, icon: MessageBoxImage.Error ); Shutdown(); return; } #else EdgeServicesConfiguration.Load(configFileName, readOnly: false); #endif }
public Scheduler(ServiceEnvironment environment) { //Load services configurationfile string configFileName = EdgeServicesConfiguration.DefaultFileName; //if (args.Length > 0 && args[0].StartsWith("/") && args[0].Length > 1) //{ // configFileName = args[0].Substring(1); //} EdgeServicesConfiguration.Load(configFileName); //wcf for the scheduler to get the profiles host = new WebServiceHost(this, new Uri("http://localhost:9000/")); WebHttpBinding binding = new WebHttpBinding(); binding.MaxReceivedMessageSize = 2147483647; binding.MaxBufferSize = 2147483647; binding.MaxBufferPoolSize = 2147483647; binding.ReaderQuotas.MaxBytesPerRead = 2147483647; binding.ReaderQuotas.MaxArrayLength = 2147483647; binding.Name = "BLA"; ServiceEndpoint ep = host.AddServiceEndpoint(typeof(ISchedulerDataService), binding, "http://localhost:9500/"); DataContractSerializerOperationBehavior be = ep.Contract.Operations[0].Behaviors.Find <DataContractSerializerOperationBehavior>(); be.MaxItemsInObjectGraph = 2147483647; //todo: take care of exeptions, should it be here? host.Open(); Environment = environment; environment.ListenForEvents(ServiceEnvironmentEventType.ServiceScheduleRequested); environment.ServiceScheduleRequested += new EventHandler <ServiceScheduleRequestedEventArgs>(environment_ServiceScheduleRequested); _percentile = int.Parse(AppSettings.Get(this, "Percentile")); _neededScheduleTimeLine = TimeSpan.Parse(AppSettings.Get(this, "NeededScheduleTimeLine")); _intervalBetweenNewSchedule = TimeSpan.Parse(AppSettings.Get(this, "IntervalBetweenNewSchedule")); _findServicesToRunInterval = TimeSpan.Parse(AppSettings.Get(this, "FindServicesToRunInterval")); _timeToDeleteServiceFromTimeLine = TimeSpan.Parse(AppSettings.Get(this, "DeleteEndedServiceInterval")); _executionTimeCashTimeOutAfter = TimeSpan.Parse(AppSettings.Get(this, "DeleteEndedServiceInterval")); LoadServicesFromConfigurationFile(); }
/// <summary> /// Getting Account Configuration Element from specific configuration /// </summary> /// <param name="fullPath">Configuration Path ( including file name and extension )</param> /// <param name="accountId" >Account ID in the configuration file</param> /// <param name="accountElement" >OUT param. The function will return the account element that was found. (NULL if account doesnt exists in this configuration)</param> /// <returns>True if found, otherwise:False</returns> internal bool TryGetAccountFromExtrernalConfig(string fullPath, int accountId, out AccountElement accountElement) { try { EdgeServicesConfiguration.Load(fullPath); AccountElementCollection accounts = EdgeServicesConfiguration.Current.Accounts; accountElement = accounts.GetAccount(accountId); return(true); } catch { accountElement = null; return(false); } }
protected override void OnStartup(StartupEventArgs e) { AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); // Get an alternate file name string configFileName = EdgeServicesConfiguration.DefaultFileName; if (e.Args.Length > 0 && e.Args[0].StartsWith("/") && e.Args[0].Length > 1) { configFileName = e.Args[0].Substring(1); } #if !DEBUG // change to !DEBUG try { EdgeServicesConfiguration.Load(configFileName); } catch (Exception ex) { MessageBox.Show ( messageBoxText: String.Format("Error loading the configuration file {0}\n\n({1}: {2})", Path.Combine(Directory.GetCurrentDirectory(), configFileName), ex.GetType().Name, ex.Message), caption: "Error", button: MessageBoxButton.OK, icon: MessageBoxImage.Error ); Shutdown(); return; } #else EdgeServicesConfiguration.Load(configFileName, readOnly: false); #endif BindingData.Services = new ObservableCollection <ServiceDisplayInfo>(); foreach (ServiceElement serviceConfig in EdgeServicesConfiguration.Current.Services) { if (serviceConfig.IsPublic) { BindingData.Services.Add(new ServiceDisplayInfo(serviceConfig)); } } }
private void application_cb_SelectedValueChanged(object sender, EventArgs e) { string key = string.Empty; if (((ComboBox)sender).SelectedItem.Equals(AdMetricsConst.EdgeApp)) { key = AdMetricsConst.EdgeProductionPathKey; } else { key = AdMetricsConst.SeperiaProductionPathKey; } this.searchParamsPanel.Enabled = true; string productionPath = ConfigurationManager.AppSettings.Get(key); EdgeServicesConfiguration.Load(productionPath); }
/// <summary> /// Loading Configuration using configuration path from current configuration. /// </summary> /// <param name="applicationKey"></param> internal void LoadProductionConfiguration(string applicationKey) { string productionPath = ConfigurationManager.AppSettings.Get(applicationKey); EdgeServicesConfiguration.Load(productionPath); }
protected override void OnStartup(StartupEventArgs e) { AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve); // Get an alternate file name string configFileName = EdgeServicesConfiguration.DefaultFileName; if (e.Args.Length > 0 && e.Args[0].StartsWith("/") && e.Args[0].Length > 1) { configFileName = e.Args[0].Substring(1); } #if !DEBUG // change to !DEBUG try { EdgeServicesConfiguration.Load(configFileName); } catch (Exception ex) { MessageBox.Show ( messageBoxText: String.Format("Error loading the configuration file {0}\n\n({1}: {2})", Path.Combine(Directory.GetCurrentDirectory(), configFileName), ex.GetType().Name, ex.Message), caption: "Error", button: MessageBoxButton.OK, icon: MessageBoxImage.Error ); Shutdown(); return; } #else EdgeServicesConfiguration.Load(configFileName, readOnly: false); #endif BindingData.Services = new ObservableCollection <ServiceDisplayInfo>(); foreach (ServiceElement serviceConfig in EdgeServicesConfiguration.Current.Services) { if (serviceConfig.IsPublic) { BindingData.Services.Add(new ServiceDisplayInfo(serviceConfig)); } } BindingData.Accounts = new ObservableCollection <AccountDisplayInfo>(); BindingData.Accounts.Add(BindingData.SelectedAccount); foreach (AccountElement accountConfig in EdgeServicesConfiguration.Current.Accounts) { BindingData.Accounts.Add(new AccountDisplayInfo() { AccountConfig = accountConfig }); } // Remember last selected account string lastUsedAccount = AppData.Load <string>("BindingData.SelectedAccount"); if (lastUsedAccount != null) { int accountID; AccountElement accountConfig; if (Int32.TryParse(lastUsedAccount, out accountID) && (accountConfig = EdgeServicesConfiguration.Current.Accounts.GetAccount(accountID)) != null) { BindingData.SelectedAccount = BindingData.Accounts.First(acc => acc.AccountConfig == accountConfig); } } BindingData.PropertyChanged += new PropertyChangedEventHandler((sender, args) => { if (args.PropertyName == "SelectedAccount") { AppData.Save("BindingData.SelectedAccount", BindingData.SelectedAccount.AccountConfig.ID.ToString()); } }); }