private void RebuildTagToolStrip() { IGameFileView currentControl = GetCurrentViewControl(); if (currentControl != null) { List <ITagData> addTags = new List <ITagData>(); List <ITagData> removeTags = new List <ITagData>(); DataCache.Instance.UpdateTags(); foreach (var gameFile in SelectedItems(currentControl)) { if (gameFile.GameFileID.HasValue) { var gameFileTags = DataCache.Instance.TagMapLookup.GetTags(gameFile); var currentRemoveTags = DataCache.Instance.Tags.Where(x => gameFileTags.Any(y => y.TagID == x.TagID)); var currentAddTags = DataCache.Instance.Tags.Except(currentRemoveTags); addTags = addTags.Union(currentAddTags).ToList(); removeTags = removeTags.Union(currentRemoveTags).ToList(); } } ToolStripMenuItem tagToolStrip = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Tag") as ToolStripMenuItem; ToolStripMenuItem removeTagToolStrip = mnuLocal.Items.Cast <ToolStripItem>().FirstOrDefault(x => x.Text == "Remove Tag") as ToolStripMenuItem; if (tagToolStrip != null) { BuildTagToolStrip(tagToolStrip, addTags, tagToolStripItem_Click); BuildTagToolStrip(removeTagToolStrip, removeTags, removeTagToolStripItem_Click); } } }
public void RegisterView(IGameFileView view) { view.GameFileEnter += View_GameFileEnter; view.GameFileLeave += View_GameFileLeave; view.SelectionChange += View_SelectionChange; view.ItemClick += View_ItemClick; }
private void btnSearch_Click(object sender, EventArgs e) { IGameFileView ctrl = CurrentGameFileControl; if (ctrl != null) { HandleSearch(ctrl); } }
public ITabView TabViewForControl(IGameFileView ctrl) { if (m_tabLookup.ContainsKey(ctrl)) { return(m_tabLookup[ctrl].TabView); } return(null); }
private void CtrlSearch_SearchTextKeyPreviewDown(object sender, PreviewKeyDownEventArgs e) { if (e.KeyCode == Keys.Enter) { IGameFileView ctrl = CurrentGameFileControl; if (ctrl != null) { HandleSearch(ctrl); } } }
private void HandleProcessExited(object sender) { if (m_filterForm != null) { m_filterForm.Close(); m_filterForm = null; } GameFilePlayAdapter adapter = sender as GameFilePlayAdapter; DateTime dtExit = DateTime.Now; Directory.SetCurrentDirectory(m_workingDirectory); m_playInProgress = false; if (adapter.SourcePort != null) { IGameFile gameFile = adapter.GameFile; if (gameFile != null) { SetMinutesPlayed(dtExit, gameFile); } if (!string.IsNullOrEmpty(adapter.RecordedFileName)) { HandleRecordedDemo(adapter, gameFile); } HandleDetectorFiles(adapter, gameFile); if (m_statsReader != null) { m_statsReader.Stop(); if (m_statsReader.ReadOnClose) { m_statsReader.ReadNow(); } if (m_statsReader.Errors.Length > 0) { HandleStatReaderErrors(m_statsReader); } m_statsReader = null; } } IGameFileView view = GetCurrentViewControl(); view.UpdateGameFile(adapter.GameFile); HandleSelectionChange(view, true); }
private void SetGameFileViewEvents(IGameFileView ctrl, bool dragDrop) { ctrl.ItemDoubleClick += ctrlView_RowDoubleClicked; ctrl.SelectionChange += ctrlView_SelectionChange; ctrl.ViewKeyPress += ctrlView_GridKeyPress; if (dragDrop) { ctrl.DragDrop += ctrlView_DragDrop; ctrl.DragEnter += ctrlView_DragEnter; ctrl.ViewKeyDown += ctrlView_GridKeyDown; } }
private void TabControl_SelectedIndexChanged(object sender, EventArgs e) { var gameFileControl = CurrentGameFileControl; if (m_lastView != null) { m_lastView.SetVisible(false); } if (gameFileControl != null) { gameFileControl.SetVisible(true); } m_lastView = gameFileControl; }
private void HandleSearch(IGameFileView ctrl) { if (!m_bOverrideInit) { ITabView view = m_tabHandler.TabViewForControl(ctrl); if (view != null) { if (!string.IsNullOrEmpty(ctrlSearch.SearchText)) { view.SetGameFiles(Util.SearchFieldsFromSearchCtrl(ctrlSearch)); } else { view.SetGameFiles(); } } } }
public TagTabView(object key, string title, IDataSourceAdapter adapter, GameFileFieldType[] selectFields, ITagData tag, IGameFileView view) : base(key, title, adapter, selectFields, view) { InitializeComponent(); TagDataSource = tag; m_tagAdapter = adapter; }
protected BasicTabViewCtrl(object key, string title, IGameFileDataSourceAdapter adapter, GameFileFieldType[] selectFields, IGameFileView view) { InitializeComponent(); m_key = key; Title = title; Adapter = adapter; m_selectFields = selectFields.ToArray(); UserControl ctrl = (UserControl)view; ctrl.Anchor = AnchorStyles.Top | AnchorStyles.Left; ctrl.Dock = DockStyle.Fill; Controls.Add(ctrl); GameFileView = (IGameFileView)ctrl; }