public List <TreeViewItem> GetSavedNames() { var result = new List <TreeViewItem>(); IfHasSlotKey( (temp) => { if (temp.content == null || temp.content.Count == 0) { // ReSharper disable once InconsistentNaming const string NO_RECORDS_SAVED = "No records saved."; result.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_RECORDS_SAVED), depth = 0, displayName = NO_RECORDS_SAVED }); } else { result.AddRange( temp.GetAllRecordNames() .Select(key => new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(key.ToString()), depth = 0, displayName = key.ToString() })); } }); return(result); }
private void UpdateTree() { integrator.SetUris(_pathsToSendIntoIntegrator); if (_pathsToSendIntoIntegrator.Count == 0) { // ReSharper disable once InconsistentNaming const string NO_PATHS_ACCEPTED = "No paths accepted"; _treeViewForPaths.UpdateItems(new List <TreeViewItem> { new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_PATHS_ACCEPTED), displayName = NO_PATHS_ACCEPTED } }); } else { _treeViewForPaths.UpdateItems(_pathsToSendIntoIntegrator.Select(s => new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(s), displayName = s }).ToList()); } }
public List <TreeViewItem> GetCurrentRecordNames() { var result = _actionStorage.Keys .Select(key => new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(key), depth = 0, displayName = key }).ToList(); return(result.Count == 0 ? null : result); }
public List <TreeViewItem> GetSavedRecordDetails(string recordName) { var result = new List <TreeViewItem>(); IfHasSlotKey((slotFromPlayerPrefs) => { if (slotFromPlayerPrefs?.content == null) { return; } var record = slotFromPlayerPrefs.FindRecordByName(recordName); foreach (var inputKind in record.GetAllFakeInputs()) { var treeViewItemOfInputKind = new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(inputKind.ToString()), depth = 0, displayName = inputKind.ToString() }; var fakeInputWithFipAndActions = record.FindFakeInputWithFipAndActionsByKind(inputKind); foreach (var fakeInputParameter in fakeInputWithFipAndActions.GetAllFips()) { var treeViewItemOfFip = new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(fakeInputParameter.ToString()), depth = 1, displayName = fakeInputParameter.ToString() }; var fipAndActions = fakeInputWithFipAndActions.FindFipAndActionsByFip(fakeInputParameter); foreach (var treeViewItemOfAction in fipAndActions.metadata .Select((metadata, index) => { metadata.action.GetDeserialized(); var treeViewItemResult = new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(metadata.action.Content.ToString()), depth = 2, displayName = $"{metadata.action.Content} - {metadata.repetitions} repetitions" }; return(treeViewItemResult); })) { treeViewItemOfFip.AddChild(treeViewItemOfAction); } treeViewItemOfInputKind.AddChild(treeViewItemOfFip); } result.Add(treeViewItemOfInputKind); } }); return(result); }
private void InitializeAllItems() { _allItems = new List <TreeViewItem>(); switch (TreePurpose) { case TreePurpose.DRAW_CURRENT_NAMES: _allItems.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_CURRENT_ACTIONS_LOADED), depth = 0, displayName = NO_CURRENT_ACTIONS_LOADED }); break; case TreePurpose.DRAW_CURRENT_KINDS_AND_ACTIONS: _allItems.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_CURRENT_KINDS_AND_ACTIONS_SELECTED), depth = 0, displayName = NO_CURRENT_KINDS_AND_ACTIONS_SELECTED }); break; case TreePurpose.DRAW_SAVED_NAMES: _allItems.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_RECORDS_SAVED), depth = 0, displayName = NO_RECORDS_SAVED }); break; case TreePurpose.DRAW_SAVED_KINDS_AND_ACTIONS: _allItems.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_SAVED_KINDS_AND_ACTIONS_SELECTED), depth = 0, displayName = NO_SAVED_KINDS_AND_ACTIONS_SELECTED }); break; case TreePurpose.PATHS: _allItems.Add(new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(NO_PATHS_ACCEPTED), depth = 0, displayName = NO_PATHS_ACCEPTED }); break; case TreePurpose.NONE: throw new System.ArgumentOutOfRangeException(string.Empty, $"Tree purpose is invalid: {TreePurpose}"); default: throw new System.ArgumentOutOfRangeException(); } }
public List <TreeViewItem> GetCurrentActions(string recordName) { var result = new List <TreeViewItem>(); if (!_actionStorage.ContainsKey(recordName)) { return(null); } foreach (var fakeInputAndDictionary in _actionStorage[recordName]) { var rootFakeInput = new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(fakeInputAndDictionary.Key.ToString()), depth = 0, displayName = fakeInputAndDictionary.Key.ToString() }; result.Add(rootFakeInput); foreach (var fakeInputParameterAndQueue in fakeInputAndDictionary.Value) { var displayNameForFip = fakeInputParameterAndQueue.Key.ToString(); var fakeInputParameterViewItem = new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(displayNameForFip), depth = 1, displayName = displayNameForFip }; rootFakeInput.AddChild(fakeInputParameterViewItem); foreach (var actionTreeViewItem in fakeInputParameterAndQueue.Value.Select((action, index) => new TreeViewItem { id = DictionaryBasedIdGenerator.GetNewId(action.Content.ToString()), depth = 2, displayName = $"{action.Content} - {fakeInputParameterAndQueue.Value.GetRepetitions(index)} repetitions" })) { fakeInputParameterViewItem.AddChild(actionTreeViewItem); } } } return(result); }