示例#1
0
        public void ReloadPluginMasterAsync()
        {
            Task.Run(() => {
                State = InitializationState.InProgress;

                try
                {
                    using var client = new WebClient();

                    var data = client.DownloadString(PluginRepoBaseUrl + "pluginmaster.json");

                    this.PluginMaster = JsonConvert.DeserializeObject <ReadOnlyCollection <PluginDefinition> >(data);

                    State = InitializationState.Success;
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Could not download PluginMaster");
                    State = InitializationState.Fail;
                }
            }).ContinueWith(t => {
                if (t.IsFaulted)
                {
                    State = InitializationState.Fail;
                }
            });
        }
示例#2
0
        private static void PerformInitialization()
        {
            try
            {
                if (_factoryResolver == null)
                {
                    _factoryResolver = new AppConfigFactoryResolver();
                }

                var factory = _factoryResolver.GetFactory();

                if (factory == null)
                {
                    _initializationState = InitializationState.NOP_Fallback;
                    EmitFactoryResolverError(_factoryResolver);
                    return;
                }

                _initializationState = InitializationState.Initialized;
                EmitSubstituteLoggerWarning();
            }
            catch (Exception ex)
            {
                _initializationState = InitializationState.NOP_Fallback;

                try
                {
                    EventLogHelper.WriteEntry("Error initializing LoggerFactory.  Defaulting to no-operation (NOP) logger implementation.", ex);
                }
                catch { }
            }
        }
示例#3
0
        private void Initialize(bool getHostedPort)
        {
            if (_remoteEndPoint != null)
            {
                _address        = _remoteEndPoint.Address.ToString();
                _port           = _remoteEndPoint.Port;
                _state          = InitializationState.All;
                _remoteEndPoint = null;
            }
            else
            {
                if ((_state & InitializationState.Address) != InitializationState.Address)
                {
                    _address = _remoteEndpointProvider.GetAddress();
                    _state  |= InitializationState.Address;
                }

                if (getHostedPort)
                {
                    _port   = _remoteEndpointProvider.GetPort();
                    _state |= InitializationState.Port;
                    _remoteEndpointProvider = null;
                }
            }
        }
        public IEnumerator Load()
        {
            m_referenceCounter++;
            switch (m_initializationState)
            {
            case InitializationState.Loaded:
            case InitializationState.Failed:
                break;

            case InitializationState.Loading:
                do
                {
                    yield return(null);
                }while (m_initializationState == InitializationState.Loading);
                break;

            default:
                throw new ArgumentOutOfRangeException();

            case InitializationState.None:
                m_initializationState = InitializationState.Loading;
                yield return(LoadInternal());

                break;
            }
        }
示例#5
0
        public void ReloadPluginMasterAsync()
        {
            Task.Run(() => {
                State = InitializationState.InProgress;

                try
                {
                    using var client = new WebClient();

                    var data = client.DownloadString(PluginMasterUrl);

                    var unsortedPluginMaster = JsonConvert.DeserializeObject <List <PluginDefinition> >(data);
                    unsortedPluginMaster.Sort((a, b) => a.Name.CompareTo(b.Name));
                    this.PluginMaster = unsortedPluginMaster.AsReadOnly();

                    State = InitializationState.Success;
                }
                catch (Exception ex)
                {
                    Log.Error(ex, "Could not download PluginMaster");
                    State = InitializationState.Fail;
                }
            }).ContinueWith(t => {
                if (t.IsFaulted)
                {
                    State = InitializationState.Fail;
                }
            });
        }
示例#6
0
        void Initialize(bool getHostedPort)
        {
            if (remoteEndPoint != null)
            {
                address        = remoteEndPoint.Address.ToString();
                port           = remoteEndPoint.Port;
                state          = InitializationState.All;
                remoteEndPoint = null;
            }
            else
            {
                if ((state & InitializationState.Address) != InitializationState.Address)
                {
                    address = remoteEndpointProvider.GetAddress();
                    state  |= InitializationState.Address;
                }

                if (getHostedPort)
                {
                    port   = remoteEndpointProvider.GetPort();
                    state |= InitializationState.Port;
                    remoteEndpointProvider = null;
                }
            }
        }
示例#7
0
        protected IEnumerator Load(params AudioReferenceWithParameters[] audioReferences)
        {
            int num       = audioReferences.Length;
            int bankCount = 0;

            if (num == 0)
            {
                m_initializationState = InitializationState.Loaded;
                yield break;
            }
            string[] array = new string[num];
            for (int i = 0; i < num; i++)
            {
                AudioReferenceWithParameters val = audioReferences[i];
                if (!val.get_isValid() || !AudioManager.TryGetDefaultBankName(AudioReferenceWithParameters.op_Implicit(val), out string bankName))
                {
                    continue;
                }
                int num2 = 0;
                while (true)
                {
                    if (num2 < bankCount)
                    {
                        if (bankName.Equals(array[num2]))
                        {
                            break;
                        }
                        num2++;
                        continue;
                    }
                    array[bankCount] = bankName;
                    int num3 = bankCount + 1;
                    bankCount = num3;
                    break;
                }
            }
            if (bankCount == 0)
            {
                m_initializationState = InitializationState.Error;
                yield break;
            }
            AudioBankLoadRequest[] bankLoadRequests = new AudioBankLoadRequest[bankCount];
            for (int j = 0; j < bankCount; j++)
            {
                bankLoadRequests[j] = AudioManager.LoadBankAsync(array[j]);
            }
            m_bankLoadRequests    = bankLoadRequests;
            m_initializationState = InitializationState.Loading;
            yield return(EnumeratorUtility.ParallelRecursiveImmediateSafeExecution((IEnumerator[])bankLoadRequests));

            for (int k = 0; k < bankCount; k++)
            {
                if (AssetManagerError.op_Implicit(bankLoadRequests[k].error) == 0)
                {
                    m_initializationState = InitializationState.Loaded;
                    yield break;
                }
            }
            m_initializationState = InitializationState.Error;
        }
示例#8
0
        /// <summary>
        /// Returns the <see cref="ILoggerFactory"/> instance in use.
        /// </summary>
        public static ILoggerFactory GetILoggerFactory()
        {
            if (_initializationState == InitializationState.Uninitialized)
            {
                lock (_locker)
                {
                    if (_initializationState == InitializationState.Uninitialized)
                    {
                        _initializationState = InitializationState.Ongoing;
                        PerformInitialization();
                    }
                }
            }

            switch (_initializationState)
            {
            case InitializationState.Initialized:
                return(_factoryResolver.GetFactory());

            case InitializationState.NOP_Fallback:
                return(_fallbackFactory);

            case InitializationState.Ongoing:
                return(_tempFactory);

            case InitializationState.Failed:
                // Not currently used, safer to use fallback instance
                throw new InvalidOperationException("The slf4net LoggerFactory failed to initialize.  Check the event log for details.");

            default:
                // Should never reach this code...
                throw new InvalidOperationException("_initializationState " + _initializationState + " is not recognized.");
            }
        }
示例#9
0
 private void OnManagerStateChanged(Manager manager, InitializationState state)
 {
     if (_instantiatedManagers.All(x => x.InitState == InitializationState.Ready) && _instantiatedManagers.Count == _currentManagersExpectedCount)
     {
         InitState = InitializationState.Ready;
     }
 }
示例#10
0
        /// <summary>
        /// Reload the plugin master asynchronously in a task.
        /// </summary>
        public void ReloadPluginMasterAsync()
        {
            this.State = InitializationState.InProgress;

            Task.Run(() =>
            {
                this.PluginMaster = null;

                var allPlugins = new List <PluginDefinition>();

                var repos = this.dalamud.Configuration.ThirdRepoList.Where(x => x.IsEnabled).Select(x => x.Url)
                            .Prepend(PluginMasterUrl).ToArray();

                using var client = new WebClient();

                var repoNumber = 0;
                var anyError   = false;
                foreach (var repo in repos)
                {
                    Log.Information("[PLUGINR] Fetching repo: {0}", repo);

                    try
                    {
                        var data = client.DownloadString(repo);

                        var unsortedPluginMaster = JsonConvert.DeserializeObject <List <PluginDefinition> >(data);

                        foreach (var pluginDefinition in unsortedPluginMaster)
                        {
                            pluginDefinition.RepoNumber = repoNumber;
                        }

                        allPlugins.AddRange(unsortedPluginMaster);
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex, "Could not download PluginMaster");

                        this.State = repos.Length > 1 ? InitializationState.FailThirdRepo : InitializationState.Fail;

                        anyError = true;
                    }

                    repoNumber++;
                }

                this.PluginMaster = allPlugins.AsReadOnly();
                if (!anyError)
                {
                    this.State = InitializationState.Success;
                }
            }).ContinueWith(t =>
            {
                if (t.IsFaulted)
                {
                    this.State = InitializationState.Fail;
                }
            });
        }
示例#11
0
 /// <summary>
 /// Sets the factory resolver used to get the <see cref="ILoggerFactory"/>
 /// </summary>
 /// <param name="resolver">The resolver to use.  If null is passed, the <see cref="NOPLoggerFactoryResolver"/> will be used.</param>
 public static void SetFactoryResolver(IFactoryResolver resolver)
 {
     lock (_locker)
     {
         _initializationState = InitializationState.Uninitialized;
         _factoryResolver     = resolver ?? NOPLoggerFactoryResolver.Instance;
     }
 }
示例#12
0
        public void Shutdown()
        {
            _template.Dispose();

            _keyTraits  = null;
            _keyIndices = null;

            InitializationStatus = InitializationState.Inactive;
        }
示例#13
0
        private void Initialize()
        {
            Verify.AreEqual(_initializationState, InitializationState.IsInitializing);

            // This is causing freezing
            if (!DesignMode)
            {
                OSVersionHelper.ThrowIfBeforeWindows10April2018();

                if (!WebViewControlInitialized)
                {
                    if (Process == null)
                    {
                        // Was not injected via ctor, create using defaults
                        var options = new Win32.UI.Controls.Interop.WinRT.WebViewControlProcessOptions()
                        {
                            PrivateNetworkClientServerCapability =
                                (Win32.UI.Controls.Interop.WinRT.WebViewControlProcessCapabilityState)(_delayedPrivateNetworkEnabled
                                    ? WebViewControlProcessCapabilityState.Enabled
                                    : WebViewControlProcessCapabilityState.Disabled),
                            EnterpriseId = _delayedEnterpriseId
                        };

                        Process = new WebViewControlProcess(options);
                    }
                    else
                    {
                        Verify.IsNotNull(Process);

                        _delayedPrivateNetworkEnabled = Process.IsPrivateNetworkClientServerCapabilityEnabled;
                        _delayedEnterpriseId          = Process.EnterpriseId;
                    }

                    Verify.IsNotNull(Process);

                    _webViewControl = Process.CreateWebViewControlHost(Handle, ClientRectangle);
                    SubscribeEvents();

                    // Set values. They could have been changed in the designer
                    IsScriptNotifyAllowed = _delayedIsScriptNotifyAllowed;
                    IsIndexedDBEnabled    = _delayedIsIndexDbEnabled;
                    IsJavaScriptEnabled   = _delayedIsJavaScriptEnabled;

                    // This will cause a navigation
                    Source = _delayedSource;
                }
                else
                {
                    // Already provided control
                    SubscribeEvents();
                }

                _webViewControl.IsVisible = true;
            }

            _initializationState = InitializationState.IsInitialized;
        }
示例#14
0
 /// <summary>
 /// Discards customizations and resets the configured logger
 /// facilities to their defaults.
 /// </summary>
 public static void Reset()
 {
     lock (_locker)
     {
         _initializationState = InitializationState.Uninitialized;
         _tempFactory         = new SubstituteLoggerFactory();
         _factoryResolver     = null;
     }
 }
示例#15
0
        /// <summary>
        /// Marks a discontinuity at the last point that was evaluated.
        /// </summary>
        /// <remarks>This function is indended to be used if discontinuous boundary conditions exist. The function evaluates
        /// the rate at the last point, and effectively restarts the ODE. See example for details.
        /// Example: if a discontinuity exist at t=1000,
        /// then
        /// then (i) evaluate the ODE until t=1000,
        /// then (ii) change the boundary conditions,
        /// and then (iii) call this function.</remarks>
        public void MarkDiscontinuity()
        {
            var t0 = last_tout;
            var x0 = xout;

            _dydt = _dydt ?? new double[n];
            var dt = EvaluateRatesAndGetDt(t0, x0, _dydt);

            currstate.Reinitialize(dt, t0, xout, _dydt);
            _initializationState = InitializationState.NotInitialized;
        }
示例#16
0
 private void CheckInitState(Manager manager, InitializationState state)
 {
     if (state == InitializationState.Initializing)
     {
         State = GameState.Initializing;
     }
     else if (state == InitializationState.Ready)
     {
         StartGame();
     }
 }
示例#17
0
        public PluginRepository(PluginManager manager, string pluginDirectory, string gameVersion)
        {
            this.manager         = manager;
            this.pluginDirectory = pluginDirectory;

            State = InitializationState.InProgress;
            Task.Run(CachePluginMaster).ContinueWith(t => {
                if (t.IsFaulted)
                {
                    State = InitializationState.Fail;
                }
            });
        }
 public RemoteEndpointMessageProperty(string address, int port)
 {
     if (string.IsNullOrEmpty(address))
     {
         throw new ArgumentNullException(nameof(address));
     }
     if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
     {
         throw new ArgumentOutOfRangeException(nameof(port));
     }
     this.port    = port;
     this.address = address;
     this.state   = InitializationState.All;
 }
示例#19
0
 public RemoteEndpointMessageProperty(string address, int port)
 {
     this.thisLock = new object();
     if (string.IsNullOrEmpty(address))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("address");
     }
     if ((port < 0) || (port > 0xffff))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("port", System.ServiceModel.SR.GetString("ValueMustBeInRange", new object[] { 0, 0xffff }));
     }
     this.port    = port;
     this.address = address;
     this.state   = InitializationState.All;
 }
示例#20
0
        void ISupportInitialize.BeginInit()
        {
            if (Initialized)
            {
                // Cannot initialize WebView since it is already completely initialized
                throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZED);
            }

            if (Initializing)
            {
                // Cannot initialize WebView since it is already being initialized
                throw new InvalidOperationException(DesignerUI.E_WEBVIEW_ALREADY_INITIALIZING);
            }

            _initializationState = InitializationState.IsInitializing;
        }
示例#21
0
        private void CachePluginMaster()
        {
            try
            {
                using var client = new WebClient();

                var data = client.DownloadString(PluginRepoBaseUrl + "pluginmaster.json");

                this.PluginMaster = JsonConvert.DeserializeObject <ReadOnlyCollection <PluginDefinition> >(data);

                State = InitializationState.Success;
            }
            catch {
                State = InitializationState.Fail;
            }
        }
示例#22
0
        public RemoteEndpointMessageProperty(string address, int port)
        {
            if (string.IsNullOrEmpty(address))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("address");
            }

            if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("port",
                                                                             SR.Format(SR.ValueMustBeInRange, IPEndPoint.MinPort, IPEndPoint.MaxPort));
            }

            this.port    = port;
            this.address = address;
            state        = InitializationState.All;
        }
        public RemoteEndpointMessageProperty(string address, int port)
        {
            if (string.IsNullOrEmpty(address))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("address");
            }

            if (port < IPEndPoint.MinPort || port > IPEndPoint.MaxPort)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("port",
                    SR.GetString(SR.ValueMustBeInRange, IPEndPoint.MinPort, IPEndPoint.MaxPort));
            }

            this.port = port;
            this.address = address;
            this.state = InitializationState.All;
        }
示例#24
0
        /// <summary>
        /// Perform any initialization only appropriate once. This is called after
        /// giving the caller a chance to change settings.
        /// </summary>
        public async void ResetAnchorManager()
        {
            initializationState = InitializationState.Starting;

            anchorManager = await SelectAnchorManager(Plugin, headPoseTracker);

            if (AutoLoad)
            {
                Load();
            }
            else
            {
                Reset();
            }

            initializationState = InitializationState.Running;
        }
示例#25
0
 private void OnCoreComponentInitialized(bool loadSucceeded)
 {
     // Either UI or Core can be completely loaded before another. In the event
     // that Core completes its loading first, it sets the "initializationState"
     // to be "InitializationState.CoreInitialized". If at this point UI has
     // already finished loading, then the library data that is loaded in Core
     // can be used to populate the "Library" tree view.
     //
     if (initializationState == InitializationState.None)
     {
         initializationState = InitializationState.CoreInitialized;
     }
     else if (initializationState == InitializationState.UiInitialized)
     {
         OnLoadingComplete();
     }
 }
示例#26
0
        public unsafe void Initialize()
        {
            _keyIndices = new Dictionary <string, ushort>();
            _keyTraits  = new Dictionary <ushort, BlackboardKeyTraits>();

            _cachedTotalSize = TotalSize;
            var sortedKeys = Collection1.OrderBy(k => k.SizeInBytes);

            _template = new NativeArray <byte>(_cachedTotalSize, Allocator.Persistent);
            var templatePtr = (byte *)_template.GetUnsafePtr();

            ushort index = 0;

            foreach (var key in sortedKeys)
            {
                var keyName = key.name;

                // cache the string-to-id hash table
                if (!_keyIndices.ContainsKey(keyName))
                {
                    _keyIndices.Add(keyName, index);
                }
                else
                {
                    Debug.LogError($"Blackboard contains multiple keys named {keyName}.", this);
                    _keyIndices[keyName] = index;
                }

                // update the index on the key itself
                key.Index = index;

                // update instance syncing data
                _keyTraits.Add(index, key.Traits);

                // set the default value
                key.SetDefault(templatePtr + index);

                // get the next index
                index += key.SizeInBytes;
            }

            Assert.AreEqual(_cachedTotalSize, index);

            InitializationStatus = InitializationState.Active;
        }
示例#27
0
        /// <summary>
        /// Search for spectrometers, choose one, close the communication.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void BtnInitialize_Click(object sender, EventArgs e)
        {
            switch (initializationState)
            {
            case InitializationState.Initial:
                if (spectrometricThermometer.BtnInitialize(coBoxDeviceType.SelectedIndex))
                {
                    coBoxDeviceType.Enabled = false;
                    initializationState     = InitializationState.Select_spectrometer;
                }
                break;

            case InitializationState.Select_spectrometer:
                if (int.TryParse(tboxDeviceID.Text, out int deviceID))
                {
                    if (spectrometricThermometer.BtnSelect(deviceID))
                    {
                        initializationState = InitializationState.Connected;
                    }
                }
                else
                {
                    My_msg("Not an integer");
                }
                break;

            case InitializationState.Connected:
                if (measuringState == MeasuringState.Measuring)
                {
                    My_msg("Stop measuring first.");
                    break;
                }
                if (spectrometricThermometer.BtnDisconnect())
                {
                    coBoxDeviceType.Enabled = true;
                    initializationState     = InitializationState.Initial;
                }
                break;

            default:
                break;
            }
            btnInitialize.Text = constants.BtnInitializeText[(int)initializationState];  // Button text.
        }
        public UnityTask <bool> InitializeUnityPurchasing(System.Action <AppStore, ConfigurationBuilder> configurationBuilder)
        {
            return(UnityTask <bool> .Run(InitializeUnityPurchasingCoroutine()));

            IEnumerator <bool> InitializeUnityPurchasingCoroutine()
            {
                if (this.initializationState == InitializationState.InitializedSucceeded)
                {
                    yield return(true);

                    yield break;
                }

                float startTime = Time.realtimeSinceStartup;

                this.initializationState = InitializationState.Initializing;
                UnityPurchasing.Initialize(this, this.GetConfigurationBuilder(configurationBuilder));

                while (this.initializationState == InitializationState.Initializing)
                {
                    yield return(default);
示例#29
0
        /// <summary>
        /// Implementation of Gear's BDF method with dynamically changed step size and order. Order changes between 1 and 3.
        /// </summary>
        /// <param name="t0">Initial time point</param>
        /// <param name="x0">Initial phase vector</param>
        /// <param name="f">Right parts of the system</param>
        /// <param name="opts">Options for accuracy control and initial step size</param>
        /// <returns>Sequence of infinite number of solution points.</returns>
        private void InternalInitialize(double t0, double[] x0, Action <double, double[], double[]> f, GearsBDFOptions opts)
        {
            if (null == _denseJacobianEvaluation && null == _sparseJacobianEvaluation)
            {
                throw new InvalidProgramException("Ooops, how could this happen?");
            }

            double t = t0;
            var    x = (double[])x0.Clone();

            n = x0.Length;

            this.f    = f;
            this.opts = opts;

            //Initial step size.
            _dydt = _dydt ?? new double[n];
            var dt    = EvaluateRatesAndGetDt(t0, x0, _dydt);
            var resdt = dt;

            int qmax  = 5;
            int qcurr = 2;

            _zn_saved = new DoubleMatrix(n, qmax + 1);

            currstate = new NordsieckState(n, qmax, qcurr, dt, t, x0, _dydt);

            isIterationFailed = false;

            tout = t0;
            xout = (double[])x0.Clone();

            // ---------------------------------------------------------------------------------------------------
            // End of initialize
            // ---------------------------------------------------------------------------------------------------

            // Firstly, return initial point
            // EvaluateInternally(t0, true, out t0, xout);
            _initializationState = InitializationState.NotInitialized;
        }
示例#30
0
        private void Initialize()
        {
            // check already initialized, or initialization in progress
            if (_initializationState != InitializationState.NotInitialized)
            {
                return;
            }

            _initializationState = InitializationState.Initializing;

            Async.Invoke(this,
                         () => _folderSystem.Initialize(),
                         delegate
            {
                // subscribe to events
                _folderSystem.Folders.ItemAdded       += FolderAddedEventHandler;
                _folderSystem.Folders.ItemRemoved     += FolderRemovedEventHandler;
                _folderSystem.FoldersChanged          += FoldersChangedEventHandler;
                _folderSystem.FoldersInvalidated      += FoldersInvalidatedEventHandler;
                _folderSystem.FolderPropertiesChanged += FolderPropertiesChangedEventHandler;

                // build the initial folder tree, but do not udpate it, as this will be done on demand
                // when this folder system is selected
                BuildFolderTree();

                // this timer is responsible for monitoring the auto-invalidation of all folders
                // in the folder system, and performing the appropriate invalidations
                // bug #6909: increase timer interval from 1 sec to 10 seconds, to reduce lockup issues when time provider can't access network
                _folderInvalidateTimer = new Timer(delegate { AutoInvalidateFolders(); })
                {
                    IntervalMilliseconds = 10000
                };
                _folderInvalidateTimer.Start();

                // notify that this folder system is now initialized
                _initializationState = InitializationState.Initialized;
                EventsHelper.Fire(_intialized, this, EventArgs.Empty);
            });
        }
示例#31
0
        protected IEnumerator Load(AudioReferenceWithParameters audioReference)
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            if (!AudioManager.TryGetDefaultBankName(AudioReferenceWithParameters.op_Implicit(audioReference), out string bankName))
            {
                m_initializationState = InitializationState.Error;
                yield break;
            }
            AudioBankLoadRequest bankLoadRequest = AudioManager.LoadBankAsync(bankName);

            m_bankLoadRequests = new AudioBankLoadRequest[1]
            {
                bankLoadRequest
            };
            m_initializationState = InitializationState.Loading;
            while (!bankLoadRequest.isDone)
            {
                yield return(null);
            }
            m_initializationState = ((AssetManagerError.op_Implicit(bankLoadRequest.error) == 0) ? InitializationState.Loaded : InitializationState.Error);
        }
        void Initialize(bool getHostedPort)
        {
            if (remoteEndPoint != null)
            {
                this.address = remoteEndPoint.Address.ToString();
                this.port = remoteEndPoint.Port;
                this.state = InitializationState.All;
                this.remoteEndPoint = null;
            }
            else
            {
                if ((this.state & InitializationState.Address) != InitializationState.Address)
                {
                    this.address = remoteEndpointProvider.GetAddress();
                    this.state |= InitializationState.Address;
                }

                if (getHostedPort)
                {
                    this.port = remoteEndpointProvider.GetPort();
                    this.state |= InitializationState.Port;
                    this.remoteEndpointProvider = null;
                }
            }
        }
示例#33
0
 private void OnCoreComponentInitialized(bool loadSucceeded)
 {
     // Either UI or Core can be completely loaded before another. In the event
     // that Core completes its loading first, it sets the "initializationState"
     // to be "InitializationState.CoreInitialized". If at this point UI has
     // already finished loading, then the library data that is loaded in Core
     // can be used to populate the "Library" tree view.
     //
     if (initializationState == InitializationState.None)
         initializationState = InitializationState.CoreInitialized;
     else if (initializationState == InitializationState.UiInitialized)
         OnLoadingComplete();
 }
示例#34
0
        private static void PerformInitialization()
        {
            try
            {
                if (_factoryResolver == null)
                {
                    _factoryResolver = new AppConfigFactoryResolver();
                }

                var factory = _factoryResolver.GetFactory();

                if (factory == null)
                {
                    _initializationState = InitializationState.NOP_Fallback;
                    EmitFactoryResolverError(_factoryResolver);
                    return;
                }

                _initializationState = InitializationState.Initialized;
                EmitSubstituteLoggerWarning();

            }
            catch (Exception ex)
            {
                _initializationState = InitializationState.NOP_Fallback;

                try
                {
                    EventLogHelper.WriteEntry("Error initializing LoggerFactory.  Defaulting to no-operation (NOP) logger implementation.", ex);
                }
                catch { }
            }
        }
示例#35
0
 /// <summary>
 /// Sets the factory resolver used to get the <see cref="ILoggerFactory"/>
 /// </summary>
 /// <param name="resolver">The resolver to use.  If null is passed, the <see cref="NOPLoggerFactoryResolver"/> will be used.</param>
 public static void SetFactoryResolver(IFactoryResolver resolver)
 {
     lock (_locker)
     {
         _initializationState = InitializationState.Uninitialized;
         _factoryResolver = resolver ?? NOPLoggerFactoryResolver.Instance;
     }
 }
示例#36
0
 /// <summary>
 /// Discards customizations and resets the configured logger
 /// facilities to their defaults.
 /// </summary>
 public static void Reset()
 {
     lock (_locker)
     {
         _initializationState = InitializationState.Uninitialized;
         _tempFactory = new SubstituteLoggerFactory();
         _factoryResolver = null;
     }
 }
示例#37
0
        /// <summary>
        /// Returns the <see cref="ILoggerFactory"/> instance in use.
        /// </summary>
        public static ILoggerFactory GetILoggerFactory()
        {
            if (_initializationState == InitializationState.Uninitialized)
            {
                lock (_locker)
                {
                    if (_initializationState == InitializationState.Uninitialized)
                    {
                        _initializationState = InitializationState.Ongoing;
                        PerformInitialization();
                    }
                }
            }

            switch (_initializationState)
            {
                case InitializationState.Initialized:
                    return _factoryResolver.GetFactory();

                case InitializationState.NOP_Fallback:
                    return _fallbackFactory;

                case InitializationState.Ongoing:
                    return _tempFactory;

                case InitializationState.Failed:
                    // Not currently used, safer to use fallback instance
                    throw new InvalidOperationException("The slf4net LoggerFactory failed to initialize.  Check the event log for details.");

                default:
                    // Should never reach this code...
                    throw new InvalidOperationException("_initializationState " + _initializationState + " is not recognized.");
            }
        }
示例#38
0
        private void OnGraphControlLoaded(object sender, RoutedEventArgs e)
        {
            // Kick start library loading on a background thread...
            coreComponent = ClassFactory.CreateCoreComponent(this, geometricPreviewEnabled);
            coreComponent.InitializeAsync(this.OnCoreComponentInitialized);

            // Cursor resources.
            this.cursorSet = new CursorSet(this.MasterGrid);

            // Kick start a check for update version info, if the update manager is idle.
            UpdateManager.Instance.UpdateDownloaded += OnUpdatePackageDownloaded;
            UpdateManager.Instance.CheckForProductUpdate();
            UpdateManager.Instance.ShutdownRequested += OnUpdateManagerShutdownRequested;

            //Library
            libraryView = new LibraryView(this);
            libraryView.SetValue(GraphControl.WidthProperty, 250.0);
            libraryView.SetValue(GraphControl.HeightProperty, 400.0);
            libraryView.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom);
            libraryView.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Left);
            libraryView.SetValue(GraphControl.MarginProperty, new Thickness(5, 0, 0, 0));
            libraryView.SetValue(Panel.ZIndexProperty, 60000);
            MasterGrid.Children.Add(libraryView);

            //Zoom and Pan Bar
            zoomAndPanControl = new ZoomAndPanControl(this);
            zoomAndPanControl.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Top);
            zoomAndPanControl.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Right);
            zoomAndPanControl.SetValue(GraphControl.MarginProperty, new Thickness(0, 5, 5, 0));
            zoomAndPanControl.SetValue(Panel.ZIndexProperty, 60000);
            zoomAndPanControl.Focusable = false;
            MasterGrid.Children.Add(zoomAndPanControl);

            //TabControl
            newCanvasCount = 0;
            tabControl = new GraphTabControl(this);
            tabControl.SetValue(Panel.ZIndexProperty, 60000);
            tabControl.SetValue(GraphControl.MarginProperty, new Thickness(0, -1, 0, 0));
            TabBorder.Child = tabControl;

            // for zoom and pan
            this.canvasScrollViewer.KeyDown += OnScrollViewerKeyDown;
            this.canvasScrollViewer.ScrollChanged += OnScrollViewerScrollChanged;
            this.slider.ValueChanged += OnSliderValueChanged;

            filesToRecover = Utilities.GetFilesToRecover(coreComponent.SessionName);
            if (null == filesToRecover || (filesToRecover.Count == 0))
                CreateBlankOrRecoveredCanvas(false); // Nothing to recover, create default.

            // Either UI or Core can be completely loaded before another. In the event
            // that UI completes its loading first, it sets the "initializationState"
            // to be "InitializationState.UiInitialized". If at this point Core has
            // already finished loading, then the library data can readily be obtained
            // and "Library" tree view populated.
            //
            if (initializationState == InitializationState.None)
                initializationState = InitializationState.UiInitialized;
            else if (initializationState == InitializationState.CoreInitialized)
                OnLoadingComplete();

            if (!coreComponent.StudioSettings.DontShowSplash)
            {
                Splash splashMessage = new Splash(this);
                splashMessage.SetValue(GraphControl.HorizontalAlignmentProperty, HorizontalAlignment.Center);
                splashMessage.SetValue(GraphControl.VerticalAlignmentProperty, VerticalAlignment.Bottom);
                splashMessage.MouseLeftButtonDown += OnSplashMouseLeftButtonDown;
                this.FeedbackMsssagePanel.Children.Add(splashMessage);
            }
        }
 public DoCourierMissionsState()
 {
     pCurrentSubState = new InitializationState(false);
 }