Carnac.Logic/Models/Message.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Documents;

namespace Carnac.Logic.Models
{
    public class Message : NotifyPropertyChanged
    {
        private readonly ObservableCollection<string> textCollection;
        private readonly ObservableCollection<KeyPress> keyCollection;
        private int lastTextRepeatCount = 1;
        private string lastText;
        private KeyPress lastKeyPress;

        public Message()
        {
            textCollection = new ObservableCollection<string>();
            keyCollection = new ObservableCollection<KeyPress>();
            Text = new ReadOnlyObservableCollection<string>(textCollection);
            Keys = new ReadOnlyObservableCollection<KeyPress>(keyCollection);
        }

        public string ProcessName { get; set; }

        public DateTime StartingTime { get; set; }
        public DateTime LastMessage { get; set; }
        public ReadOnlyObservableCollection<string> Text { get; private set; }
        public ReadOnlyObservableCollection<KeyPress> Keys { get; private set; }
        public int Count { get; set; }
        public bool IsDeleting { get; set; }

        private string shortcutName;
        readonly string[] repeatDetectionText = { "Back", "Left", "Right", "Down", "Up"};

        public string ShortcutName
        {
            get { return shortcutName; }
            set
            {
                shortcutName = value;
                if (!string.IsNullOrEmpty(shortcutName))
                    AddText(string.Format(" [{0}]", value));
            }
        }

        public void AddKey(KeyPress keyPress)
        {
            keyCollection.Add(keyPress);
            if (lastKeyPress != null && lastKeyPress.IsShortcut)
                textCollection.Add(", ");
            lastKeyPress = keyPress;
            var first = true;
            foreach (var text in keyPress.Input)
            {
                if (!first)
                    AddText(" + ");
                AddText(text);
                first = false;
            }
后面还有 49 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。