protected override void OnStart(string[] args) { try { this.platform = new AcdPlatform(); string configXMLDoc = ""; //Get Executing Path String path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); using (TextReader reader = new StreamReader(path + @"\Config.xml")) { configXMLDoc = reader.ReadToEnd(); } this.platform.BeginStartUp(configXMLDoc, delegate(IAsyncResult ar) { try { this.platform.EndStartUp(ar); } catch (Exception ex) { AcdLogger logger = new AcdLogger(); logger.Log(ex); } }, null); } catch (Exception ex) { AcdLogger logger = new AcdLogger(); logger.Log(ex); } }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main() { AcdLogger logger = null; try { logger = new AcdLogger(); AcdPlatform platform = new AcdPlatform(); string configXMLDoc = ""; using (TextReader reader = new StreamReader("Config.xml")) { configXMLDoc = reader.ReadToEnd(); } Console.WriteLine("Starting the ContactCenter."); platform.BeginStartUp(configXMLDoc, delegate(IAsyncResult ar) { try { platform.EndStartUp(ar); Console.WriteLine("Main: AcdPlatform started"); } catch (Exception) { Console.WriteLine("Main: AcdPlatform failed to start."); } }, platform); Console.WriteLine("Main: Starting the AcdPlatform"); Console.WriteLine("Main: Press a Key to close the Application"); bool condition = true; while (condition) { String command = Console.ReadLine(); if (String.IsNullOrEmpty(command)) { platform.EndShutdown(platform.BeginShutdown(null, null)); condition = false; } else { if (command.Equals("gcCollect", StringComparison.CurrentCultureIgnoreCase)) { GC.AddMemoryPressure(int.MaxValue); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); Console.WriteLine("Force Collection"); } } } } catch (Exception ex) { logger.Log("Unhandled exception", ex); Console.ReadLine(); } }