private void buttonX1_Click(object sender, EventArgs e) { try { string[] a = new string[2]; a[0] = "ClassId00"; a[1] = "Class_Name"; string[] b = new string[2]; b[0] = "ClassId09"; b[1] = "name"; Datasource Ds = SampleRun.workspace1.Datasources[0]; string name_1 = comboBoxEx2.SelectedItem.ToString(); //图层1 string name_2 = comboBoxEx3.SelectedItem.ToString(); //图层2 DatasetVector dataset = SampleRun.mapControl1.Map.Layers[name_1].Dataset as DatasetVector; //第一数据集 DatasetVector eraseDataset = SampleRun.mapControl1.Map.Layers[name_2].Dataset as DatasetVector; //第二数据集 OverlayAnalystParameter parameter = new OverlayAnalystParameter(); DatasetVectorInfo datasetvectorInfoUpdate = new DatasetVectorInfo(); String DtName = Ds.Datasets.GetAvailableDatasetName("new"); datasetvectorInfoUpdate.Type = dataset.Type; datasetvectorInfoUpdate.Name = DtName; parameter.SourceRetainedFields = a; parameter.OperationRetainedFields = b; DatasetVector exdv = Ds.Datasets.Create(datasetvectorInfoUpdate); bool c = OverlayAnalyst.Union(dataset, eraseDataset, exdv, parameter); SampleRun.layersControl1.Map.Layers.Add(exdv, true); SampleRun.layersControl1.Map.Refresh(); } catch { MessageBox.Show("两图层不在同一坐标系中!"); } }
public void Geometry_ToWKT() { string input = @"{ type: ""Feature"", properties: {}, geometry: { type: ""Polygon"", coordinates: [[[1,1],[1,2],[2,2],[2,1],[1,1]]] } }"; JObject feature = JObject.Parse(input); Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","csv"}, { "inline", "geojson\n'" + feature["geometry"].ToString(Formatting.None) + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string expected = "POLYGON((1 1,1 2,2 2,2 1,1 1))"; Assert.AreEqual(expected, f.Geometry().ToWKT()); }
public void Geometry_ToWKB() { string input = @"{ type: ""Feature"", properties: {}, geometry: { type: ""Polygon"", coordinates: [[[1,1],[1,2],[2,2],[2,1],[1,1]]] } }"; JObject feature = JObject.Parse(input); Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","csv"}, { "inline", "geojson\n'" + feature["geometry"].ToString(Formatting.None) + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string hex = "01030000000100000005000000000000000000f03f000000000000f03f000000000000f03f0000000000000040000000000000004000000000000000400000000000000040000000000000f03f000000000000f03f000000000000f03f"; byte[] expected = Enumerable.Range(0, hex.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); byte[] actual = f.Geometry().ToWKB(); CollectionAssert.AreEqual(expected, actual); }
public Task Upgrade(IVersionContext versionContext) { var databaseConnectionType = new Datasource { Id = "5c289b1d3be42159cc2f0236", CanCache = true, Name = "Database Connection Type", DatabaseId = "", DatasourceType = DatasourceType.Static, Query = "[{\"name\":\"MongoDB\",\"value\":\"mongodb\"},{\"name\":\"SQL Server\",\"value\":\"sqlserver\"}]" }; var appConnectionType = new Datasource { Id = "5c06a15e4cc9a850bca44488", CanCache = true, Name = "Apps List", DatabaseId = Constants.PortalDatabaseId, DatasourceType = DatasourceType.Database, Query = versionContext.ConnectionType == Core.Persistences.ConnectionType.MongoDB ? "{\"apps\":{}}" : (versionContext.ConnectionType == Core.Persistences.ConnectionType.MySQL ? "SELECT `displayName` as name, id as value From `apps`" : "SELECT displayName as name, id as value From apps"), OutputProjection = versionContext.ConnectionType == Core.Persistences.ConnectionType.MongoDB ? "name=displayName;value=_id" : null }; versionContext.InsertData(databaseConnectionType); versionContext.InsertData(appConnectionType); return(Task.CompletedTask); }
public TableForm(Datasource QDS, string tbl, string cmd) { DS = QDS; table = tbl; database = DS.database; if (table != "") { tmptbl = DS.DBschema.D[database].T[table]; orgtbl = DS.DBschema.D[database].T[table]; } command = cmd; InitializeComponent(); if (command.ToString() == "truncate") { tableTab.SelectedTab = sqlPage; } else if (command.ToString() == "drop") { tableTab.SelectedTab = sqlPage; } else if (command.ToString() == "create") { tableTab.SelectedTab = tablePage; } else if (command.ToString() == "alter") { tableTab.SelectedTab = tablePage; } else { tableTab.SelectedTab = tablePage; } }
private void buttonX1_Click(object sender, EventArgs e) { string sp = comboBox1.SelectedItem.ToString(); try { srcDatasource1 = SampleRun.workspace1.Datasources[0]; sourceImg1 = srcDatasource1.Datasets[sp] as DatasetImage; if (sourceImg1 == null) { MessageBox.Show(this, "图层不符条件,无法转换!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { String targetDirectory = @"..\..\SampleData\DataExchange\SitExport"; if (!Directory.Exists(targetDirectory)) { Directory.CreateDirectory(targetDirectory); } String targetFilePath = targetDirectory + @"\SitExport.sit"; this.SetExportSettings(FileType.SIT, targetFilePath); SampleRun.mapControl1.Map.Layers.Clear(); dataExport1.Run(); SampleRun.mapControl1.Map.Layers.Add(sourceImg1, true); SampleRun.mapControl1.Map.ViewEntire(); SampleRun.mapControl1.Map.Refresh(); System.Diagnostics.Process.Start("explorer.exe", "/n,/select, " + targetFilePath); } } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
/// <summary> /// Create a new API interface for ESI with versioned specification. /// </summary> /// <param name="version">Spec version.</param> /// <param name="datasource">Spe datasource.</param> /// <param name="login">EveLogin.</param> /// <param name="client">Optional HttpClient.</param> /// <param name="config">Optional Config.</param> /// <returns></returns> public API CreateEsiVersioned(EsiVersion version, Datasource datasource, ILogin login, HttpClient client = default, ApiConfig config = default) { string baseUrl = "https://esi.evetech.net/"; string specUrl = $"{baseUrl}_{version}/swagger.json?datasource={datasource}".ToLower(); return(Create(specUrl, login, client, config)); }
public void Geometry_ToWKB() { string input = @"{ type: ""Feature"", properties: {}, geometry: { type: ""Polygon"", coordinates: [[[1,1],[1,2],[2,2],[2,1],[1,1]]] } }"; JObject feature = JObject.Parse(input); Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); Dictionary <string, object> options = new Dictionary <string, object>() { { "type", "csv" }, { "inline", "geojson\n'" + feature["geometry"].ToString(Formatting.None) + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string hex = "01030000000100000005000000000000000000f03f000000000000f03f000000000000f03f0000000000000040000000000000004000000000000000400000000000000040000000000000f03f000000000000f03f000000000000f03f"; byte[] expected = Enumerable.Range(0, hex.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); byte[] actual = f.Geometry().ToWKB(); CollectionAssert.AreEqual(expected, actual); }
public void UpdateMapView(string strID) { if (m_workspace.Datasources.Count <= 0) { return; } Datasource datasource = m_workspace.Datasources[0]; for (int ModelIndex = 0; ModelIndex < UserHelper.nDeviceNum; ModelIndex++) { DatasetVector pointDataset = datasource.Datasets[UserHelper.sDeviceName[ModelIndex]] as DatasetVector; Recordset recordSet = null; try { if (pointDataset != null) { recordSet = pointDataset.Query(m_filedName + "='" + strID + "'", CursorType.Dynamic); int recCount = recordSet.RecordCount; if (recCount == 1) { //if (pointColor >= 255) //{ // pointColor = 0; //} pointColor = pointColor == 120 ? 255 : 120; GeoStyle style = new GeoStyle(); style.MarkerSize = new Size2D(8, 8); style.LineColor = Color.FromArgb(0, 0, pointColor, 0); //pointColor += 60; GeoPoint point = recordSet.GetGeometry() as GeoPoint; point.Style = style; int index = m_MapControl.Map.TrackingLayer.IndexOf(strID); if (index >= 0) { m_MapControl.Map.TrackingLayer.Remove(index); } m_MapControl.Map.TrackingLayer.Add(point, strID); //recordSet.Edit(); //recordSet.Update(); //recordSet.Close(); //recordSet.Dispose(); break; } //recordSet.Close(); //recordSet.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } m_MapControl.Map.Refresh(); }
// The AddDatasources method adds Datasource structures to the collection, based on a query defined by input parameters. public void AddDataSources(string SqlWhereClause) { // Get m_identifier indexes outside the loop for better performance int idFld = m_DataSourcesTable.FindField("DataSources_ID"); int sourceFld = m_DataSourcesTable.FindField("Source"); int notesFld = m_DataSourcesTable.FindField("Notes"); // Setup the query IQueryFilter QF = new QueryFilterClass(); QF.WhereClause = SqlWhereClause; // Perform the search, and grab the first returned row ICursor theCursor = m_DataSourcesTable.Search(QF, false); IRow theRow = theCursor.NextRow(); // Loop through the returned rows until you're all done. while (theRow != null) { // Populate a DataSource Structure Datasource aDataSource = new Datasource(); aDataSource.DataSources_ID = theRow.get_Value(idFld).ToString(); aDataSource.Source = theRow.get_Value(sourceFld).ToString(); aDataSource.Notes = theRow.get_Value(notesFld).ToString(); aDataSource.RequiresUpdate = true; // Add the Structure to the dictionary m_dataSourceDictionary.Add(aDataSource.DataSources_ID, aDataSource); // Increment to the next returned DataSource theRow = theCursor.NextRow(); } }
public void AddDataNarrowFormatCsv() { var rnd = new System.Random(); var randomNumber = System.Convert.ToString(rnd.Next(1, 10000)); var time = new Time { Zone = "GMT", Identifier = "time", Format = "YYYY-MM-DD HH:mm:ss" }; var Signal = new Signal { SignalIdentifier = "signal", ValueIdentifier = "value" }; var Field = new Field { Signal = Signal, Time = time }; var datasource = new Datasource { Type = "PI", Host = "https://test.piserver.com/piwebapi", ElementTemplateName = "SampleElementTempalte" }; var ds = new DatastreamRequest { Name = "TestDSPI" + randomNumber, Field = Field, DataSource = datasource }; try { var datastream = _falkonry.CreateDatastream(ds); _datastreams.Add(datastream); Assert.AreEqual(ds.Name, datastream.Name); Assert.AreNotEqual(null, datastream.Id); Assert.AreEqual(ds.Field.Time.Format, datastream.Field.Time.Format); Assert.AreEqual(ds.Field.Time.Identifier, datastream.Field.Time.Identifier); Assert.AreEqual(ds.DataSource.Type, datastream.DataSource.Type); var data = "time, tag, value \n" + "2016-05-05T12:00:00Z, Unit1_current, 12.4 \n 2016-03-01 01:01:01, Unit1_vibration, 20.4"; var options = new SortedDictionary <string, string> { { "timeIdentifier", "time" }, { "timeFormat", "iso_8601" }, { "timeZone", "GMT" }, { "streaming", "true" } }; var inputstatus = _falkonry.AddInput(datastream.Id, data, options); //check data status CheckStatus(inputstatus.Id); } catch (System.Exception exception) { Assert.AreEqual(exception.Message, null, "Cannot add data"); } }
public void Feature_ToJSON() { string input = @"{ type: ""Feature"", properties: {}, geometry: { type: ""Polygon"", coordinates: [[[1,1],[1,2],[2,2],[2,1],[1,1]]] } }"; JObject expected = JObject.Parse(input); Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","csv"}, { "inline", "geojson\n'" + expected["geometry"].ToString(Formatting.None) + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); JObject feature = JObject.Parse(f.ToJSON()); Assert.AreEqual(expected["type"], feature["type"]); Assert.AreEqual(((JObject)expected["properties"]).Count, ((JObject)feature["properties"]).Count); Assert.AreEqual(expected["geometry"]["type"], feature["geometry"]["type"]); JArray coords = (JArray)expected["geometry"]["coordinates"][0]; for (int i = 0; i < coords.Count; i++) { JArray coord1 = (JArray)expected["geometry"]["coordinates"][0][i]; JArray coord2 = (JArray)feature["geometry"]["coordinates"][0][i]; CollectionAssert.AreEquivalent(coord1.ToObject<List<double>>(), coord2.ToObject<List<double>>()); } }
internal static ImportResult ImportShpToDatasource(string filePath, Datasource datasource, string targetTableName) { ImportSettingSHP importSettingSHP = new ImportSettingSHP(); importSettingSHP.IsAttributeIgnored = false; importSettingSHP.IsImportAs3D = false; //设置当同名数据集存在时导入的模式,如果存在名字冲突,则覆盖(Overwrite) importSettingSHP.ImportMode = ImportMode.Overwrite; //设置需要导入的数据路径信息 importSettingSHP.SourceFilePath = filePath; //设置需要导入的数据编码类型,因为有中文字段,所以用ASCII编码 importSettingSHP.SourceFileCharset = Charset.ANSI; //设置要导入的目标数据源 importSettingSHP.TargetDatasource = datasource; //设置目标数据集名称 importSettingSHP.TargetDatasetName = targetTableName; importSettingSHP.TargetEncodeType = EncodeType.None; DataImport importer = new DataImport(); importer.ImportSettings.Add(importSettingSHP); //数据导入mysql数据库 ImportResult result = importer.Run(); return(result); }
public void CreatePiDatastreamTest() { var time = new Time(); time.Zone = "Asia/Kolkata"; time.Identifier = "time"; time.Format = "iso_8601"; var datasource = new Datasource(); datasource.Type = "PI"; datasource.Host = "https://test.piserver.com/piwebapi"; datasource.ElementTemplateName = "SampleElementTempalte"; var rnd = new System.Random(); var randomNumber = System.Convert.ToString(rnd.Next(1, 10000)); var ds = new DatastreamRequest(); ds.Name = "TestDatastreamStreaming" + randomNumber; var Field = new Field(); var Signal = new Signal(); Signal.ValueIdentifier = "value"; Signal.SignalIdentifier = "signal"; Field.Signal = Signal; Field.Time = time; ds.Field = Field; ds.DataSource = datasource; try { var datastream = _falkonry.CreateDatastream(ds); _datastreams.Add(datastream); Assert.AreEqual(ds.Name, datastream.Name); Assert.AreNotEqual(null, datastream.Id); Assert.AreEqual(ds.Field.Time.Format, datastream.Field.Time.Format); Assert.AreEqual(ds.Field.Time.Identifier, datastream.Field.Time.Identifier); Assert.AreEqual(ds.DataSource.Type, datastream.DataSource.Type); var folder = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); var path = folder + "/../../resources/addData.csv"; var bytes = File.ReadAllBytes(path); var options = new SortedDictionary <string, string>(); options.Add("timeIdentifier", "time"); options.Add("timeFormat", "YYYY-MM-DD HH:mm:ss"); options.Add("timeZone", "GMT"); options.Add("streaming", "false"); options.Add("hasMoreData", "false"); var inputstatus = _falkonry.AddInputStream(datastream.Id, bytes, options); //check data status CheckStatus(inputstatus.Id); } catch (System.Exception exception) { Assert.AreEqual(exception.Message, null, "Cannot add data"); } }
public void AddDataNarrowFormatCsv() { var rnd = new System.Random(); var randomNumber = System.Convert.ToString(rnd.Next(1, 10000)); var time = new Time(); time.Zone = "GMT"; time.Identifier = "time"; time.Format = "YYYY-MM-DD HH:mm:ss"; var Signal = new Signal(); Signal.SignalIdentifier = "signal"; Signal.ValueIdentifier = "value"; var Field = new Field(); Field.Signal = Signal; Field.Time = time; var datasource = new Datasource(); datasource.Type = "PI"; datasource.Host = "https://test.piserver.com/piwebapi"; datasource.ElementTemplateName = "SampleElementTempalte"; var ds = new DatastreamRequest(); ds.Name = "TestDSPI" + randomNumber; ds.Field = Field; ds.DataSource = datasource; Datastream datastream = new Datastream(); try { datastream = _falkonry.CreateDatastream(ds); _datastreams.Add(datastream); Assert.AreEqual(ds.Name, datastream.Name); Assert.AreNotEqual(null, datastream.Id); Assert.AreEqual(ds.Field.Time.Format, datastream.Field.Time.Format); Assert.AreEqual(ds.Field.Time.Identifier, datastream.Field.Time.Identifier); Assert.AreEqual(ds.DataSource.Type, datastream.DataSource.Type); Assert.AreEqual(ds.Name, datastream.Field.EntityName); var data = "time,signal,value\n" + "2016-05-05 12:00:00,current,12.4\n2016-03-01 01:01:01,vibration,20.4"; var options = new SortedDictionary <string, string>(); options.Add("streaming", "false"); options.Add("hasMoreData", "false"); var inputstatus = _falkonry.AddInput(datastream.Id, data, options); //check data status CheckStatus(inputstatus.Id); } catch (System.Exception exception) { Assert.AreEqual(null, exception.Message, "Cannot add data"); } }
public gk061() { InitializeComponent(); #region 添加地图 workspace1 = new SuperMap.Data.Workspace(); workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo()); importDatasource = workspace1.Datasources[gkfqd.Common.Tool.GetWorkspaceDataDatasources()]; mapLayoutControl1.MapLayout.Workspace = workspace1; datasetVector = importDatasource.Datasets["gkfqd"] as DatasetVector; mapLayoutControl1.IsHorizontalScrollbarVisible = true; mapLayoutControl1.IsVerticalScrollbarVisible = true; AddMap("temp"); mapLayoutControl1.MapLayout.Zoom(4); #endregion //添加系统默认打印服务 foreach (String printer in System.Drawing.Printing.PrinterSettings.InstalledPrinters) { toolStripComboBox2.Items.Add(printer); } toolStripComboBox2.SelectedIndex = 0; //不显示dataGridView1最后一行 // dataGridView1.AllowUserToAddRows = false; comboBox1.SelectedIndex = 0; //区县comboBox列表加载 LoadComboBox(); }
// The AddDatasources method adds Datasource structures to the collection, based on a query defined by input parameters. public void AddDataSources(string SqlWhereClause) { // Get m_identifier indexes outside the loop for better performance int idFld = m_DataSourcesTable.FindField("DataSources_ID"); int sourceFld = m_DataSourcesTable.FindField("Source"); int notesFld = m_DataSourcesTable.FindField("Notes"); // Setup the query IQueryFilter QF = new QueryFilterClass(); QF.WhereClause = SqlWhereClause; // Perform the search, and grab the first returned row ICursor theCursor = m_DataSourcesTable.Search(QF,false); IRow theRow = theCursor.NextRow(); // Loop through the returned rows until you're all done. while (theRow != null) { // Populate a DataSource Structure Datasource aDataSource = new Datasource(); aDataSource.DataSources_ID = theRow.get_Value(idFld).ToString(); aDataSource.Source = theRow.get_Value(sourceFld).ToString(); aDataSource.Notes = theRow.get_Value(notesFld).ToString(); aDataSource.RequiresUpdate = true; // Add the Structure to the dictionary m_dataSourceDictionary.Add(aDataSource.DataSources_ID, aDataSource); // Increment to the next returned DataSource theRow = theCursor.NextRow(); } }
private void buttonItem14_Click(object sender, EventArgs e) { openFileDialog1.Filter = "smwu 工作空间文件(*.smwu)|*.smwu|smw 工作空间文件(*.smw)|*.smw"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { mapControl1.Map.Close(); mapControl2.Map.Close(); workspace1.Close(); mapControl1.Map.Refresh(); mapControl2.Map.Refresh(); String fileName = openFileDialog1.FileName; WorkspaceConnectionInfo connectionInfo = new WorkspaceConnectionInfo(fileName); workspace1.Open(connectionInfo); Program.resources = workspace1.Resources; workspaceControl1.WorkspaceTree.Workspace = workspace1; mapControl1.Map.Workspace = workspace1; mapControl2.Map.Workspace = workspace1; sceneControl1.Scene.Workspace = workspace1; mapLayoutControl1.MapLayout.Workspace = workspace1; m_datasource = workspace1.Datasources[0]; if (workspace1.Maps.Count == 0) { MessageBox.Show("当前工作空间中不存在地图!"); } m_sampleRun = new SampleRun(workspaceControl1, layersControl1, mapControl1, mapControl2, mapLayoutControl1, toolStripStatusLabel2, textBoxResult, toolStripStatusLabel3, sceneControl1); m_sampleRun.AddDatasetToScene(m_datasource.Datasets[0].Name); m_sampleRun.RegisterEvents(false); } }
public void ServerForwardsErrorToClientIfExceptionIsThrownInRequestRealTimeData() { var ds = new Datasource { ID = 1, Name = "TestDS" }; var inst = new Instrument { ID = 1, Datasource = ds, DatasourceID = 1, Symbol = "SPY", Type = InstrumentType.Stock }; var req = new RealTimeDataRequest(inst, BarSize.FiveSeconds, false); string error = null; int? requestId = null; _client.Error += (s, e) => { error = e.ErrorMessage; requestId = e.RequestID; }; _brokerMock.Setup(x => x.RequestRealTimeData(It.IsAny <RealTimeDataRequest>())).Throws(new Exception("testerror")); _client.RequestRealTimeData(req); Thread.Sleep(DefaultDelayInMilliseconds); Assert.IsTrue(!string.IsNullOrEmpty(error)); Assert.IsTrue(requestId.HasValue); }
void DeleteCheckedItems(object sender, EventArgs args) { var numChecked = CheckedDocuments.Count(); if (numChecked == 0) { return; } var prompt = String.Format("Are you sure you want to remove the {0} checked-off item{1}?", numChecked, numChecked == 1 ? String.Empty : "s"); var alert = new UIAlertView("Remove Completed Items?", prompt, null, "Cancel", "Remove"); alert.Dismissed += (alertView, e) => { if (e.ButtonIndex == 0) { return; } try { Datasource.DeleteDocuments(CheckedDocuments); } catch (Exception ex) { ShowErrorAlert("Unabled to delete checked documents", ex); } }; alert.Show(); }
protected override async Task _init() { RecordSet layer = _layer as RecordSet; symbology = layer.Properties.Units; Datasource ds = await Datasource.LoadAsync(layer.Source); features = new List <DMesh3>(); for (int i = 0; i < ds.meshes.Length; i++) { DMesh3 mesh = await ds.GetMeshAsync(i); mesh.RemoveMetadata("properties"); mesh.AttachMetadata("properties", new Dictionary <string, object> { { "Name", ds.meshes[i] } }); if (layer.ContainsKey("Crs") && layer.Crs != null) { mesh.RemoveMetadata("CRS"); mesh.AttachMetadata("CRS", layer.Crs); } ; features.Add(mesh); } return; }
private void queryerToolStripMenuItem_Click(object sender, EventArgs e) { using (var rform = new ConnectForm()) { var result = rform.ShowDialog(); if (result == DialogResult.OK) { string conStr = rform.conStr; string conName = rform.connectionName; Datasource QueryerDS = new Datasource(conStr, conName); if (QueryerDS.isConnected() == true) { QueryerForm QueryerQ = new QueryerForm(QueryerDS, "mid"); if (QueryerQS != null) { QueryerQ.index = QueryerQS.Length; } if (QueryerADS != null) { QueryerDS.index = QueryerADS.Length; } QueryerQ.nameindex = "Queryer" + QueryerQ.index; QueryerQ.MdiParent = this; QueryerQ.Show(); QueryerQ.Focus(); QueryerQS = QueryerQS.AddItemToArray(QueryerQ); QueryerADS = QueryerADS.AddItemToArray(QueryerDS); } } } }
public async Task <bool> Remove(TValue datasourceItemToDelete) { if (datasourceItemToDelete == null) { return(false); } var eventItemsToRemove = new List <TValue>(); //Find all the tree items that need to be removed var treeItemToRemove = FindTreeItem(datasourceItemToDelete); //This list includes the item to delete as well. var treeItemsToRemove = FindAllTreeItemChildren(treeItemToRemove); //Remove the child items from the datasource and treeItems foreach (var treeitem in treeItemsToRemove) { //Remove the child from the parent treeitem. DelinkTreeItemFromParent(treeitem); _treeItems.Remove(treeitem); //Remove the item from Original Datasource var childItemToRemove = FindObjectFromDatasource(treeitem); eventItemsToRemove.Add(childItemToRemove); Datasource.Remove(childItemToRemove); } await OnItemsRemoved.InvokeAsync(eventItemsToRemove); await NotifyDatasourceChanged(); Console.WriteLine($"Successfully removed {treeItemToRemove.Label}"); return(true); }
public void openQueryer(string conectionString, string conName) { try { Datasource QueryerDS = new Datasource(conectionString, conName); if (QueryerDS.isConnected() == true) { QueryerForm QueryerQ = new QueryerForm(QueryerDS, "mid"); if (QueryerQS != null) { QueryerQ.index = QueryerQS.Length; } if (QueryerADS != null) { QueryerDS.index = QueryerADS.Length; } QueryerQ.nameindex = "Queryer" + QueryerQ.index; QueryerQ.MdiParent = this; QueryerQ.Show(); QueryerQ.Focus(); QueryerQS = QueryerQS.AddItemToArray(QueryerQ); QueryerADS = QueryerADS.AddItemToArray(QueryerDS); } } catch (Exception err) { errorLog(System.Reflection.MethodBase.GetCurrentMethod().Name, err); } }
public void UpdateDataSource(DatabaseData srcDatabase, DsDef updatedDsDef, DsDef originalDsDef) { RrdDb database = null; try { database = new RrdDb(srcDatabase.Definition.Path, false); Datasource datasource = database.getDatasource(originalDsDef.getDsName()); if (datasource == null) { throw new ArgumentException(updatedDsDef.getDsName() + " datasource don't exist"); } if (datasource.DsName != updatedDsDef.DsName) { datasource.setDsName(updatedDsDef.getDsName()); } datasource.setDsType(updatedDsDef.getDsType()); datasource.setHeartbeat(updatedDsDef.getHeartbeat()); datasource.setMaxValue(updatedDsDef.getMaxValue(), true); datasource.setMinValue(updatedDsDef.getMinValue(), true); } catch (FileNotFoundException ex) { Logger.Error("Update datasource failed", ex); throw new ApplicationException("Can't update datasource until database saved!", ex); } finally { if (database != null) { database.close(); } } }
void DeleteCheckedItems(object sender, EventArgs args) { var numChecked = CheckedDocuments.Count(); if (numChecked == 0) { return; } var prompt = String.Format("Are you sure you want to remove the {0} checked-off item{1}?", numChecked, numChecked == 1 ? String.Empty : "s"); var alert = new UIAlertView("Remove Completed Items?", prompt, null, "Cancel", "Remove"); alert.Dismissed += (alertView, e) => { if (e.ButtonIndex == 0) { return; } NSError error; var success = Datasource.DeleteDocuments(CheckedDocuments.ToArray(), out error); if (!success) { ShowErrorAlert(error.Description); } }; alert.Show(); }
public void Geometry_ToWKT() { string input = @"{ type: ""Feature"", properties: {}, geometry: { type: ""Polygon"", coordinates: [[[1,1],[1,2],[2,2],[2,1],[1,1]]] } }"; JObject feature = JObject.Parse(input); Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); Dictionary <string, object> options = new Dictionary <string, object>() { { "type", "csv" }, { "inline", "geojson\n'" + feature["geometry"].ToString(Formatting.None) + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string expected = "POLYGON((1 1,1 2,2 2,2 1,1 1))"; Assert.AreEqual(expected, f.Geometry().ToWKT()); }
private void LoadMapFromDatasource() { showMapWorkspace = new Workspace(); //Memory数据源 DatasourceConnectionInfo memInfo = new DatasourceConnectionInfo(); //设置数据源连接的引擎类型 memInfo.EngineType = EngineType.Memory; memInfo.Alias = "fdgdfgd"; memInfo.Server = "tyjyutjyu"; Datasource memDatasource = showMapWorkspace.Datasources.Create(memInfo); String sourceFilePath = $"{baseFilePath}\\{fileList[0]}.shp"; var r = ImportShpToMemory(sourceFilePath, memDatasource); showMapControl = new MapControl(); showMapControl.Action = SuperMap.UI.Action.Pan; //必须设置 showMapControl.Map.Workspace = showMapWorkspace; //添加数据集到地图控件 showMapControl.Map.Layers.Add(memDatasource.Datasets[0], true); hostMapControl.Child = showMapControl; }
/// <summary> /// 打开需要的工作空间文件及地图 /// </summary> private void Initialize() { try { //打开工作空间及地图 // WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo(@"..\..\SampleData\City\Changchun.smwu"); //WorkspaceConnectionInfo conInfo = new WorkspaceConnectionInfo() { Type = WorkspaceType.Oracle, Server = "ORCL", Database = "", Name = "workspace", User = "******", Password = "******" }; //m_workspace.Open(conInfo); //m_dataset = m_workspace.Datasources[0].Datasets["ClipResult"] as DatasetVector; //mapControl1.Map.Layers.Add(m_dataset, true); //mapControl1.Map.Refresh(); Workspace x_workspace = new Workspace(); WorkspaceConnectionInfo wci = new WorkspaceConnectionInfo() { Type = WorkspaceType.Oracle, Server = "ORCL", Database = "", Name = "workspace", User = "******", Password = "******" }; x_workspace.Open(wci); importDatasource = x_workspace.Datasources["ORCL_gkfqd"]; importResultShp = importDatasource.Datasets["ClipResult"] as DatasetVector; mapControl1.Map.Workspace = x_workspace; mapControl1.Map.Layers.Clear(); mapControl1.Map.Layers.Add(importResultShp, true); mapControl1.Map.ViewEntire(); mapControl1.Map.Refresh(); } catch (Exception ex) { Trace.WriteLine(ex.Message); } }
public static void UpdateSqlDatabaseConnectionString(Guid WorkspaceId, string DatasetId, string Server, string Database) { var pbiClient = TokenManager.GetPowerBiClient(requiredScopes); Datasource targetDatasource = pbiClient.Datasets.GetDatasourcesInGroup(WorkspaceId, DatasetId).Value.First(); string currentServer = targetDatasource.ConnectionDetails.Server; string currentDatabase = targetDatasource.ConnectionDetails.Database; if (Server.ToLower().Equals(currentServer.ToLower()) && Database.ToLower().Equals(currentDatabase.ToLower())) { Console.WriteLine("New server and database name are the same as the old names"); return; } DatasourceConnectionDetails connectionDetails = new DatasourceConnectionDetails { Database = Database, Server = Server }; UpdateDatasourceConnectionRequest updateConnRequest = new UpdateDatasourceConnectionRequest { DatasourceSelector = targetDatasource, ConnectionDetails = connectionDetails }; UpdateDatasourcesRequest updateDatasourcesRequest = new UpdateDatasourcesRequest(updateConnRequest); pbiClient.Datasets.UpdateDatasourcesInGroup(WorkspaceId, DatasetId, updateDatasourcesRequest); }
private void ODBCOkBtn_Click(object sender, EventArgs e) { buildConnectionString(); TestConnectionBtn.ImageIndex = 0; connectionName = ConnectionNameBox.Text.ToString(); Datasource TestDS = new Datasource(conStr, connectionName); if (TestDS.isConnected() == true) { TestConnectionBtn.ImageIndex = 1; TestDS.disconnect(); if (SaveChk.Checked == true) { saveConnection(); } this.DialogResult = DialogResult.OK; this.Close(); } else { errorTxt.Text = TestDS.error.ToString(); TestConnectionBtn.ImageIndex = 2; TestDS.disconnect(); } }
public void ServerReturnsErrorToClientIfNoInstrumentIdIsSet() { var ds = new Datasource { ID = 1, Name = "TestDS" }; var inst = new Instrument { ID = null, Datasource = ds, DatasourceID = 1, Symbol = "SPY", Type = InstrumentType.Stock }; var req = new RealTimeDataRequest(inst, BarSize.FiveSeconds, false); string error = null; int? requestId = null; _client.Error += (s, e) => { error = e.ErrorMessage; requestId = e.RequestID; }; _client.RequestRealTimeData(req); Thread.Sleep(DefaultDelayInMilliseconds); Assert.IsTrue(!string.IsNullOrEmpty(error)); Assert.IsTrue(requestId.HasValue); }
public void CreateDataSource(Datasource datasource, string parent) { var dataSourceDefinition = new DataSourceDefinition { CredentialRetrieval = GetSSRSCredentialRetrievalTypeFromEnum( datasource.CredentialRetrievalType), ConnectString = datasource.ConnectionString, Enabled = datasource.Enabled, Extension = datasource.Extension, Prompt = datasource.Prompt }; if (dataSourceDefinition.CredentialRetrieval == CredentialRetrievalEnum.Store) { dataSourceDefinition.UserName = datasource.Username; dataSourceDefinition.Password = datasource.Password; } dataSourceDefinition.ImpersonateUser = datasource.SetExecutionContext; dataSourceDefinition.WindowsCredentials = datasource.UsePromptedCredentialsAsWindowsCredentials || datasource.UseStoredCredentialsAsWindowsCredentials; if (!datasource.Name.EndsWith(".rsds")) { datasource.Name += ".rsds"; } webserviceProxy.CreateDataSource(datasource.Name, parent, true, dataSourceDefinition, null); }
public AddInstrumentQuandlWindow() { DataContext = this; AddedInstruments = new List <Instrument>(); Exchanges = new ObservableCollection <Exchange>(); Instruments = new ObservableCollection <Instrument>(); InitializeComponent(); ExchangeComboBox.ItemsSource = Exchanges; PrimaryExchangeComboBox.ItemsSource = Exchanges; using (var entityContext = new MyDBContext()) { _thisDS = entityContext.Datasources.First(x => x.Name == "Quandl"); foreach (Exchange e in entityContext.Exchanges.Include(x => x.Sessions)) { Exchanges.Add(e); } } ShowDialog(); }
public void Geometry_ToJSON() { string expected = @"{""type"":""Polygon"",""coordinates"":[[[1,1],[1,2],[2,2],[2,1],[1,1]]]}"; Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); var options = new Dictionary<string, object>() { { "type","csv"}, { "inline", "geojson\n'" + expected + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string actual = f.Geometry().ToJSON(); Assert.AreEqual(expected, actual); }
public void Datasource_Creation() { Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","shape"}, { "file", @".\data\world_merc.shp" } }; Datasource d = new Datasource(options); string expectedType = "vector"; string expectedEncoding = "utf-8"; string expectedGeomType = "polygon"; Dictionary<string, string> expectedFields = new Dictionary<string, string>() { {"FIPS", "String"}, {"ISO2", "String"}, {"ISO3", "String"}, {"UN", "Number"}, {"NAME", "String"}, {"AREA", "Number"}, {"POP2005", "Number"}, {"REGION", "Number"}, {"SUBREGION", "Number"}, {"LON", "Number"}, {"LAT", "Number"} }; double[] expectedExtent = new double[] { -20037508.342789248, -8283343.6938826973, 20037508.342789244, 18365151.363070473 }; Dictionary<string, object> p = new Dictionary<string, object>(d.Paramemters()); CollectionAssert.AreEquivalent(p, options); double[] e = d.Extent(); CollectionAssert.AreEqual(e, expectedExtent); IDictionary<string, object> desc = d.Describe(); Assert.AreEqual(desc["type"], expectedType); Assert.AreEqual(desc["encoding"], expectedEncoding); Assert.AreEqual(desc["geometry_type"], expectedGeomType); CollectionAssert.AreEquivalent((Dictionary<string, string>)desc["fields"], expectedFields); }
public override void Run() { //To do your work. //获取当前应用程序中被操作的数据集数组 currentDataset = SuperMap.Desktop.Application.ActiveDatasets[0]; currentDatasource = SuperMap.Desktop.Application.ActiveDatasources[0]; //在地图窗口中输出被操作的数据集的名称 this.MyLog(currentDataset.Name); // Routes Workspace workspace=SuperMap.Desktop.Application.ActiveApplication.Workspace; DatasetVector routesDataset = workspace.Datasources[this.datasourceName].Datasets[this.datasetName] as DatasetVector; // 数据处理 DataHandling(currentDataset, routesDataset); //creat new dataset //CopyToNewDataset(vehicleList); }
public void Layer_Describe() { Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","shape"}, { "file", @".\data\world_merc.shp" } }; Datasource ds = new Datasource(options); Layer l = new Layer("layer", "+init=epsg:4326"); l.Datasource = ds; IDictionary<string, object> d = l.Describe(); Assert.AreEqual((string)d["name"], "layer"); Assert.AreEqual((string)d["srs"], "+init=epsg:4326"); CollectionAssert.AreEquivalent(((List<string>)d["styles"]), new List<string>()); CollectionAssert.AreEquivalent((Dictionary<string, object>)d["datasource"], options); }
private void UpdateRow(Datasource.dsData.ActivityCategoryRow row) { try { gridViewMain.ShowLoadingPanel(); row.EndEdit(); int effected = activityCategoryTableAdapter.Update(row); if (effected == 0) { MessageBox.Show("No data saved ...", "information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } if (gridViewMain.LoadingPanelVisible) gridViewMain.HideLoadingPanel(); }
// 新建要素集 public DatasetVector DatasetVectorInfoSample(Datasource datasource, string tableName) { try { this.tempDatasetName = datasource.Datasets.GetAvailableDatasetName(tableName); // 设置矢量数据集的信息 DatasetVectorInfo datasetVectorInfo = new DatasetVectorInfo(); datasetVectorInfo.Type = DatasetType.Point; datasetVectorInfo.IsFileCache = true; datasetVectorInfo.Name = tempDatasetName; this.MyLog("矢量数据集的信息为:" + datasetVectorInfo.ToString()); // 创建矢量数据集 DatasetVector ds = datasource.Datasets.Create(datasetVectorInfo); //add field info FieldInfos fields = ds.FieldInfos; FieldInfo fieldInfo = new FieldInfo("ID", FieldType.Text); fields.Add(fieldInfo); fieldInfo = new FieldInfo("NAME", FieldType.Text); fields.Add(fieldInfo); fieldInfo = new FieldInfo("XBH", FieldType.Text); fields.Add(fieldInfo); fieldInfo = new FieldInfo("X", FieldType.Double); fields.Add(fieldInfo); fieldInfo = new FieldInfo("Y", FieldType.Double); fields.Add(fieldInfo); ds.Close(); return ds; } catch (Exception) { return null; } }
public void Featureset_Creation() { Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input")); Dictionary<string, object> options = new Dictionary<string, object>() { { "type","shape"}, { "file", @".\data\world_merc.shp" } }; Datasource d = new Datasource(options); Featureset fs = d.Featureset(); Feature feature = fs.Next(); Dictionary<string, object> attr = new Dictionary<string, object>(feature.Attributes()); Dictionary<string, object> expectedAttr = new Dictionary<string, object>() { {"AREA", 44L}, {"FIPS", "AC"}, {"ISO2", "AG"}, {"ISO3", "ATG"}, {"LAT", 17.078}, {"LON", -61.783}, {"NAME", "Antigua and Barbuda"}, {"POP2005", 83039L}, {"REGION", 19L}, {"SUBREGION", 29L}, {"UN", 28L} }; CollectionAssert.AreEquivalent(attr, expectedAttr); int count = 1; while (fs.Next() != null) { count++; } Assert.AreEqual(count, 245); }
public Group(string connectionString, BTSS.Common.Core.DataProvider provider) { datasource = new Datasource(connectionString,provider); }
internal static IReadItemDAL GetReadItem(Datasource datasource) { return new ReadItemRepository(datasource); }
private void OpCode_Nav_Cat(Datasource.Exe_Activity actv) { geckoWB.DocumentCompleted += geckoWB_OpCode_Nav_Cat_DocumentCompleted; geckoWB.Tag = actv; AddLog("Navigate To Cat: " + actv.ActivityCategory, false); geckoWB.Invoke(new MethodInvoker(() => { geckoWB.Navigate(actv.ActivityCategory); })); }
private void OpCode_Nav_CL(Datasource.Exe_Activity actv) { geckoWB.DocumentCompleted += geckoWB_OpCode_Nav_CL_DocumentCompleted; geckoWB.Tag = actv; AddLog("Navigate to CL", false); geckoWB.Invoke(new MethodInvoker(() => { geckoWB.Navigate(actv.Cl_URL); })); }
private void OpCode_Clean_Agent(Datasource.Exe_Activity actv) { //Delete All Cookies this.Invoke(new MethodInvoker(() => { nsICookieManager CookieMan; CookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1"); CookieMan = Xpcom.QueryInterface<nsICookieManager>(CookieMan); CookieMan.RemoveAll(); AddLog("Cookie Cleared", false); //Change User Agent Gecko.GeckoPreferences.User["general.useragent.override"] = actv.Agent; })); AddLog("Agent Changed", false); Ex_Start(); }
private void OpCode_Login(Datasource.Exe_Activity actv) { geckoWB.Invoke(new MethodInvoker(() => { geckoWB.DocumentCompleted += geckoWB_OpCode_Login_DocumentCompleted; geckoWB.Tag = actv; actv.OpCode_Status = "NavToLogin"; AddLog("Navigate To Login...", false); geckoWB.Invoke(new MethodInvoker(() => { geckoWB.Navigate(actv.Cl_lOGIN); })); })); }
public UnityOfWork(Datasource datasource, ICategoryDAL categoryDal, IReadItemDAL readItemDal) { this.Datasource = datasource; this.Category = categoryDal; this.ReadItem = readItem; }
// The UpdateDataSource method takes a Datasource structure as a parameter. It looks for the particular Datasource in the collection // and replaces it in the collection. public void UpdateDataSource(Datasource theDataSource) { // Try to remove the Datasource in the collection - If the try fails, then the thing wasn't there in the first place try { m_dataSourceDictionary.Remove(theDataSource.DataSources_ID); } catch { } // Add the new DataSource to the collection. Note: the update is not acutally saved until calling the SaveDataSources function theDataSource.RequiresUpdate = true; m_dataSourceDictionary.Add(theDataSource.DataSources_ID, theDataSource); }
public void Map_QueryMapPoint_MultipleLayers() { Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "shape.input")); Map m = new Map(256, 256); m.Load(@".\data\test.xml"); Layer l = new Layer("world2"); Datasource d = new Datasource( new Dictionary<string, object>() { { "type","shape"}, { "file", @".\data\world_merc.shp" } } ); l.Datasource = d; m.AddLayer(l); m.ZoomAll(); IEnumerable<MapQueryResult> r; //query single layer r = m.QueryMapPoint(55, 130, "world2"); Assert.AreEqual(r.Count(), 1); MapQueryResult mqr = r.ToList()[0]; Assert.AreEqual(mqr.Layer, "world2"); //query all r = m.QueryMapPoint(55, 130); Assert.AreEqual(r.Count(), 2); MapQueryResult mqr1 = r.ToList()[0]; Assert.AreEqual(mqr1.Layer, "world"); MapQueryResult mqr2 = r.ToList()[1]; Assert.AreEqual(mqr2.Layer, "world2"); }
public void ProjectConverTest(string prjRef, Datasource dc) { try { System.Windows.Forms. Application.DoEvents(); string name = ""; //Datasource dc = wps.Datasources[UDBname]; PrjCoordSys prj = new PrjCoordSys(); prj.FromFile(prjRef, PrjFileType.SuperMap); for (int i = 1; i <= dc.Datasets.Count; i++) { name = "time" + i.ToString(); try { Dataset dset = dc.Datasets[name]; dset = CoordSysTranslator.Convert(dset, prj, dset.Datasource, name + "_", new CoordSysTransParameter(), CoordSysTransMethod.GeocentricTranslation); dset.Datasource.Datasets.Delete(name); dset.Datasource.CopyDataset(dset, name, dset.EncodeType); dset.Datasource.Datasets.Delete(name + "_"); //wps.Save(); } catch { continue; } } //wps.Dispose(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
internal static UnityOfWork GetUnityOfWork(Datasource datasource) { return new UnityOfWork(datasource); }
// The NewDatasource method creates a new, blank Datasource Structure with a new ID. // Other parameters are provided by the function call. // Returns the ID of the new DataSource public string NewDataSource(string Source, string Notes) { // Create a Datasource structure Datasource newDataSource = new Datasource(); // Attribute the Datasource structure sysInfo SysInfoTable = new sysInfo(m_theWorkspace); newDataSource.DataSources_ID = SysInfoTable.ProjAbbr + ".DataSources." + SysInfoTable.GetNextIdValue("DataSources"); newDataSource.Source = Source; newDataSource.Notes = Notes; newDataSource.RequiresUpdate = false; // Add the Datasource to the collection m_dataSourceDictionary.Add(newDataSource.DataSources_ID, newDataSource); return newDataSource.DataSources_ID; }
internal static ICategoryDAL GetCategory(Datasource datasource) { return new CategoryRepository(datasource); }
private void AddDatasource(Datasource datasource) { Datasources.TryAdd(datasource.Id, datasource); //DatasourceLookup.TryAdd(datasource.Name.ToLower(), datasource); }
private void OpCode_Wait(Datasource.Exe_Activity actv) { AddLog("Wait" + actv.Wait, false); geckoWB.Tag = actv; System.Threading.Thread.Sleep(actv.Wait); Ex_Start(); }
public void Geometry_ToJSON_ProjTransform() { string expected = @"{""type"":""Polygon"",""coordinates"":[[[1,1],[1,2],[2,2],[2,1],[1,1]]]}"; Mapnik.RegisterDatasource(Path.Combine(Mapnik.Paths["InputPlugins"], "csv.input")); var options = new Dictionary<string, object>() { { "type","csv"}, { "inline", "geojson\n'" + expected + "'" } }; Datasource ds = new Datasource(options); Feature f = ds.Featureset().Next(); string actual = f.Geometry().ToJSON(); Assert.AreEqual(expected, actual); Projection src = new Projection("+init=epsg:4326"); Projection dest = new Projection("+init=epsg:3857"); ProjTransform tran = new ProjTransform(src, dest); string transformed = f.Geometry().ToJSON(tran); Assert.AreNotEqual(expected, transformed); }
public UnityOfWork(Datasource datasource) { this.Datasource = datasource; }
private void OpCode_Nav_View(Datasource.Exe_Activity actv) { geckoWB.DocumentCompleted += geckoWB_OpCode_Nav_View_DocumentCompleted; geckoWB.Tag = actv; AddLog("Navigate To View: " + actv.Link, false); geckoWB.Invoke(new MethodInvoker(() => { geckoWB.Navigate(actv.Link); })); }
private void OpCode_Proxy(Datasource.Exe_Activity actv) { if ((bool)tsPorxy.EditValue == false) { Core.HMA.ChangeIP(); AddLog("Changing IP ...", false); System.Threading.Thread.Sleep(10000); while (Core.HMA.Status() == Core.HMA.HMA_State.Not_Connected) { AddLog("Waiting Get New IP", false); System.Threading.Thread.Sleep(5000); Application.DoEvents(); } } else { if (_pxy_Off > dsData.Proxy.Count) _pxy_Off = 0; string[] proxy = dsData.Proxy[_pxy_Off].IP.Split(':'); ChangeProxy(proxy[0], Convert.ToInt32(proxy[1])); _pxy_Off++; } AddLog("Test New IP", false); geckoWB.Tag = actv; geckoWB.DocumentCompleted += geckoWB_OpCode_Proxy_DocumentCompleted; geckoWB.Invoke(new MethodInvoker(() => { geckoWB.Navigate(actv.Cl_URL); })); }