Example #1
0
        private void ReadDBData()
        {
            var data = ClipboardDB.Instance.GetAll();

            foreach (var obj in data)
            {
                ClipboardList.Add(obj.text);
            }
        }
Example #2
0
        private bool OnHotKey(uint w, uint l)
        {
            if (w == Util.GetHotKeyIdWithName("Visibility"))
            {
                if (WindowVisibility == Visibility.Visible)
                {
                    WindowVisibility = Visibility.Collapsed;
                }
                else
                {
                    WindowVisibility = Visibility.Visible;
                    if (ActivateEventHandler != null)
                    {
                        ActivateEventHandler(this, new ActivateEventArgs());
                    }

                    var clipdata = Util.GetClipboardText().Trim();
                    if (clipdata != null && clipdata.Length > 0 && !string.IsNullOrWhiteSpace(clipdata))
                    {
                        if (clipboardList.Count > 0 && clipdata == clipboardList.Last())
                        {
                            return(true);
                        }

                        ClipboardList.Add(clipdata);
                        ClipboardDB.Instance.Create(new ClipboardRecord()
                        {
                            text = clipdata,
                            time = DateTime.Now,
                        });
                    }
                }
                return(true);
            }
            return(false);
        }