public override void Run() { var wb = Workbench.Instance; var exp = wb.ActiveSiteExplorer; var mgr = ServiceRegistry.GetService<ServerConnectionManager>(); var conn = mgr.GetConnection(exp.ConnectionName); var picker = new ResourcePicker(conn.ResourceService, ResourceTypes.SymbolLibrary, ResourcePickerMode.OpenResource); if (picker.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK) { var browser = new SymbolPicker(picker.ResourceID, conn); if (browser.ShowDialog(wb) == System.Windows.Forms.DialogResult.OK) { MessageService.ShowMessage(browser.SymbolName); return; } } MessageService.ShowMessage(Strings.Cancelled); }
private void btnBrowseSymbolName_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.SymbolLibraryID)) { MessageBox.Show(Strings.SelectSymbolLibraryFirst); return; } using (var picker = new SymbolPicker(this.SymbolLibraryID, _conn)) { if (picker.ShowDialog() == DialogResult.OK) { this.SymbolName = picker.SymbolName; } } }
private void Symbol_SelectedIndexChanged(object sender, System.EventArgs e) { if (m_inUpdate) return; bool isSymbol = false; ShapeType selectedShape = ShapeType.Circle; // see if need to change symbol type foreach (string s in Enum.GetNames(typeof(ShapeType))) if (string.Compare(s, (string)Symbol.SelectedValue, true) == 0) { selectedShape = (ShapeType)Enum.Parse(typeof(ShapeType), s); isSymbol = true; break; } if (m_item.Symbol.Type == PointSymbolType.Mark) m_lastMark = (IMarkSymbol)m_item.Symbol; else if (m_item.Symbol.Type == PointSymbolType.Font) m_lastFont = (IFontSymbol)m_item.Symbol; if (isSymbol) { //W2D symbol is not selected, so invalidate grpW2DStyle.Tag = null; bool update = m_item.Symbol != m_lastMark; if (m_lastMark == null) m_lastMark = _factory.CreateDefaultMarkSymbol(); m_lastMark.Shape = selectedShape; m_item.Symbol = m_lastMark; setUIForMarkSymbol(true); if (update) UpdateDisplay(); } else if (Symbol.SelectedIndex == 6) //Font { //W2D symbol is not selected, so invalidate grpW2DStyle.Tag = null; // user wants to change away FROM a valid 'Mark' symbol type // if ("Font..." == Symbol.SelectedText) bool update = m_item.Symbol != m_lastFont; if (m_lastFont == null) { m_lastFont = _factory.CreateDefaultFontSymbol(); m_lastFont.SizeContext = SizeContextType.DeviceUnits; m_lastFont.Rotation = "0"; m_lastFont.SizeX = "10"; m_lastFont.SizeY = "10"; m_lastFont.Unit = LengthUnitType.Points; } m_item.Symbol = m_lastFont; setUIForMarkSymbol(false); if (update) UpdateDisplay(); } else if (Symbol.SelectedIndex == 7) //Symbol { using (var picker = new SymbolPicker(m_editor.GetEditedResource().CurrentConnection)) { if (picker.ShowDialog() == DialogResult.OK) { bool update = m_item.Symbol != m_lastSymbol; if (m_lastSymbol == null) { m_lastSymbol = _factory.CreateDefaultW2DSymbol(picker.SymbolLibrary, picker.SymbolName); m_lastSymbol.SizeContext = SizeContextType.DeviceUnits; m_lastSymbol.Rotation = "0"; m_lastSymbol.SizeX = "10"; m_lastSymbol.SizeY = "10"; m_lastSymbol.Unit = LengthUnitType.Points; } m_item.Symbol = m_lastSymbol; //Store the W2D preview image grpW2DStyle.Tag = picker.SymbolImage; setUIForMarkSymbol(false); if (update) UpdateDisplay(); } } } else { //W2D symbol is not selected, so invalidate grpW2DStyle.Tag = null; MessageBox.Show(this, Strings.SymbolTypeNotSupported, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } UpdatePreviewResult(); if (Changed != null) Changed(this, new EventArgs()); }