private void UpdatePlugins() { results.Clear(); foreach (var plugin in GisEditor.UIManager.GetActiveUIPlugins <UIPlugin>()) { var pluginModel = new PluginViewModel(plugin); pluginModel.Keywords = string.Empty; results.Add(pluginModel); } }
private void CollectItemsSource() { foreach (var plugin in discoveredPlugins) { string pluginFullName = plugin.Id; PluginViewModel pluginModel = new PluginViewModel(plugin); if (pluginModel.IconSource == null) { pluginModel.IconSource = new BitmapImage(new Uri("/GisEditorInfrastructure;component/Images/Gear.png", UriKind.RelativeOrAbsolute)); } itemsSource.Add(pluginModel); } }
private void Search(string word) { results.Clear(); Collection <List <UIPlugin> > allPossibleResults = new Collection <List <UIPlugin> >(); var keywords = word.Split(','); foreach (var tmpKeyword in keywords) { if (!string.IsNullOrEmpty(tmpKeyword)) { var pluginResults = GisEditor.UIManager.GetActiveUIPlugins <UIPlugin>().Where(p => p.Name.Contains(tmpKeyword) || p.Author.Contains(tmpKeyword) || p.Description.Contains(tmpKeyword)).ToList(); allPossibleResults.Add(pluginResults); } } foreach (var plugin in GisEditor.UIManager.GetActiveUIPlugins <UIPlugin>()) { bool doesAllContains = false; foreach (var item in allPossibleResults) { if (!(doesAllContains = item.Contains(plugin))) { break; } } if (doesAllContains) { if (plugin != null) { var pluginModel = new PluginViewModel(plugin); pluginModel.Keywords = word; foreach (var singleKeyword in keywords) { if (!string.IsNullOrEmpty(singleKeyword)) { pluginModel.Keywords = pluginModel.Keywords.Replace(singleKeyword, string.Format(tagFormat, singleKeyword)); } } results.Add(pluginModel); } } } }
private void Unselect(object sender, MouseButtonEventArgs e) { var ui = sender as FrameworkElement; PluginViewModel model = null; if (ui != null) { model = ui.DataContext as PluginViewModel; } if (pluginSearchViewModel.SelectedPlugin != null && model != null && model == pluginSearchViewModel.SelectedPlugin) { pluginSearchViewModel.Unselect(model.Plugin as UIPlugin); e.Handled = true; } }
public void Unselect(UIPlugin plugin) { //GisEditor.LayoutManager.HighlightUIPlugins.Remove(plugin); plugin.IsHighlighted = false; SelectedPlugin = null; }