protected IEnumerable <IShape> GetShapes(string[] parameters, int shapeIndex) { if (parameters.Length < shapeIndex) { var shapes = SelectionContainer.GetInstance().Shapes; if (shapes.Count == 0) { throw new ArgumentException("Для команды необходимы аргументы либо выбор с помощью " + "команды 'select'"); } return(shapes); } var shape = ShapeLocator.Parse(parameters[shapeIndex - 1], picture).Shape; return(new List <IShape> { shape }); }
private void TrackSelection() { if (frame == null) { var shell = parent.GetVsService(typeof(SVsUIShell)) as IVsUIShell; if (shell != null) { var guidPropertyBrowser = new Guid(ToolWindowGuids.PropertyBrowser); shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref guidPropertyBrowser, out frame); } } if (frame != null) { frame.Show(); } if (mySelContainer == null) { mySelContainer = new SelectionContainer(); } mySelItems = new ArrayList(); var selected = lstTodo.SelectedItem as TodoItem; if (selected != null) { mySelItems.Add(selected); } mySelContainer.SelectedObjects = mySelItems; ITrackSelection track = parent.GetVsService(typeof(STrackSelection)) as ITrackSelection; if (track != null) { track.OnSelectChange(mySelContainer); } }
protected override void PopulateExtendedView(StackPanel panel, SelectionContainer entity) { var node = entity.Entities[0].Node; var functionName = FunctionUtils.GetFunctionName(node); var descriptor = DescriptorsFactory.Instance.GetFunctionTab(functionName); descriptor.RefreshNode(panel, node, ViewInfo, new List <string>()); ViewInfo.Document.Changed += OnDocumentChange; var gradient = new LinearGradientBrush { StartPoint = new Point(0, 0), EndPoint = new Point(0, 1), GradientStops = new GradientStopCollection { new GradientStop(Colors.White, 0), new GradientStop(Colors.DarkGray, 0.3), new GradientStop(Colors.LightBlue, 1) } }; panel.Background = gradient; }
public static ShapeLocator Parse(string identifier) { var shapeLocator = new ShapeLocator(); var identifierDecomp = identifier.Split(':'); int index; if (identifierDecomp.Length > 0 && int.TryParse(identifierDecomp[0], out index)) { try { shapeLocator.Shape = SelectionContainer.GetInstance().Shapes[index]; } catch (ArgumentOutOfRangeException) { throw new ArgumentException("Фигуры с таким индетефикатором " + identifier + " не существует"); } } else { throw new ArgumentException("Формат идеентификатора '" + identifier + "' не верен"); } if (identifierDecomp.Length > 1) { int[] underPosition = new int[identifierDecomp.Length - 1]; for (int i = 0; i < identifierDecomp.Length - 1; i++) { if (!int.TryParse(identifierDecomp[i + 1], out underPosition[i])) { throw new ArgumentException("Формат идеентификатора '" + identifier + "' не верен"); } } Search(shapeLocator, underPosition); } return(shapeLocator); }
public void Show(SelectionContainer entity) { var optionsSetup = _actionsGraph[InputNames.OptionsSetupInput].Get <OptionsSetup>(); var optionSection = optionsSetup.UpdateSectionNode(OptionSectionNames.WelcomePageTitle); DestroyOldWindow(entity); if (!optionSection.GetBoolValue(1)) { return; } if (entity == null || entity.Entities.Count == 0) { return; } const int deltaX = 16; const int deltaY = 16; if (IsDifferentEntity(entity.Entities[0])) { _entity = entity; _window = new FloatingWindow(); _window.KeyDown += WindowKeyDown; _window.Closed += WindowClosed; } var defPnt = new Point(); GetCursorPos(ref defPnt); _window.Left = defPnt.X + deltaX; _window.Top = defPnt.Y + deltaY; _factory.PopulateView(_window, _entity, _actionsGraph); _window.ShowActivated = false; _window.Show(); }
public override void SetEditor(SelectionContainer selectedEntity, ActionsGraph actionsGraph) { ToolsFloatingWindow.Instance.Show(selectedEntity); ToolsFloatingWindow.Instance.Setup(actionsGraph); }
public abstract bool AcceptEntity(SelectionContainer entity);
public abstract void PopulateView(StackPanel panel, SelectionContainer entity, ActionsGraph actionsGraph);
protected virtual void PopulateExtendedView(StackPanel panel, SelectionContainer entity) { }
// -------------------------------------------------------------------------------------------- /// <summary> /// Creates a new selection tracker instance. /// </summary> /// <param name="provider">Service provider to obtain the selection tracker from.</param> /// <param name="selectableRO">Is the collection of selectable objects read only?</param> /// <param name="selectedRO">Is the collection of selected objects read only?</param> // -------------------------------------------------------------------------------------------- public SelectionTracker(IServiceProvider provider, bool selectableRO, bool selectedRO) { _TrackSelection = provider.GetService <STrackSelection, ITrackSelection>(); _Container = new SelectionContainer(selectableRO, selectedRO); Unselect(); }
public override bool AcceptEntity(SelectionContainer entity) { return(true); }
public abstract void SetEditor(SelectionContainer selectedEntity, ActionsGraph actionsGraph);
public async Task UpdatePriceAsync(SelectionContainer selectionContainer) { CalculateSelectionContainerPrice(selectionContainer); await _context.SaveChangesAsync(); }
public override void PopulateView(StackPanel panel, SelectionContainer entity, ActionsGraph actionsGraph) { var view = new SketchToolsView(entity, actionsGraph); panel.Children.Add(view); }
public void AddToolsVisualComponent(FloatingToolBase toolBase, SelectionContainer selectedItem, ActionsGraph actionsGraph) { toolBase.PopulateView(_toolsStack, selectedItem, actionsGraph); }
public override void PopulateView(StackPanel panel, SelectionContainer entity, ActionsGraph actionsGraph) { panel.Children.Add(new CopyView(ViewInfo)); }
public void ClearSelection() { SelectionContainer.Clear(); }
public SelectionService(IServiceProvider serviceProvider) { this.trackSelection = serviceProvider.GetService <ITrackSelection>(); this.selectionContainer = new SelectionContainer(); }
public EntityWrapper(SelectionContainer selectionContainer) { Id = GetWrapperId(ItemType, selectionContainer.SelectionContainerId); ItemType = ItemType.SelectionContainer; SelectionContainer = selectionContainer; }