예제 #1
0
        //how to pass ICopyService to here???
        //how  I know when ListControl is disposed to cancel the task
        public ListViewModel(ICopyBufferService service)
        {
            _sortedSet = new SortedSet <BufferItem>(new BufferItemComparer());
            cts        = new CancellationTokenSource();
            ct         = cts.Token;

            _service = service;
            _service.ClibordNewMessage += _service_ClibordNewMessage;
            CopyList = new List <BufferItem>();
            UpdateSortedSet();
        }
예제 #2
0
        public NotifyIconViewModel()
        {
            //_bufferService = CopyBufferService.Instance;
            //_bufferService.Start();
            _listenerService = ListenerService.Instance;
            _listenerService.Start();
            ShowWindowCommand      = new Command(ShowWindowInternal);
            HideWindowCommand      = new Command(HideWindowInternal);
            ExitApplicationCommand = new Command(ExitApplicationInternal);

            _keyEventHandler = new KeyEventHandler(ShowWindowInternal);
        }
예제 #3
0
        public MainWindow(ICopyBufferService pBufferService)
        {
            InitializeComponent();
            BufferService = pBufferService;
            DataContext   = new ListViewModel(BufferService);

            StateChanged -= MainWindowStateChanged;
            Deactivated  -= MainWindow_Deactivated;
            Closed       -= MainWindow_Closed;

            StateChanged += MainWindowStateChanged;
            Deactivated  += MainWindow_Deactivated;
            Closing      += MainWindow_Closing;
            Closed       += MainWindow_Closed;
        }