예제 #1
0
 public static void Reset()
 {
     lock (StaticCriticalSection) {
         Instances.Clear();
         InitQueue.Clear();
     }
 }
예제 #2
0
 /// <summary>
 /// Clears the cache.
 /// </summary>
 public void Clear()
 {
     lock (InstancesLock)
     {
         Instances.Clear();
     }
 }
예제 #3
0
        async Task ExecuteLoadInstancesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Instances.Clear();
                var instances = await DataStore.GetItemsAsync(true);

                Instances.ReplaceRange(instances);
            }
            catch (Exception ex)
            {
                MessagingCenter.Send("Não é possível carregar os Dispositivos.", "messageDevice");
            }
            finally
            {
                IsBusy = false;
            }
        }
예제 #4
0
        private void OrderInstancesByInheritance()
        {
            _order = new List <AbcInstance>();

            if (IsFlexApp && Generator != null)
            {
                var app = Generator.MainInstance;
                OrderByInheritance(app);
            }

            foreach (var instance in Instances)
            {
                OrderByInheritance(instance);
            }

            Debug.Assert(_order.Count == Instances.Count);

            Instances.Clear();
            Classes.Clear();

            int n = _order.Count;

            for (int i = 0; i < n; ++i)
            {
                var instance = _order[i];
                var klass    = instance.Class;
                Instances.Add(instance);
                Classes.Add(klass);
                Debug.Assert(instance.Index == i);
                Debug.Assert(klass.Index == i);
            }

            Scripts.Sort(CreateScriptComparer());
        }
예제 #5
0
        private void OnServerLoggedIn(LoginResult result)
        {
            //Login failed
            if (!result.Result)
            {
                string faultMessage = this.Name + ": user name or password doesn't match";

                if (m_WebSocket != null)
                {
                    m_WebSocket.Closed -= m_WebSocket_Closed;
                    m_WebSocket.Closed += (s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send <IEnumerable <InstanceViewModel> >(null);
                    };
                    m_WebSocket.Close();
                }

                Messenger.Default.Send <AlertMessage>(new AlertMessage(faultMessage));
                return;
            }

            State = ConnectionState.Connected;
            OnServerUpdated(result.ServerInfo);
        }
        protected override void OnUninitialize()
        {
            base.OnUninitialize();

            if (Description.UnloadTrackedScenesOnUninitialize)
            {
                Log.Debug("Scene Module unload tracked scenes on uninitialize", new
                {
                    count = Instances.Entries.Count
                });

                while (Instances.Entries.Count > 0)
                {
                    KeyValuePair <Scene, SceneInstance> pair = Instances.Entries.First();

                    this.Unload(pair.Value.Id, pair.Key);
                }
            }

            Instances.Clear();

            foreach (KeyValuePair <string, ISceneLoader> pair in Description.Loaders)
            {
                Loaders.Remove(pair.Key);
            }

            foreach (KeyValuePair <string, ISceneInfo> pair in Description.Scenes)
            {
                Scenes.Remove(pair.Key);
            }
        }
 internal static void InvalidateInstancesTypes()
 {
     Types.Clear();
     Instances.Clear();
     TypesByProxy.Clear();
     TypesByOriginal.Clear();
 }
예제 #8
0
        /// <summary>
        /// Clears the cache.
        /// </summary>
        /// <param name="cleared">
        /// Was the cache cleared successfully?
        /// </param>
        public void Clear(out bool cleared)
        {
            var lockTaken = default(bool);

            try
            {
                Monitor.TryEnter(InstancesLock, LockTimeout, ref lockTaken);
                if (lockTaken)
                {
                    Instances.Clear();
                    cleared = true;
                }
                else
                {
                    CacheSettings.FailedLockHandler(LockTimeout);
                    cleared = false;
                }
            }
            finally
            {
                if (lockTaken)
                {
                    Monitor.Exit(InstancesLock);
                }
            }
        }
예제 #9
0
        /// <inheritdoc />
        protected override void TaskStop(IApplicationContext applicationContext)
        {
            RunOnAllInstances(applicationContext, OnStop);

            Instances.Clear();
            Plugins.Clear();
        }
예제 #10
0
 /// <summary>
 /// Clears all collections and assemblies.
 /// </summary>
 public void Reset()
 {
     SemanticTypes.Clear();
     Instances.Clear();
     SymbolTable.Clear();
     CompiledAssembly = null;
 }
예제 #11
0
        /// <summary> Clear the collections </summary>
        public static void Clear()
        {
            if (ReadingError != null)
            {
                ReadingError.Clear();
            }
            ReadingError = null;

            Instances.Clear();
        }
예제 #12
0
        /// <summary>
        /// Clears the project properties.
        /// </summary>
        private void Clear()
        {
            fileName = "";

            Name        = "";
            Description = "";
            ConfigBase  = new ConfigBase();
            Interface   = new Interface();
            Instances.Clear();
            DeploymentSettings = new DeploymentSettings();
        }
 /// <summary>
 /// Resets the IronPython engine scope, clears any imported modules and .NET types.
 /// </summary>
 public void Reset()
 {
     ScriptScope = _scriptEngine.CreateScope();
     _typeLoader.Reset();
     _autocompleter.Reset();
     InstanceMembers.Clear();
     StaticMembers.Clear();
     Instances.Clear();
     Statics.Clear();
     InstancesAndStaticsDirty = true;
     RunScript("import clr");
     RunScript("from System import Array");
 }
예제 #14
0
        /// <summary>
        ///
        /// </summary>
        public void ClearWorld()
        {
            LightSet.EnvLights.Clear();
            LightSet.OmniLights.Clear();
            LightSet.SpotLights.Clear();
            LightSet.SpotAtlas = null;
            LightSet.Decals.Clear();

            Instances.Clear();

            //	immediate?
            ParticleSystem.KillParticles();
        }
예제 #15
0
        public Dictionary <SiloAddress, List <ActivationAddress> > Merge(GrainId grain, IGrainInfo other)
        {
            bool modified = false;

            foreach (var pair in other.Instances)
            {
                if (Instances.ContainsKey(pair.Key))
                {
                    continue;
                }

                Instances[pair.Key] = new ActivationInfo(pair.Value.SiloAddress, pair.Value.RegistrationStatus);
                modified            = true;
            }

            if (modified)
            {
                VersionTag = rand.Next();
            }

            if (SingleInstance && (Instances.Count > 0))
            {
                // Grain is supposed to be in single activation mode, but we have two activations!!
                // Eventually we should somehow delegate handling this to the silo, but for now, we'll arbitrarily pick one value.
                var orderedActivations = Instances.OrderBy(pair => pair.Key);
                var activationToKeep   = orderedActivations.First();
                var activationsToDrop  = orderedActivations.Skip(1);
                Instances.Clear();
                Instances.Add(activationToKeep.Key, activationToKeep.Value);
                var mapping = new Dictionary <SiloAddress, List <ActivationAddress> >();
                foreach (var activationPair in activationsToDrop)
                {
                    var activation = ActivationAddress.GetAddress(activationPair.Value.SiloAddress, grain, activationPair.Key);

                    List <ActivationAddress> activationsToRemoveOnSilo;
                    if (!mapping.TryGetValue(activation.Silo, out activationsToRemoveOnSilo))
                    {
                        activationsToRemoveOnSilo = mapping[activation.Silo] = new List <ActivationAddress>(1);
                    }

                    activationsToRemoveOnSilo.Add(activation);
                }

                return(mapping);
            }

            return(null);
        }
 private void Connect()
 {
     _apiClient.Initialize(int.Parse(UserId), AccessToken, EndpointAddress);
     RaisePropertyChanged(() => IsConnected);
     if (IsConnected)
     {
         // Save the connection settings, as this connection is now valid
         SaveConnectionSettings();
         RefreshProjectsAsync();
     }
     else
     {
         Projects.Clear();
         Instances.Clear();
     }
 }
예제 #17
0
        internal void Deserialize()
        {
            if (prototypeIndexSerializeData != null &&
                positionSerializeData != null &&
                rotationSerializeData != null &&
                scaleSerializeData != null)
            {
                prototypeIndexSerializeData = GCompressor.Decompress(prototypeIndexSerializeData);
                positionSerializeData       = GCompressor.Decompress(positionSerializeData);
                rotationSerializeData       = GCompressor.Decompress(rotationSerializeData);
                scaleSerializeData          = GCompressor.Decompress(scaleSerializeData);

                int[]   indices   = new int[prototypeIndexSerializeData.Length / sizeof(int)];
                float[] positions = new float[positionSerializeData.Length / sizeof(float)];
                float[] rotations = new float[rotationSerializeData.Length / sizeof(float)];
                float[] scales    = new float[scaleSerializeData.Length / sizeof(float)];

                Buffer.BlockCopy(prototypeIndexSerializeData, 0, indices, 0, prototypeIndexSerializeData.Length);
                Buffer.BlockCopy(positionSerializeData, 0, positions, 0, positionSerializeData.Length);
                Buffer.BlockCopy(rotationSerializeData, 0, rotations, 0, rotationSerializeData.Length);
                Buffer.BlockCopy(scaleSerializeData, 0, scales, 0, scaleSerializeData.Length);

                Instances.Clear();
                for (int i = 0; i < indices.Length; ++i)
                {
                    GGrassInstance grass = GGrassInstance.Create(indices[i]);
                    grass.Position = new Vector3(
                        positions[i * 3 + 0],
                        positions[i * 3 + 1],
                        positions[i * 3 + 2]);
                    grass.Rotation = new Quaternion(
                        rotations[i * 4 + 0],
                        rotations[i * 4 + 1],
                        rotations[i * 4 + 2],
                        rotations[i * 4 + 3]);
                    grass.Scale = new Vector3(
                        scales[i * 3 + 0],
                        scales[i * 3 + 1],
                        scales[i * 3 + 2]);
                    Instances.Add(grass);
                }
            }
        }
예제 #18
0
        private async Task FetchInstances()
        {
            IsLoading.Value = true;
            Instances.Clear();
            var res = await Http.GetAsync("https://join.misskey.page/instances.json");

            var json = JsonConvert.DeserializeObject <JoinMisskeyInstances>(await res.Content.ReadAsStringAsync());

            Instances.AddRangeOnScheduler(
                json.Instances
                .Where(i => i.Meta != null)
                .Where(i => !i.Meta.DisableRegistration)
                .OrderByDescending(i => i.Value)
                .OrderByDescending(i => i.Meta.IsGroundpolis ? 1 : 0)
                .Select(i => new JoinMisskeyInstanceViewModel(i))
                );

            IsLoading.Value = false;
        }
예제 #19
0
        public bool Merge(GrainId grain, IGrainInfo other)
        {
            bool modified = false;

            foreach (var pair in other.Instances)
            {
                if (Instances.ContainsKey(pair.Key))
                {
                    continue;
                }

                Instances[pair.Key] = new ActivationInfo(pair.Value.SiloAddress);
                modified            = true;
            }

            if (modified)
            {
                VersionTag = rand.Next();
            }

            if (SingleInstance && (Instances.Count > 0))
            {
                // Grain is supposed to be in single activation mode, but we have two activations!!
                // Eventually we should somehow delegate handling this to the silo, but for now, we'll arbitrarily pick one value.
                var orderedActivations = Instances.OrderBy(pair => pair.Key);
                var activationToKeep   = orderedActivations.First();
                var activationsToDrop  = orderedActivations.Skip(1);
                Instances.Clear();
                Instances.Add(activationToKeep.Key, activationToKeep.Value);
                var list = new List <ActivationAddress>(1);
                foreach (var activation in activationsToDrop.Select(keyValuePair => ActivationAddress.GetAddress(keyValuePair.Value.SiloAddress, grain, keyValuePair.Key)))
                {
                    list.Add(activation);
                    CatalogFactory.GetSystemTarget(Constants.CatalogId, activation.Silo).
                    DeleteActivations(list).Ignore();

                    list.Clear();
                }
                return(true);
            }
            return(false);
        }
예제 #20
0
        private void OnServerLoggedIn(LoginResult result)
        {
            //Login failed
            if (!result.Result)
            {
                string faultMessage = this.Name + ": user name or password doesn't match";

                if (m_WebSocket != null)
                {
                    m_WebSocket.Closed -= m_WebSocket_Closed;
#if SILVERLIGHT
                    m_WebSocket.Closed += new EventHandler(CreateAsyncOperation <object, EventArgs>((s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send <IEnumerable <InstanceViewModel> >(null);
                    }));
#else
                    m_WebSocket.Closed += (s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send <IEnumerable <InstanceViewModel> >(null);
                    };
#endif
                    m_WebSocket.Close();
                }

                Messenger.Default.Send <AlertMessage>(new AlertMessage(faultMessage));
                return;
            }

            State = ConnectionState.Connected;
            OnServerUpdated(result.ServerInfo);

            if (!FirstLoaded)
            {
                FirstLoaded = true;
            }
        }
예제 #21
0
        private void KillProcesses()
        {
            if (KillingProcesses)
            {
                return;
            }

            KillingProcesses = true;

            foreach (var instance in Instances)
            {
                if (instance.IsRunning)
                {
                    Utilities.KillProcessTree(instance.DaprProcessId);
                }
            }

            Instances.Clear();

            KillingProcesses = false;
        }
예제 #22
0
 protected override void OnRemoving()
 {
     base.OnRemoving();
     try
     {
         Children.Clear(); //foreach thing in Children en.Remove();
     }
     catch (Exception ex)
     {
         throw new DocException("Failed to delete VariableRule in Children delete", ex);
     }
     try
     {
         Instances.Clear(); //foreach thing in Instances en.Remove();
     }
     catch (Exception ex)
     {
         throw new DocException("Failed to delete VariableRule in Instances delete", ex);
     }
     FlushCache();
 }
        private async void RefreshInstancesAsync()
        {
            if (SelectedProject == null)
            {
                SelectedInstance = null;
                Instances.Clear();
                return;
            }

            var instances = await _apiClient.GetBacktestsAsync(SelectedProject.ProjectId);

            Instances = new ObservableCollection <InstanceViewModel>(instances.Where(i => i.Completed).Select(i => new InstanceViewModel
            {
                Name     = i.Name,
                Id       = i.BacktestId,
                Type     = ResultType.Backtest,
                Note     = i.Note,
                Progress = i.Progress
            }));

            SelectedInstance = Instances.FirstOrDefault();
        }
예제 #24
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                _input.Dispose();
                _classesCache.Clear();

                Methods.Clear();
                Metadata.Clear();
                Instances.Clear();
                Classes.Clear();
                Scripts.Clear();
                MethodBodies.Clear();

                Pool.Integers.Clear();
                Pool.UIntegers.Clear();
                Pool.Doubles.Clear();
                Pool.Strings.Clear();
                Pool.Namespaces.Clear();
                Pool.NamespaceSets.Clear();
                Pool.Multinames.Clear();
            }
        }
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    try
                    {
                        if (Instances.Count > 0)
                        {
                            for (int i = Instances.Count; i > 1; i--)
                            {
                                DisposeInstance(Instances[i - 1]);
                            }

                            Instances[0].ShutDownSeleniumServer();
                        }
                    }
                    catch
                    {
                        // If an error occurs disposing of the instances then simply stop the server
                        if (Server.Started)
                        {
                            Server.Stop();
                        }
                    }
                    finally
                    {
                        Instances.Clear();
                        Selenium = null;
                    }
                }
            }

            _disposed = true;
        }
예제 #26
0
 public void ClearInstances()
 {
     Factories.Clear();
     Instances.Clear();
 }
예제 #27
0
 /// <summary>
 /// Clears all type-mappings and instances.
 /// </summary>
 public void Clear()
 {
     Instances.Clear();
     Mappings.Clear();
     RelationshipMappings.Clear();
 }
예제 #28
0
 internal void Disconnect()
 {
     _InstancesRef.Clear();
     Instances.Clear();
 }
    protected void OnLevelWasLoaded()
#endif
    {
        Instances.Clear();
    }
예제 #30
0
 public static void ClearAll()
 {
     Instances.Clear();
 }