Example #1
0
        private static void Initialize()
        {
            mServiceLocator = new ErrorReportServiceLocator(); //RemoteServiceLocatorManager.GetServiceLocator<IErrorReport, ErrorReportServiceLocator>();
            mServiceLocator.EventPreferedServiceProviderChanged += new EventHandler <PreferedServiceProviderChangedEventArgs>(ServiceLocatorPreferedServiceProviderChangedHandler);
            mServiceLocator.EventSyncInvocation     = false;
            mServiceLocator.EventParallelInvocation = false;
            mServiceLocator.Start();

            mSenderThread              = new Thread(new ThreadStart(SenderThreadMain));
            mSenderThread.Name         = "ErrorReportAppender_SenderThread";
            mSenderThread.IsBackground = true;
            mSenderThread.Start();

            mInitialized = true;
        }
Example #2
0
        public static IRemoteServiceLocator <TIProxyType> GetServiceLocator <TIProxyType, TLocatorType>()
            where TIProxyType : IRemoteContract
            where TLocatorType : IRemoteServiceLocator <TIProxyType>, new()
        {
            IRemoteServiceLocator <TIProxyType> result = null;

            if (mServiceLocators.ContainsKey(typeof(TLocatorType)))
            {
                result = (IRemoteServiceLocator <TIProxyType>)mServiceLocators[typeof(TLocatorType)];
            }
            else
            {
                result = (IRemoteServiceLocator <TIProxyType>) typeof(TLocatorType).GetConstructor(Type.EmptyTypes).Invoke(null);
                mServiceLocators[typeof(TLocatorType)] = result;
            }

            return(result);
        }
Example #3
0
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        public virtual void Initialize()
        {
            if (!IsInitialized)
            {
                try
                {
                    Net.TerraGraf.NetworkManager.Instance.Start();
                    ProxyServices.Initialize();

                    mLocator = RemoteServiceLocatorManager.GetServiceLocator <IRemoteDesktop, RemoteDesktopServiceLocator>();
                    mLocator.EventAvailableServiceProvidersChanged += new EventHandler <ServiceProvidersChangedEventArgs>(AvailableServiceProvidersChangedEventHandler);
                    mLocator.Start();
                    AvailableServiceProvidersChangedEventHandler(mLocator, new ServiceProvidersChangedEventArgs(mLocator.AvailableServiceProviders));
                    IsInitialized = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, string.Format(Resources.Error_FailedToStartNetwork, ex.Message), Resources.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }