Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        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);
            }
        }
Ejemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        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);
            }
        }
Ejemplo n.º 3
0
		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);
			}
		}