示例#1
0
        private void ExecuteDeleteSpecificClamp(Clamp existingClamp)
        {
            _logger.Debug(string.Format("Execute delete of specific clamp (clamp='{0}'", existingClamp));
            const double deletionDelay = 700;             // Must be greater than the animation duration in the DataTemplate !!!

            var deletionTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(deletionDelay)
            };

            deletionTimer.Tick += (o, args) =>
            {
                _logger.Debug(string.Format("Remove clamp (clamp='{0}'", existingClamp));
                Clamps.Remove(existingClamp);
                deletionTimer.Stop();
                EventHelper.RemoveAllEventHandler(deletionTimer, "Tick");
            };

            deletionTimer.Start();
            existingClamp.IsRemoving = true;
        }
示例#2
0
        public void PreviewClamp(RaycastHit hit)
        {
            // If we haven't already created a preview clamp, create one
            if (previewClamp == null)
            {
                Simulation.clampMutex.WaitOne();
                previewClamp = BuildClamp(hit);

                // If we couldn't build a preview clamp, don't try to preview the position hit
                if (previewClamp == null)
                {
                    Simulation.clampMutex.ReleaseMutex();
                    return;
                }

                Clamps.Remove(previewClamp);
                Simulation.clampMutex.ReleaseMutex();
                foreach (Collider col in previewClamp.GetComponentsInChildren <Collider>())
                {
                    col.enabled = false;
                }
                previewClamp.SwitchMaterial(previewClamp.previewMaterial);
                previewClamp.name = "PreviewClamp";
                foreach (GameObject defaultCapHolder in previewClamp.defaultCapHolders)
                {
                    Destroy(defaultCapHolder);
                }
                foreach (GameObject destroyCapHolder in previewClamp.destroyCapHolders)
                {
                    Destroy(destroyCapHolder);
                }
            }

            // Ensure the clamp is enabled
            previewClamp.transform.parent.gameObject.SetActive(true);

            // Set the size and orientation of the preview clamp
            previewClamp.PlaceClamp(Simulation.GetNearestPoint(hit));
        }