public void Show() { var selectFileWizardPage = new SelectFileWizardPage(); selectFileWizardPage.Filter = ""; WindowsFormsTestHelper.ShowModal(selectFileWizardPage); }
public void DownSampledTimeSeries() { var random = new Random(); ChartView chartView = new ChartView(); var startTime = DateTime.Now; DateTime[] times = Enumerable.Range(1, 1000).Select(i => startTime.AddSeconds(i)).ToArray(); double[] y = Enumerable.Range(1000, 1000).Select(i => Convert.ToDouble(random.Next(100))).ToArray(); var pointSeries = new Points(); var lineSeries = new Points(); TChart chart = chartView.TeeChart; chart.Series.Add(pointSeries); chart.Series.Add(lineSeries); for (int i = 0; i < 1000; i++) { pointSeries.Add(times[i], y[i]); } pointSeries.Active = false; lineSeries.DataSource = pointSeries; lineSeries.Function = new DownSampling(chart.Chart) { DisplayedPointCount = 4000, Method = DownSamplingMethod.Max }; lineSeries.CheckDataSource(); chart.Zoomed += delegate { lineSeries.CheckDataSource(); }; WindowsFormsTestHelper.ShowModal(chartView); }
public void BindToFunctionWithNaNValuesWithDateTimeArgument() { //setup a 2D function and fix one dimension IFunction function = new Function(); function.Arguments.Add(new Variable <DateTime>("x")); function.Components.Add(new Variable <double>("y")); function[new DateTime(2000, 1, 1)] = 2.0; function[new DateTime(2001, 1, 1)] = 3.0; function[new DateTime(2002, 1, 1)] = double.NaN; function[new DateTime(2003, 1, 1)] = 4.0; ILineChartSeries lineChartSeries = ChartSeriesFactory.CreateLineSeries(); var component = function.Components[0]; var variable = function.Arguments[0]; lineChartSeries.XValuesDataMember = variable.DisplayName; lineChartSeries.YValuesDataMember = component.DisplayName; var functionBindingList = new FunctionBindingList(function); lineChartSeries.DataSource = functionBindingList; Assert.AreEqual(4, lineChartSeries.XValues.Count); Assert.AreEqual(4, lineChartSeries.YValues.Count); var chartView1 = new ChartView(); chartView1.Chart.Series.Add(lineChartSeries); WindowsFormsTestHelper.ShowModal(chartView1); }
public void NewLineToolAndNetworkCoverageTool() { // same test as NewLineTool but adds the possibility to networklocation to a branch. // This test does not support topologyrles that update networklocations in response // to a branch geometry change. // A theme editor is available via a double click in the canvas. InitializeControls(); var newLineTool = AddBranchLayerAndTool(); AddNetworkCoverageAndTool(); mapControl.ActivateTool(newLineTool); foreach (IMapTool tool in mapControl.Tools) { if (null != tool.Name) { listBoxTools.Items.Add(tool.Name); } } mapControl.SelectTool.FeatureEditorCreation += SelectTool_FeatureEditorCreation; WindowsFormsTestHelper.ShowModal(geometryEditorForm); }
public void ShowFeatureCoverageLayerWithLabelLayer() { var featureCoverage = new FeatureCoverage(); featureCoverage.Arguments.Add(new Variable <IFeature>()); featureCoverage.Components.Add(new Variable <double>()); var branches = CreateNBranchesNetwork(2); featureCoverage.Features = new EventedList <IFeature>(branches); featureCoverage[branches[0]] = 1.0; featureCoverage[branches[1]] = 2.0; var fcLayer = new FeatureCoverageLayer { Coverage = featureCoverage, LabelLayer = { LabelColumn = featureCoverage.Components[0].Name, Visible = true } }; var map = new Map(); map.Layers.Add(fcLayer); var mapControl = new MapControl { Map = map, AllowDrop = false }; WindowsFormsTestHelper.ShowModal(mapControl); }
public void Show() { IFunction function1 = GetFunction1Arg1Comp(); IFunction function2 = GetFunction1Arg1Comp(); IFunction function3 = GetFunction1Arg1Comp(); function1[1.0] = 2.0; function1[2.0] = 5.0; function1[3.0] = 1.0; function2[1.0] = 20.0; function2[2.0] = 50.0; function2[3.0] = 10.0; function3[3.0] = 20; function3[4.0] = 50; var view = new ChartView(); ILineChartSeries lineSeries1 = GetLineSeries(function1, view); ILineChartSeries lineSeries2 = GetLineSeries(function2, view); ILineChartSeries lineSeries3 = GetLineSeries(function3, view); view.Chart.Series.Add(lineSeries1); view.Chart.Series.Add(lineSeries2); view.Chart.Series.Add(lineSeries3); var tool = view.NewSeriesBandTool(lineSeries1, lineSeries2, Color.Green); WindowsFormsTestHelper.ShowModal(view); }
public void RenderSymbol() { VectorLayer layer = new VectorLayer(); layer.DataSource = new DataTableFeatureProvider("LINESTRING(20 20,40 40)"); VectorLayer symbolLayer = new VectorLayer("GPS"); symbolLayer.DataSource = new DataTableFeatureProvider("POINT(30 30)"); symbolLayer.Style.Symbol = Properties.Resources.NorthArrow; symbolLayer.Style.SymbolRotation = 0; symbolLayer.Style.SymbolOffset = new PointF(0, 0); symbolLayer.Style.SymbolScale = 0.5f; //Show layer on form with mapcontrol Form form = new Form(); MapControl mapControl = new MapControl(); mapControl.Dock = DockStyle.Fill; form.Controls.Add(mapControl); mapControl.Map = new Map(new Size(600, 600)); mapControl.Map.Layers.Add(symbolLayer); mapControl.Map.Layers.Add(layer); form.Show(); mapControl.Map.ZoomToExtents(); mapControl.Refresh(); form.Hide(); WindowsFormsTestHelper.ShowModal(form); }
public void ToolShouldNoLongerBeBusyAfterDoubleClick() { InitializeControls(); var newLineTool = AddBranchLayerAndTool(); AddNetworkCoverageAndTool(); ((NewLineTool)newLineTool).AutoCurve = false; mapControl.ActivateTool(newLineTool); var args = new MouseEventArgs(MouseButtons.Left, 1, -1, -1, -1); WindowsFormsTestHelper.ShowModal(geometryEditorForm, f => { newLineTool.OnMouseDown(new Coordinate(0, 10), args); //click 1 newLineTool.OnMouseUp(new Coordinate(0, 10), args); newLineTool.OnMouseMove(new Coordinate(0, 20), args); // move newLineTool.OnMouseDown(new Coordinate(0, 20), args); //click 2 newLineTool.OnMouseUp(new Coordinate(0, 20), args); newLineTool.OnMouseDown(new Coordinate(0, 20), args); //2nd click 2 newLineTool.OnMouseDoubleClick(null, args); //first double click newLineTool.OnMouseUp(new Coordinate(0, 20), args); //then up Assert.IsFalse(newLineTool.IsBusy); }); }
public void ShowRangeBarInForm() { var rangeBar = new RangeBar(); lb = new ListBox(); var form = new Form(); lb.Location = new Point(40, 40); form.Controls.Add(rangeBar); form.Controls.Add(lb); var histogram = new[] { 11, 21, 31, 35 }; var handleValues = new double[] { 10, 20, 30, 40, 50 }; doubleValues = new BindingList <double>(); foreach (double d in handleValues) { doubleValues.Add(d); } doubleValues.AllowEdit = true; lb.DataSource = doubleValues; var colors = new[] { Color.Red, Color.Green, Color.Yellow, Color.Blue }; rangeBar.SetHandles(handleValues, colors); rangeBar.Histogram = histogram; rangeBar.UserDraggingHandle += rangeBar_UserDraggingHandle; WindowsFormsTestHelper.ShowModal(form); }
public void ShowRowNumbers() { var person = new List <Person> { new Person { Age = 12, Name = "Aaltje" }, new Person { Age = 11, Name = "Berend" } }; for (var i = 0; i < 10; i++) { person.Add(new Person { Age = 11, Name = "Berend" }); } var tableView = new TableView { Data = person, ShowRowNumbers = true }; WindowsFormsTestHelper.ShowModal(tableView); }
public void ChartWithDataTableAsSeriesSource() { var table = new DataTable(); table.Columns.Add("x", typeof(double)); table.Columns.Add("y", typeof(double)); table.Rows.Add(2.5, 33.3); table.Rows.Add(0.5, 13.3); // create chart and add function as a data source using object adapter class FunctionSeriesDataSource //IChart chart = new Chart(); IChartSeries series = ChartSeriesFactory.CreateLineSeries(); series.DataSource = table; series.XValuesDataMember = "x"; series.YValuesDataMember = "y"; var chartView1 = new ChartView(); chartView1.Chart.Series.Add(series); var form = new Form { Width = 600, Height = 100 }; form.Controls.Add(chartView1); WindowsFormsTestHelper.ShowModal(form); }
public void Copy2Paste3Cell() { DataTable table = CreateTableForCopyPaste(); Assert.AreEqual(0, table.Rows[0].ItemArray[1]); Assert.AreEqual(1, table.Rows[1].ItemArray[1]); Assert.AreEqual(2, table.Rows[2].ItemArray[1]); Assert.AreEqual(3, table.Rows[3].ItemArray[1]); Assert.AreEqual(4, table.Rows[4].ItemArray[1]); var tableView = new TableView { Data = table }; Action <Form> onShown = delegate { tableView.Focus(); SendKeys.SendWait("{RIGHT}"); // goto row 1 column 2 SendKeys.SendWait("+{DOWN}"); // also select cell below SendKeys.SendWait("^c"); // copy cells SendKeys.SendWait("{DOWN}"); // navigate to cell below SendKeys.SendWait("+{DOWN}+{DOWN}"); // also select 2 cells below SendKeys.SendWait("^v"); // paste }; WindowsFormsTestHelper.ShowModal(tableView, onShown); Assert.AreEqual(0, table.Rows[0].ItemArray[1]); Assert.AreEqual(1, table.Rows[1].ItemArray[1]); Assert.AreEqual(0, table.Rows[2].ItemArray[1]); // paste 0 1 to 2 3 4 expects pattern 0 1 0 Assert.AreEqual(1, table.Rows[3].ItemArray[1]); Assert.AreEqual(0, table.Rows[4].ItemArray[1]); }
public void ShowReadOnlyFirstColumn() { var x = new Variable <int>("x"); var y = new Variable <int>("y"); y.DefaultValue = -99; var f = new Function { Arguments = { x }, Components = { y } }; f[1] = 1; f[5] = 5; f[10] = 10; f[15] = 15; var tableView = new TableView(); var bindingList = new FunctionBindingList(f) { SynchronizeInvoke = tableView }; tableView.Data = bindingList; tableView.Columns[0].ReadOnly = true; WindowsFormsTestHelper.ShowModal(tableView); }
public void RemoveRowsWhenArgumentValueIsRemovedIn2DFunction_Dimension0_WithForm() { IFunction function = new Function(); function.Arguments.Add(new Variable <int>("x1")); function.Arguments.Add(new Variable <int>("x2")); function.Components.Add(new Variable <string>("y")); function[0, 0] = "00"; function[0, 1] = "01"; function[1, 0] = "10"; function[1, 1] = "11"; var gridView = new DataGridView(); IFunctionBindingList functionBindingList = new FunctionBindingList { Function = function, SynchronizeInvoke = gridView }; gridView.DataSource = functionBindingList; Action <Form> showAction = delegate { function.Arguments[0].Values.RemoveAt(1); Application.DoEvents(); Thread.Sleep(50); Application.DoEvents(); Assert.AreEqual(function.Components[0].Values.Count, functionBindingList.Count); }; WindowsFormsTestHelper.ShowModal(gridView, showAction); }
public void ChangeYMemberSeriesViewWithFunctionAsDataSource() { var function = new Function(); var Y = new Variable <double>("Y"); var Z = new Variable <double>("Z"); var n = new Variable <double>("n"); function.Arguments.Add(Y); function.Components.Add(Z); function.Components.Add(n); Y.SetValues(new[] { 0.0, 3.0, 5.0, 6.0, 7.0 }); Z.SetValues(new[] { 0.0, 10.0, 15.0, 21.0, 15.0 }); n.SetValues(new[] { 0.001, 0.001, 0.01, 0.01, 0.01 }); var chartView = new ChartView(); IChartSeries series = ChartSeriesFactory.CreateLineSeries(); series.XValuesDataMember = Y.DisplayName; series.YValuesDataMember = Z.DisplayName; series.DataSource = new FunctionBindingList(function) { SynchronizeInvoke = chartView }; chartView.Chart.Series.Add(series); WindowsFormsTestHelper.ShowModal(chartView); }
public void ShowTableViewWithDatatableEnumType() { //demonstrates how hard it is to add custom editor to tableview for datatable //In this case you need //a typeconverter and comboboxhelper :( //TODO: look into the differences and abstract away from it var dataTable = new DataTable(); dataTable.Columns.Add("Code", typeof(string)); dataTable.Columns.Add("SomeEnum", typeof(FruitType)); for (int i = 0; i < 10; i++) { dataTable.Rows.Add(new object[] { String.Format("Item{0:000}", i), FruitType.Appel }); } dataTable.AcceptChanges(); var tableView = new TableView { Data = dataTable }; var comboBox = new RepositoryItemImageComboBox(); XtraGridComboBoxHelper.Populate(comboBox, typeof(FruitType)); tableView.SetColumnEditor(comboBox, 1); WindowsFormsTestHelper.ShowModal(tableView); }
public void Bind2DFunctionWithTuple() { IFunction function = new Function(); function.Arguments.Add(new Variable <Pair <string, float> >()); function.Components.Add(new Variable <int>("value")); function[new Pair <string, float>("aap", 0)] = 0; function[new Pair <string, float>("aap", 11)] = 1; function[new Pair <string, float>("muis", 0)] = 1; TypeConverter.RegisterTypeConverter <Pair <string, float>, PairTypeConverter <string, float> >(); Assert.AreEqual(1, function.Arguments.Count); Assert.AreEqual(1, function.Components.Count); var gridView = new DataGridView(); IFunctionBindingList functionBindingList = new FunctionBindingList(function) { SynchronizeInvoke = gridView }; gridView.DataSource = functionBindingList; WindowsFormsTestHelper.ShowModal(gridView); }
public void EmptyLineOrLineWithOnePointShouldDoNothingTools9933() { InitializeControls(); var newLineTool = AddBranchLayerAndTool(); AddNetworkCoverageAndTool(); ((NewLineTool)newLineTool).AutoCurve = false; ((NewLineTool)newLineTool).CloseLine = true; mapControl.ActivateTool(newLineTool); var args = new MouseEventArgs(MouseButtons.Left, 1, -1, -1, -1); WindowsFormsTestHelper.ShowModal(geometryEditorForm, f => { newLineTool.OnMouseDown(new Coordinate(0, 10), args); //click 1 newLineTool.OnMouseUp(new Coordinate(0, 10), args); newLineTool.OnMouseDown(new Coordinate(0, 10), args); //click 2 newLineTool.OnMouseUp(new Coordinate(0, 10), args); newLineTool.OnMouseDown(new Coordinate(0, 10), args); //click 3 newLineTool.OnMouseDoubleClick(null, args); //double click newLineTool.OnMouseUp(new Coordinate(0, 10), args); Assert.IsTrue(newLineTool.IsBusy); }); }
public void ShowScaleBar() { var rectangle = new Rectangle(5, 5, 300, 50); var bar = new ScaleBar(); bar.BorderVisible = false; bar.TransparentBackground = true; bar.BorderVisible = true; //bar.BarColor2 = Color.Yellow; bar.SetScale(20, 40); // bar.MapUnit = MapUnits.ws_muMeter; // bar.BarUnit = MapUnits.ws_muMeter; //bar.SetCustomUnit(4,"test","test"); // bar.MapUnit = MapUnits.ws_muCustom; using (var control = new UserControl()) { control.Paint += delegate(object sender, PaintEventArgs e) { // rectangle = new Rectangle(new Point(0, 0), ((Control) sender).Size); bar.DrawTheControl(e.Graphics, rectangle); }; WindowsFormsTestHelper.ShowModal(control); } }
public void ApplyCustomDateTimeFormatYears() { var random = new Random(); var chartView = new ChartView(); var startTime = DateTime.Now; var times = Enumerable.Range(1, 1000).Select(startTime.AddYears).ToArray(); var y = Enumerable.Range(1000, 1000).Select(i => Convert.ToDouble(random.Next(100))).ToArray(); var pointList = new List <Utils.Tuple <DateTime, double> >(); var lineSeries = ChartSeriesFactory.CreateLineSeries(); var chart = chartView.Chart; chart.Series.Add(lineSeries); chartView.DateTimeLabelFormatProvider = new QuarterNavigatableLabelFormatProvider(); for (int i = 0; i < 1000; i++) { pointList.Add(new Tuple <DateTime, double>(times[i], y[i])); } lineSeries.DataSource = pointList; lineSeries.XValuesDataMember = "First"; lineSeries.YValuesDataMember = "Second"; lineSeries.CheckDataSource(); WindowsFormsTestHelper.ShowModal(chartView); }
public void MultipleSeriesChartViaImage() { WindowsFormsTestHelper.ShowModal(new PictureBox { Image = CreateMultipleSeriesChart().Image(300, 300) }); }
public void MultipleSeriesView() { WindowsFormsTestHelper.ShowModal(new ChartView { Chart = CreateMultipleSeriesChart() }); }
public void ChartWithObjectsAsSeriesSource() { IList objects = new ArrayList { new { X = 2.5, Y = 33.3 }, new { X = 0.5, Y = 13.3 } }; // create chart and add function as a data source using object adapter class FunctionSeriesDataSource IChartSeries series = ChartSeriesFactory.CreateLineSeries(); series.DataSource = objects; series.XValuesDataMember = "X"; series.YValuesDataMember = "Y"; var chartView1 = new ChartView(); chartView1.Chart.Series.Add(series); // show form var form = new Form { Width = 600, Height = 100 }; form.Controls.Add(chartView1); WindowsFormsTestHelper.ShowModal(form); }
public void InsertingValuesinTableAreSortedAutomatically() { var x = new Variable <int>("x"); var y = new Variable <int>("y"); y.DefaultValue = -99; var f = new Function { Arguments = { x }, Components = { y } }; f[1] = 1; f[5] = 5; f[10] = 10; f[15] = 15; var tableView = new TableView(); var bindingList = new FunctionBindingList(f) { SynchronizeInvoke = tableView }; tableView.Data = bindingList; WindowsFormsTestHelper.ShowModal(tableView); }
public void BufferAroundLine() { var form = new Form { BackColor = Color.White, Size = new Size(500, 200) }; form.Paint += delegate { Graphics g = form.CreateGraphics(); List <ICoordinate> vertices = new List <ICoordinate>(); vertices.Add(new Coordinate(0, 4)); vertices.Add(new Coordinate(40, 15)); vertices.Add(new Coordinate(50, 50)); vertices.Add(new Coordinate(100, 62)); vertices.Add(new Coordinate(240, 45)); vertices.Add(new Coordinate(350, 5)); IGeometry geometry = new LineString(vertices.ToArray()); g.DrawLines(new Pen(Color.Blue, 1), GetPoints(geometry)); BufferOp bufferOp = new BufferOp(geometry); bufferOp.EndCapStyle = BufferStyle.CapButt; bufferOp.QuadrantSegments = 0; IGeometry bufGeo = bufferOp.GetResultGeometry(5); bufGeo = bufGeo.Union(geometry); g.FillPolygon(new SolidBrush(Color.Pink), GetPoints(bufGeo)); }; WindowsFormsTestHelper.ShowModal(form); }
public void TableSortingAndFilteringCanBeDisabled() { var x = new Variable <int>("x"); var y = new Variable <int>("y"); y.DefaultValue = -99; var f = new Function { Arguments = { x }, Components = { y } }; f[1] = 15; f[5] = 5; f[10] = 1; f[15] = 10; var tableView = new TableView(); var bindingList = new FunctionBindingList(f) { SynchronizeInvoke = tableView }; tableView.Data = bindingList; tableView.AllowColumnSorting(false); tableView.AllowColumnFiltering(false); WindowsFormsTestHelper.ShowModal(tableView); }
public void Bind2DFunctionWith1ComponentAndCheckColumnName() { IFunction function = new Function(); function.Arguments.Add(new Variable <int>("x") { Unit = new Unit("s", "s") }); function.Arguments.Add(new Variable <int>("y") { Unit = new Unit("m", "m") }); function.Components.Add(new Variable <string>("f1") { Unit = new Unit("m/s", "m/s") }); function[0, 0] = new[] { "f1(0,0)", "f2(0,0)" }; function[1, 0] = new[] { "f1(1,0)", "f2(1,0)" }; function[0, 1] = new[] { "f1(0,1)", "f2(0,1)" }; function[1, 1] = new[] { "f1(1,1)", "f2(1,1)" }; var gridView = new DataGridView(); IFunctionBindingList functionBindingList = new FunctionBindingList(function) { SynchronizeInvoke = gridView }; gridView.DataSource = functionBindingList; WindowsFormsTestHelper.ShowModal(gridView); }
public void RefreshShouldHapenFastWhenFunctionDataSourceHasManyChanges() { IFunction function = new Function { Arguments = { new Variable <int>("x") }, Components = { new Variable <int>("f") } }; var values = new int[1000]; for (var i = 0; i < values.Length; i++) { values[i] = i; } // create function binding list before to exclude it when measuring time var functionBindingList = new FunctionBindingList(function); var tableView = new TableView { Data = functionBindingList }; // now do the same when table view is shown Action <Form> onShown = delegate { var stopwatch = new Stopwatch(); stopwatch.Start(); function.SetValues(values, new VariableValueFilter <int>(function.Arguments[0], values)); stopwatch.Stop(); log.DebugFormat("Refreshing grid while inserting values into function took {0}ms", stopwatch.ElapsedMilliseconds); }; WindowsFormsTestHelper.ShowModal(tableView, onShown); }
public void Show() { var view = new SelectFunctionView(); view.Data = new SelectFunctionViewData { CurrentFunction = new Function() { Name = "Aap" }, FunctionType = typeof(Function), SelectableFunctions = new[] { new Function { Name = "Aap" }, new Function { Name = "Noot" }, new Function { Name = "Mies" } } }; WindowsFormsTestHelper.ShowModal(view); }
public void SeriesBandToolView() { var chartView = new ChartView(); var dataTable1 = new DataTable(); var dataTable2 = new DataTable(); dataTable1.Columns.AddRange(new [] { new DataColumn("Y", typeof(double)), new DataColumn("Z", typeof(double)) }); dataTable2.Columns.AddRange(new[] { new DataColumn("Y", typeof(double)), new DataColumn("Z", typeof(double)) }); var ySeries1 = new[] { 0.0, 2.0, 5.0, 10.0, 13.0, 15.0 }; var zSeries1 = new[] { 0.0, 0.0, -10.0, -10.0, 0.0, 0.0 }; var ySeries2 = new[] { 0.0, 5.0, 5.0, 10.0, 10.0, 15.0 }; var zSeries2 = new[] { 1.0, 1.0, -9.0, -9.0, 1.0, 1.0 }; for (int i = 0; i < ySeries1.Length; i++) { var row = dataTable1.NewRow(); row["Y"] = ySeries1[i]; row["Z"] = zSeries1[i]; dataTable1.Rows.Add(row); } for (int i = 0; i < ySeries2.Length; i++) { var row = dataTable2.NewRow(); row["Y"] = ySeries2[i]; row["Z"] = zSeries2[i]; dataTable2.Rows.Add(row); } var series1 = ChartSeriesFactory.CreateLineSeries(); var series2 = ChartSeriesFactory.CreateLineSeries(); series1.DataSource = dataTable1; series1.XValuesDataMember = "Y"; series1.YValuesDataMember = "Z"; series2.DataSource = dataTable2; series2.XValuesDataMember = "Y"; series2.YValuesDataMember = "Z"; chartView.Chart.Series.AddRange(new [] { series1, series2 }); //tool var tool = chartView.NewSeriesBandTool(series1, series2, Color.Yellow, HatchStyle.BackwardDiagonal, Color.Red); chartView.Tools.Add(tool); WindowsFormsTestHelper.ShowModal(chartView); }