Exemple #1
0
 public void RemoveClip(AtomAnimationClip clip)
 {
     Clips.Remove(clip);
     clip.Dispose();
     ClipsListChanged.Invoke();
     OnAnimationModified();
 }
Exemple #2
0
        public bool AddClip(Clipboard.Clip clip)
        {
            // Check if a clip with the same content exists in the last clips.
            var equalClips = Clips.Take(10).Where(vm => vm.Clip.Content == clip.Content);

            if (equalClips.Count() > 0)
            {
                // If a clip with the same content already exists, just update the creation time.
                // TODO: Possibly refresh list view to push clip to top.
                equalClips.First().Clip.Created = DateTime.Now;
                return false;
            }

            var viewModel = new ClipViewModel(clip);

            viewModel.PropertyChanged += OnClipViewModelPropChanged;

            if (Clips.Count >= ClipLimit && ClipLimit > 0)
            {
                // If the limit is reached, throw out the oldest one.
                // Make sure it is not pinned.
                var first = Clips.Where((c) => !c.Pinned).First();
                Clips.Remove(first);
            }

            Clips.Add(viewModel);

            return true;
        }
Exemple #3
0
 private void OnClipViewModelPropChanged(object sender, PropertyChangedEventArgs e)
 {
     var cvm = sender as ClipViewModel;
     if (e.PropertyName == "Clip" && cvm.Clip == null)
     {
         Clips.Remove(cvm);
     }
 }
        private void OnClipboardChanged()
        {
            if (!IsRecording)
            {
                return;
            }

            if (!TryGetClipBoardText(10, 50, out string newText))
            {
                return;
            }

            // only unique strings wanted
            while (Clips.Contains(newText))
            {
                Clips.Remove(newText);
            }
            // put clip on top of list
            Clips.Insert(0, newText);
            while (Clips.Count > _maxSize)
            {
                Clips.RemoveAt(Clips.Count - 1);
            }
        }