public override WatchContent GetContent(int index) { var content = contents[index]; if (content is null) { contents[index] = content = new WatchContent(index, watchVariablesWindowValueNodesProviderService.Value.Get(index), wpfCommandService, variablesWindowVMFactory.Value); } return(content); }
CommandsLoader(IWpfCommandService wpfCommandService, Lazy <VariablesWindowOperations> operations, Lazy <WatchContentFactory> watchContentFactory) { for (int i = 0; i < WatchWindowsHelper.NUMBER_OF_WATCH_WINDOWS; i++) { var cmds = wpfCommandService.GetCommands(WatchContent.GetVariablesWindowGuid(i)); int windowIndex = i; cmds.Add(new RelayCommand(a => operations.Value.Copy(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanCopy(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Control, Key.C); cmds.Add(new RelayCommand(a => operations.Value.Copy(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanCopy(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Control, Key.Insert); cmds.Add(new RelayCommand(a => operations.Value.Paste(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanPaste(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Control, Key.V); cmds.Add(new RelayCommand(a => operations.Value.Paste(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanPaste(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Shift, Key.Insert); cmds.Add(new RelayCommand(a => operations.Value.DeleteWatch(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanDeleteWatch(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.None, Key.Delete); cmds.Add(new RelayCommand(a => operations.Value.Edit(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanEdit(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.None, Key.F2); cmds.Add(new RelayCommand(a => operations.Value.CopyValue(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanCopyValue(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Control | ModifierKeys.Shift, Key.C); cmds.Add(new RelayCommand(a => operations.Value.ToggleExpanded(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanToggleExpanded(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.None, Key.Enter); cmds.Add(new RelayCommand(a => operations.Value.ShowInMemoryWindow(watchContentFactory.Value.GetContent(windowIndex).VM.VM), a => operations.Value.CanShowInMemoryWindow(watchContentFactory.Value.GetContent(windowIndex).VM.VM)), ModifierKeys.Control, Key.X); for (int j = 0; j < 10 && j < Memory.MemoryWindowsHelper.NUMBER_OF_MEMORY_WINDOWS; j++) { int memoryWindowIndex = j; cmds.Add(new RelayCommand(a => operations.Value.ShowInMemoryWindow(watchContentFactory.Value.GetContent(memoryWindowIndex).VM.VM, memoryWindowIndex), a => operations.Value.CanShowInMemoryWindow(watchContentFactory.Value.GetContent(memoryWindowIndex).VM.VM, memoryWindowIndex)), ModifierKeys.Control, Key.D0 + (j + 1) % 10); } } }
public override bool TryGetContent(int index, out WatchContent watchContent) { watchContent = contents[index]; return(watchContent is not null); }
public abstract bool TryGetContent(int index, out WatchContent watchContent);