/// ------------------------------------------------------------------------------------ private void LoadToolbarAndContextMenus() { if (App.DesignMode) { return; } if (_tmAdapter != null) { _tmAdapter.Dispose(); } _tmAdapter = AdapterHelper.CreateTMAdapter(); if (_tmAdapter != null) { var defs = new[] { FileLocator.GetFileDistributedWithApplication(App.ConfigFolderName, "CVChartsTMDefinition.xml") }; _tmAdapter.Initialize(this, App.MsgMediator, App.ApplicationRegKeyPath, defs); _tmAdapter.AllowUpdates = true; } // Give the chart Phone search toolbar button a default image. var childItemProps = _tmAdapter.GetItemProperties("tbbChartPhoneSearchAnywhere"); var parentItemProps = _tmAdapter.GetItemProperties("tbbChartPhoneSearch"); if (parentItemProps != null && childItemProps != null) { parentItemProps.Image = childItemProps.Image; parentItemProps.Visible = true; parentItemProps.Update = true; _tmAdapter.SetItemProperties("tbbChartPhoneSearch", parentItemProps); } }
/// ------------------------------------------------------------------------------------ private void PerformSearch(string environment, string toolbarItemName) { var srchPhones = _chartGrid.SelectedPhones; if (srchPhones == null) { return; } var queries = new List <SearchQuery>(); foreach (string phone in srchPhones) { var query = new SearchQuery(); query.Pattern = phone + "/" + environment; query.IgnoreDiacritics = false; query.IgnoredCharacters = string.Join(",", Project.IgnoredSymbolsInCVCharts); // Check if the phone only exists as an uncertain phone. If so, // then set the flag in the query to include searching words // made using all uncertain uncertain derivations. var phoneInfo = Project.PhoneCache[phone]; if (phoneInfo != null && phoneInfo.TotalCount == 0) { query.IncludeAllUncertainPossibilities = true; } queries.Add(query); } App.MsgMediator.SendMessage("ViewSearch", queries); // Now set the image of the search button to the image associated // with the last search environment chosen by the user. var childItemProps = _tmAdapter.GetItemProperties(toolbarItemName); var parentItemProps = _tmAdapter.GetItemProperties("tbbChartPhoneSearch"); if (parentItemProps != null && childItemProps != null) { parentItemProps.Image = childItemProps.Image; parentItemProps.Visible = true; parentItemProps.Update = true; parentItemProps.Tag = new[] { environment, toolbarItemName }; _tmAdapter.SetItemProperties("tbbChartPhoneSearch", parentItemProps); } }
void UpdateItemProps(ITMAdapter tmAdapter, string menuName, bool nonSpellingError, object tag) { TMItemProperties itemProps = tmAdapter.GetItemProperties(menuName); if (itemProps != null) { if (nonSpellingError) { itemProps.Tag = null; // disable } else { itemProps.Tag = tag; } itemProps.Update = true; tmAdapter.SetItemProperties(menuName, itemProps); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void CreateCheckingToolbar(ITMAdapter tmAdapter) { if (tmAdapter == null) return; m_tmAdapter = tmAdapter; m_sepShowOnlyAtTop = new ToolStripSeparator(); m_ToolStrip.Items.Insert(0, m_sepShowOnlyAtTop); AddToolStripButton(tmAdapter.GetItemProperties("mnuStatusEditAnnotation"), "ScrChecksEditAnnotation"); m_tbbEditAnnotations = m_ToolStrip.Items[0] as ToolStripButton; m_ToolStrip.Items.Insert(0, new ToolStripSeparator()); AddToolStripButton(tmAdapter.GetItemProperties("mnuStatusInconsistency"), "ScrChecksInconsistency"); m_tbbInconsistencies = m_ToolStrip.Items[0] as ToolStripButton; s_dontIgnoreImage = TeResourceHelper.UnignoredInconsistency; AddToolStripButton(tmAdapter.GetItemProperties("mnuStatusIgnoredWAnnotation"), "ScrChecksIgnoredWAnnotation"); m_tbbIgnoreWAnnotation = m_ToolStrip.Items[0] as ToolStripButton; AddToolStripButton(tmAdapter.GetItemProperties("mnuStatusIgnored"), "ScrChecksIgnored"); m_tbbIgnore = m_ToolStrip.Items[0] as ToolStripButton; s_ignoreImage = TeResourceHelper.IgnoredInconsistency; OnCheckErrorsListReferenceChanged(null, CheckingError.Empty); }