internal static void ShowCharts(IAppContext context) { var layer = context.Legend.SelectedLayer; if (layer == null) { return; } using (var form = new ChartStyleForm(context, layer)) { context.View.ShowChildView(form); } }
private void LayerDiagramsClicked(IMuteLegend legend, LayerEventArgs e) { var fs = legend.Map.GetFeatureSet(e.LayerHandle); if (fs != null) { var layer = legend.Map.Layers.ItemByHandle(e.LayerHandle); using (var form = new ChartStyleForm(_context, layer)) { _context.View.ShowChildView(form); } e.Handled = true; } }
/// <summary> /// Opens form to change chart appearance /// </summary> private void btnChartAppearance_Click(object sender, EventArgs e) { ChartStyleForm form = new ChartStyleForm(_legend, _shapefile, false, _layerHandle); form.ShowDialog(); // even if cancel was hit, a user could have applied the options bool state = _noEvents; _noEvents = true; optChartBars.Checked = (_shapefile.Charts.ChartType == tkChartType.chtBarChart); optChartsPie.Checked = (_shapefile.Charts.ChartType == tkChartType.chtPieChart); _noEvents = state; DrawChartsPreview(); RefreshControlsState(null, null); RedrawMap(); }
public override void RunCommand(VectorStyleCommand command) { switch (command) { case VectorStyleCommand.ClearVisibilityExpression: FeatureSet.VisibilityExpression = ""; View.UpdateView(); break; case VectorStyleCommand.ChangeVisibilityExpression: string s = FeatureSet.VisibilityExpression; if (FormHelper.ShowQueryBuilder(_context, Model, ViewAsParent, ref s, false)) { FeatureSet.VisibilityExpression = s; View.UpdateView(); } break; case VectorStyleCommand.ClearLabels: if (MessageService.Current.Ask("Do you want to remove labels?")) { FeatureSet.Labels.Items.Clear(); FeatureSet.Labels.Expression = ""; } View.RefreshLabels(); break; case VectorStyleCommand.LabelAppearance: using (var form = new LabelStyleForm(_context, Model)) { _context.View.ShowChildView(form, ViewAsParent); } View.RefreshLabels(); break; case VectorStyleCommand.ClearCharts: if (MessageService.Current.Ask("Do you want to remove charts?")) { FeatureSet.Diagrams.Fields.Clear(); FeatureSet.Diagrams.Clear(); } View.RefreshCharts(); break; case VectorStyleCommand.OpenLocation: string filename = Model.Filename; if (!string.IsNullOrWhiteSpace(filename)) { PathHelper.OpenFolderWithExplorer(filename); } else { MessageService.Current.Info("Can't find the datasource."); } break; case VectorStyleCommand.SaveStyle: LayerSerializationHelper.SaveSettings(Model); break; case VectorStyleCommand.RemoveStyle: LayerSerializationHelper.RemoveSettings(Model, false); break; case VectorStyleCommand.ProjectionDetails: _context.ShowProjectionProperties(Model.Projection, View as IWin32Window); break; case VectorStyleCommand.ChartsEditColorScheme: FormHelper.EditColorSchemes(_context, SchemeTarget.Charts, ViewAsParent); break; case VectorStyleCommand.ChartAppearance: using (var form = new ChartStyleForm(_context, Model)) { _context.View.ShowChildView(form, ViewAsParent); } View.RefreshCharts(); break; default: throw new ArgumentOutOfRangeException("command"); } }