예제 #1
0
 private void StartUp()
 {
     _loggerRef.Target.Clear();
     ClearTree();
     try
     {
         CoreClientFactory factory = new CoreClientFactory(_loggerRef)
                                     .SetEnv(cbEnvId.Text)
                                     .SetApplication(Assembly.GetExecutingAssembly())
                                     .SetProtocols(WcfConst.AllProtocolsStr);
         if (rbDefaultServers.Checked)
         {
             _client = factory.Create();
         }
         else if (rbLocalhost.Checked)
         {
             _client = factory.SetServers("localhost").Create();
         }
         else
         {
             _client = factory.SetServers(txtSpecificServers.Text).Create();
         }
         _syncContext.Post(OnClientStateChange, new CoreStateChange(CoreStateEnum.Initial, _client.CoreState));
         _client.OnStateChange += _Client_OnStateChange;
     }
     catch (Exception excp)
     {
         _loggerRef.Target.Log(excp);
     }
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TradeQuery"/> class.
        /// </summary>
        public TradeQuery(ILogger logger)
        {
            var logRef = Reference <ILogger> .Create(logger);

            try
            {
                CoreClientFactory factory = new CoreClientFactory(logRef)
                                            .SetEnv(BuildEnv.ToString())
                                            .SetApplication(Assembly.GetExecutingAssembly())
                                            .SetProtocols(WcfConst.AllProtocolsStr);
                //if (rbDefaultServers.Checked)
                //    _Client = factory.Create();
                //else if (rbLocalhost.Checked)
                var client = factory.SetServers("localhost").Create();
                _cache = client.CreateCache();
                //else
                //    _Client = factory.SetServers(txtSpecificServers.Text).Create();
                //_SyncContext.Post(OnClientStateChange, new CoreStateChange(CoreStateEnum.Initial, _Client.CoreState));
                //_Client.OnStateChange += new CoreStateHandler(_Client_OnStateChange);
            }
            catch (Exception excp)
            {
                logRef.Target.Log(excp);
            }
        }
예제 #3
0
        /// <summary>
        /// Application start
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ApplicationStart(object sender, EventArgs e)
        {
            const string fullAppName = "FpML.V5r3.PublisherWebService";

            LoggerRef.Target.LogInfo("Starting up...");
            try
            {
                //var stopwatch = new Stopwatch();
                //stopwatch.Start();
                CoreClientFactory factory = new CoreClientFactory(LoggerRef)
                                            .SetEnv("DEV")
                                            .SetApplication(Assembly.GetExecutingAssembly())
                                            .SetProtocols(WcfConst.AllProtocolsStr);
                _client = factory.SetServers("localhost").Create();
                _cache  = _client.CreateCache();
                //LoadConfigDataHelper.LoadConfigurationData(LogRef.Target, _Cache);//TODO get rid of this
                //stopwatch.Stop();
                //Debug.Print("Initialized test environment, in {0} seconds", stopwatch.Elapsed.TotalSeconds);
                LoggerRef.Target.LogInfo("Loaded..." + fullAppName);
            }
            catch (Exception excp)
            {
                LoggerRef.Target.Log(excp);
            }
        }
예제 #4
0
        public RuntimeEnvironment(string nameSpace)
        {
            NameSpace = nameSpace;
            string fullAppName = $"ExcelAPI-{ApplicationHelper.Diagnostics("FileVersion")}";

            try
            {
                //var stopwatch = new Stopwatch();
                LogRef = Reference <ILogger> .Create(new TraceLogger(true));

                //stopwatch.Start();
                CoreClientFactory factory = new CoreClientFactory(LogRef)
                                            .SetEnv("DEV")
                                            .SetApplication(Assembly.GetExecutingAssembly())
                                            .SetProtocols(WcfConst.AllProtocolsStr);
                _client = factory.SetServers("localhost").Create();
                Cache   = _client.CreateCache();
                Log(LogRef.Target, "Starting...", fullAppName, "StartUp");
            }
            catch (System.Exception excp)
            {
                LogRef.Target.Log(excp);
            }
        }