//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(); }
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); }
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; }