public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { dynamic settings = pSearchSettings; settings.SearchStartType = VSSEARCHSTARTTYPE.SST_INSTANT; base.ProvideSearchSettings(pSearchSettings); }
private static IEnumerable <string> GetVerbs(IVsUIDataSource dataSource) { Contract.Requires <ArgumentNullException>(dataSource != null, "dataSource"); Contract.Ensures(Contract.Result <IEnumerable <string> >() != null); IVsUIEnumDataSourceVerbs verbs; if (ErrorHandler.Succeeded(dataSource.EnumVerbs(out verbs))) { string[] array = new string[1]; while (true) { uint count; int hr = verbs.Next((uint)array.Length, array, out count); ErrorHandler.ThrowOnFailure(hr); if (hr == VSConstants.S_FALSE || count == 0) { break; } for (uint i = 0; i < count; i++) { yield return(array[i]); } } } }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { // Поиск по мере ввода Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_DELAYED); //Utilities.SetValue(pSearchSettings, // SearchSettingsDataSource.SearchStartMinCharsProperty.Name, // 2u); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchPopupCloseDelayProperty.Name, 0u); // прогрессбар Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchProgressTypeProperty.Name, (uint)VSSEARCHPROGRESSTYPE.SPT_INDETERMINATE); //todo ForwardEnterKeyOnSearchStartProperty VSUI_TYPE_BOOL Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.ControlMaxWidthProperty.Name, 600u); }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { SetIntValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, 200); SetIntValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartType, (int)VSSEARCHSTARTTYPE.SST_DELAYED); SetIntValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartDelay, 100); SetBoolValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchUseMRU, true); SetBoolValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.PrefixFilterMRUItems, false); SetIntValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.MaximumMRUItems, 25); SetStringValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, ServicesVSResources.Search_Settings); SetBoolValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchPopupAutoDropdown, false); SetStringValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlBorderThickness, "1"); SetIntValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchProgressType, (int)VSSEARCHPROGRESSTYPE.SPT_INDETERMINATE); void SetBoolValue(IVsUIDataSource source, string property, bool value) { var valueProp = BuiltInPropertyValue.FromBool(value); _ = source.SetValue(property, valueProp); } void SetIntValue(IVsUIDataSource source, string property, int value) { var valueProp = BuiltInPropertyValue.Create(value); _ = source.SetValue(property, valueProp); } void SetStringValue(IVsUIDataSource source, string property, string value) { var valueProp = BuiltInPropertyValue.Create(value); _ = source.SetValue(property, valueProp); } }
private void SelectNewViewPresenter(IVsUIDataSource dataContext, ContentControl contentHost) { Shell.ThreadHelper.ThrowIfNotOnUIThread(); try { ProviderDataSourceWrapper providerModel = new ProviderDataSourceWrapper(dataContext); VsUIElementDescriptor newViewDescriptor = GetAppropriateViewDescriptor(providerModel); Telemetry.Client.TrackPageView(providerModel.Name); // Decide if the view should change, or if we can just update the datasource on the existing view. if (ShouldChangeView(newViewDescriptor)) { // Update the new content and Dispose of the old using IDisposable oldContent = contentHost.Content as IDisposable; SetNewView(contentHost, newViewDescriptor, providerModel.ViewModel); } else { // Use the same view, just update the data context. UpdateCurrentViewElementModel(contentHost, providerModel.ViewModel); } } catch (ViewCreationException ex) { HandleViewCreationException(contentHost, ex); } catch (UIFactoryException ex) { HandleViewCreationException(contentHost, ex); } }
public Shape(IVsUIDataSource ds) { ThreadHelper.ThrowIfNotOnUIThread(); Marshal.ThrowExceptionForHR(ds.GetShapeIdentifier(out Guid guid, out uint dword)); this.Guid = guid; this.Id = dword; }
private static IEnumerable <string> GetVerbs([NotNull] IVsUIDataSource dataSource) { Requires.NotNull(dataSource, nameof(dataSource)); IVsUIEnumDataSourceVerbs verbs; if (ErrorHandler.Succeeded(dataSource.EnumVerbs(out verbs))) { string[] array = new string[1]; while (true) { uint count; int hr = verbs.Next((uint)array.Length, array, out count); ErrorHandler.ThrowOnFailure(hr); if (hr == VSConstants.S_FALSE || count == 0) { break; } for (uint i = 0; i < count; i++) { yield return(array[i]); } } } }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { var settings = (SearchSettingsDataSource)pSearchSettings; settings.ControlMinWidth = (uint)_searchControlParent.MinWidth; settings.ControlMaxWidth = uint.MaxValue; settings.SearchWatermark = GetSearchText(); }
public override void ProvideSearchSettings(IVsUIDataSource searchSettings) { Utilities.SetValue(searchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_ONDEMAND); Utilities.SetValue(searchSettings, SearchSettingsDataSource.RestartSearchIfUnchangedProperty.Name, true); Utilities.SetValue(searchSettings, SearchSettingsDataSource.SearchWatermarkProperty.Name, PackageResources.XPathWorkbenchSearchWatermark); }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { var settings = (SearchSettingsDataSource)pSearchSettings; settings.SearchStartType = VSSEARCHSTARTTYPE.SST_INSTANT; SetIfSpecified(settings, SearchSettingsDataSource.ControlMinWidthProperty, nameof(SearchControlSettings.MinWidth)); SetIfSpecified(settings, SearchSettingsDataSource.ControlMaxWidthProperty, nameof(SearchControlSettings.MaxWidth)); }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { base.ProvideSearchSettings(pSearchSettings); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMinWidth, 200U); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, uint.MaxValue); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, "Search CodeMaid Spade (Ctrl+M, ;)"); }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { var settings = (SearchSettingsDataSource)pSearchSettings; settings.SearchWatermark = Resources.HelpSearchWatermark; settings.SearchTooltip = Resources.HelpSearchTooltip; settings.SearchStartType = VSSEARCHSTARTTYPE.SST_ONDEMAND; base.ProvideSearchSettings(pSearchSettings); }
private void SetDWordBuiltInIfSpecified(IVsUIDataSource pSearchSettings, string propertyName, string vsPropertyName) { uint value; if (_settings.TryGetValue(propertyName, out value)) { SetDWordBuiltIn(pSearchSettings, vsPropertyName, value); } }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { dynamic settings = pSearchSettings; settings.SearchWatermark = Resources.HelpSearchWatermark; settings.SearchTooltip = Resources.HelpSearchTooltip; settings.SearchStartType = VSSEARCHSTARTTYPE.SST_ONDEMAND; settings.RestartSearchIfUnchanged = true; base.ProvideSearchSettings(pSearchSettings); }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { if (pSearchSettings is SearchSettingsDataSource dataSource) { dataSource.ControlMaxWidth = (uint)_controlMaxWidth; dataSource.ControlMinWidth = (uint)_controlMinWidth; dataSource.MaximumMRUItems = 25; dataSource.SearchWatermark = ServicesVSResources.Search_Settings; } }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { // pSearchSettings is of type SearchSettingsDataSource. We use dynamic here // so that the code can be run on both dev12 & dev14. If we use the type directly, // there will be type mismatch error. dynamic settings = pSearchSettings; settings.ControlMinWidth = (uint)_topPanel.SearchControlParent.MinWidth; settings.ControlMaxWidth = uint.MaxValue; settings.SearchWatermark = GetSearchText(); }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_DELAYED); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchProgressTypeProperty.Name, (uint)VSSEARCHPROGRESSTYPE.SPT_DETERMINATE); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchWatermarkProperty.Name, "Search PowerShell commands"); }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, (uint)200); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartType, (uint)VSSEARCHSTARTTYPE.SST_DELAYED); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartDelay, (uint)100); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchUseMRU, true); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.PrefixFilterMRUItems, false); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.MaximumMRUItems, (uint)25); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, SearchWatermark); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchPopupAutoDropdown, false); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlBorderThickness, "1"); InternalUtilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchProgressType, (uint)VSSEARCHPROGRESSTYPE.SPT_INDETERMINATE); }
public void ProvideSearchSettings(IVsUIDataSource pSearchOptions) { // Let's mark the results from this provider non-cacheable. // Providers with non-cacheable results will be called on CreateItemResult() by the MostRecentlyExecuted provider // to re-create recent items in order to verify if they still match new search queries. // For performance reason though it's better to use the default setting and let the MRE provider cache the strings // of the item result and do check if it matches the new queries. // Whenever we need to change the settings (e.g. set SearchResultsCacheable = false), // we need to do it through IVsUIDataSource members, or by using helpers/utilities classes. // We cannot cast the pSearchOption to SearchProviderSettingsDataSource and use its members directly unless // the extension always targets only the latest version of Visual Studio. //Utilities.SetValue(pSearchOptions, SearchProviderSettingsDataSource.PropertyNames.SearchResultsCacheable, false); }
private static IEnumerable<string> GetVerbs(IVsUIDataSource dataSource) { Contract.Requires<ArgumentNullException>(dataSource != null, "dataSource"); Contract.Ensures(Contract.Result<IEnumerable<string>>() != null); IVsUIEnumDataSourceVerbs verbs; if (ErrorHandler.Succeeded(dataSource.EnumVerbs(out verbs))) { string[] array = new string[1]; while (true) { uint count; int hr = verbs.Next((uint)array.Length, array, out count); ErrorHandler.ThrowOnFailure(hr); if (hr == VSConstants.S_FALSE || count == 0) break; for (uint i = 0; i < count; i++) yield return array[i]; } } }
public void ProvideSearchSettings(IVsUIDataSource pSearchOptions) { }
public ProviderDataSourceWrapper(IVsUIDataSource datasource) { this.ds = datasource; }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { SetDWordBuiltIn(pSearchSettings, "SearchStartType", (uint)VSSEARCHSTARTTYPE.SST_INSTANT); SetDWordBuiltInIfSpecified(pSearchSettings, nameof(SearchControlSettings.MinWidth), "ControlMinWidth"); SetDWordBuiltInIfSpecified(pSearchSettings, nameof(SearchControlSettings.MaxWidth), "ControlMaxWidth"); }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { base.ProvideSearchSettings(pSearchSettings); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchTrimsWhitespaces, true); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, uint.MaxValue); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, VSPackage.Watermark_Search); }
/// <summary>Allows the window search host to obtain overridable search options.</summary> /// <param name="pSearchSettings">The search options.</param> public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.ControlMaxWidth, (uint)10000); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchStartDelay, (uint)250); Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.PropertyNames.SearchWatermark, "Search model"); }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { // pSearchSettings is of type SearchSettingsDataSource. We use dynamic here // so that the code can be run on both dev12 & dev14. If we use the type directly, // there will be type mismatch error. dynamic settings = pSearchSettings; settings.ControlMinWidth = (uint)_searchControlParent.MinWidth; settings.ControlMaxWidth = uint.MaxValue; settings.SearchWatermark = GetSearchText(); }
private static void SetDWordBuiltIn(IVsUIDataSource pSearchSettings, string vsPropertyName, uint value) { pSearchSettings.SetValue(vsPropertyName, new VsUIObject(value, VsUIObject.DWordType, __VSUIDATAFORMAT.VSDF_BUILTIN)); }
public void ProvideSearchSettings(IVsUIDataSource pSearchOptions) { // This provider uses the default settings, there is no need to change the data source properties }
public override void ProvideSearchSettings(IVsUIDataSource searchSettings) { Utilities.SetValue(searchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_INSTANT); Utilities.SetValue(searchSettings, SearchSettingsDataSource.SearchProgressTypeProperty.Name, (uint)VSSEARCHPROGRESSTYPE.SPT_DETERMINATE); }
//<Snippet5> public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_INSTANT); }
// public void ProvideSearchSettings(IVsUIDataSource pSearchOptions) { }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { Microsoft.Internal.VisualStudio.PlatformUI.Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchStartTypeProperty.Name, (uint)VSSEARCHSTARTTYPE.SST_INSTANT); Microsoft.Internal.VisualStudio.PlatformUI.Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchProgressTypeProperty.Name, (uint)VSSEARCHPROGRESSTYPE.SPT_DETERMINATE); }
public void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { //throw new NotImplementedException(); }
//</Snippet5> private void ProvideSearchSettings2(IVsUIDataSource pSearchSettings) { //<Snippet6> Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchProgressTypeProperty.Name, (uint)VSSEARCHPROGRESSTYPE.SPT_DETERMINATE); //</Snippet6> }
public override void ProvideSearchSettings(IVsUIDataSource pSearchSettings) { Utilities.SetValue(pSearchSettings, SearchSettingsDataSource.SearchWatermarkProperty.Name, "Search"); }
//internal void ClearMissingFiles() => // Clear(Kind.File, FileMissing); //internal void ClearMissingProjects() => // Clear(Kind.Project, FileMissing); //private bool Found(Kind kind) => // GetCount(GetDataSource(kind), kind) > 0; //private void Clear(Kind kind, Func<string, bool> shouldDelete) //{ // var dataSource = GetDataSource(kind); // var recents = GetRecents(dataSource, kind); // if (recents.Count == 0) { return; } // var remove = types.GetRemoveItemAtMethod(kind); // for (var i = recents.Count - 1; i > -1; i--) // { // if (shouldDelete(GetPath(recents[i]))) // { remove.Invoke(dataSource, new object[] { i }); } // } //} //private IVsUIDataSource GetDataSource(Kind kind) //{ // var factory = _serviceProvider.GetService(typeof(SVsDataSourceFactory)) as IVsDataSourceFactory; // factory.GetDataSource( // new Guid("9099ad98-3136-4aca-a9ac-7eeeaee51dca"), // (uint)kind, // out IVsUIDataSource dataSource); // return dataSource; //} //private int GetCount(IVsUIDataSource dataSource, Kind kind) => // (int)types // .GetCountProp(kind) // .GetValue(dataSource, index: null); private IList GetRecents(IVsUIDataSource dataSource, Kind kind) => _types .GetItemsProp(kind) .GetValue(dataSource, index: null) as IList;