public FdoJoinPresenter(IFdoJoinView view, IFdoConnectionManager connMgr, TaskManager taskMgr) { _view = view; _view.JoinTypes = Enum.GetValues(typeof(FdoJoinType)); _connMgr = connMgr; _taskMgr = taskMgr; }
public bool Connect() { if (string.IsNullOrEmpty(_view.ConnectionName)) { _view.ShowMessage(null, "Name required"); return(false); } FdoConnection conn = new FdoConnection("OSGeo.OGR", _view.BuilderObject.ToConnectionString()); try { if (conn.Open() == FdoConnectionState.Open) { IFdoConnectionManager mgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); mgr.AddConnection(_view.ConnectionName, conn); return(true); } } catch (FdoException ex) { _view.ShowError(ex); } return(false); }
public bool Connect() { var builder = new System.Data.Common.DbConnectionStringBuilder(); builder["Username"] = _view.Username; builder["Password"] = _view.Password; builder["Service"] = _view.Service; if (!string.IsNullOrEmpty(_view.OracleSchema)) { builder["OracleSchema"] = _view.OracleSchema; } if (!string.IsNullOrEmpty(_view.KingFdoClass)) { builder["KingFdoClass"] = _view.KingFdoClass; } if (!string.IsNullOrEmpty(_view.SdeSchema)) { builder["SDE Schema"] = _view.SdeSchema; } FdoConnection conn = new FdoConnection("OSGeo.KingOracle", builder.ToString()); if (conn.Open() == FdoConnectionState.Open) { IFdoConnectionManager mgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); mgr.AddConnection(_view.ConnectionName, conn); return(true); } _view.ShowMessage(null, "Connection failed"); return(false); }
public ConnectArcSdePresenter(IConnectArcSdeView view, IFdoConnectionManager connMgr) { _view = view; _connMgr = connMgr; _conn = new FdoConnection("OSGeo.ArcSDE"); _view.DataStoreEnabled = false; _view.SubmitEnabled = false; }
public bool DependsOnConnection(FdoToolbox.Core.Feature.FdoConnection conn) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); FdoConnection left = connMgr.GetConnection(this.SelectedLeftConnection); FdoConnection right = connMgr.GetConnection(this.SelectedRightConnection); FdoConnection target = connMgr.GetConnection(this.SelectedTargetConnection); return(conn == left || conn == right || conn == target); }
public ConnectRdbmsPresenter(IConnectRdbmsView view, IFdoConnectionManager connMgr) { _view = view; _connMgr = connMgr; _view.DataStoreEnabled = false; _view.SubmitEnabled = false; _view.ConfigEnabled = (Array.IndexOf<string>(CONFIG_PROVIDERS, view.Provider.ToUpper()) >= 0); }
public ConnectRdbmsPresenter(IConnectRdbmsView view, IFdoConnectionManager connMgr) { _view = view; _connMgr = connMgr; _view.DataStoreEnabled = false; _view.SubmitEnabled = false; _view.ConfigEnabled = (Array.IndexOf <string>(CONFIG_PROVIDERS, view.Provider.ToUpper()) >= 0); }
/// <summary> /// Initializes the service. /// </summary> public void InitializeService() { _tabs = new List<IConnectionDependentView>(); //Can't get instance here otherwise it will cause a recurive loop resulting in a stack overflow. //So do it after the ServiceManager has been initialized ServiceManager.ServiceManagerInitialized += delegate { connMgr = ServiceManager.Instance.GetService<IFdoConnectionManager>(); connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeRemoveConnection); }; _init = true; Initialize(this, EventArgs.Empty); }
/// <summary> /// Initializes the service. /// </summary> public void InitializeService() { _tabs = new List <IConnectionDependentView>(); //Can't get instance here otherwise it will cause a recurive loop resulting in a stack overflow. //So do it after the ServiceManager has been initialized ServiceManager.ServiceManagerInitialized += delegate { connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeRemoveConnection); }; _init = true; Initialize(this, EventArgs.Empty); }
/// <summary> /// Initializes a new instance of the <see cref="ViewContent"/> class. /// </summary> public ViewContent() { InitializeComponent(); connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); if (connMgr != null) //Will be null in design mode. this.DesignMode is lying to me!? { this.Disposed += new EventHandler(OnDisposed); connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeConnectionRemove); connMgr.ConnectionAdded += new ConnectionEventHandler(OnConnectionAdded); connMgr.ConnectionRefreshed += new ConnectionEventHandler(OnConnectionRefreshed); connMgr.ConnectionRemoved += new ConnectionEventHandler(OnConnectionRemoved); connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed); } this.AllowDrop = false; }
/// <summary> /// Initializes a new instance of the <see cref="ViewContent"/> class. /// </summary> public ViewContent() { InitializeComponent(); connMgr = ServiceManager.Instance.GetService<IFdoConnectionManager>(); if (connMgr != null) //Will be null in design mode. this.DesignMode is lying to me!? { this.Disposed += new EventHandler(OnDisposed); connMgr.BeforeConnectionRemove += new ConnectionBeforeRemoveHandler(OnBeforeConnectionRemove); connMgr.ConnectionAdded += new ConnectionEventHandler(OnConnectionAdded); connMgr.ConnectionRefreshed += new ConnectionEventHandler(OnConnectionRefreshed); connMgr.ConnectionRemoved += new ConnectionEventHandler(OnConnectionRemoved); connMgr.ConnectionRenamed += new ConnectionRenamedEventHandler(OnConnectionRenamed); } this.AllowDrop = false; }
/// <summary> /// Handles the file drop /// </summary> /// <param name="file">The file being dropped</param> public void HandleDrop(string file) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService<IFdoConnectionManager>(); NamingService namer = ServiceManager.Instance.GetService<NamingService>(); FdoConnection conn = null; try { conn = ExpressUtility.CreateFlatFileConnection(file); } catch (Exception ex) { LoggingService.Error("Failed to load connection", ex); return; } string name = namer.GetDefaultConnectionName(conn.Provider, System.IO.Path.GetFileNameWithoutExtension(file)); connMgr.AddConnection(name, conn); }
/// <summary> /// Handles the file drop /// </summary> /// <param name="file">The file being dropped</param> public void HandleDrop(string file) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); NamingService namer = ServiceManager.Instance.GetService <NamingService>(); FdoConnection conn = null; try { conn = FdoConnection.LoadFromFile(file, true); } catch (Exception ex) { LoggingService.Error("Failed to load connection", ex); return; } string name = namer.GetDefaultConnectionName(conn.Provider); connMgr.AddConnection(name, conn); }
public void HandleDrop(string file) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); NamingService namer = ServiceManager.Instance.GetService <NamingService>(); FdoConnection conn = null; try { #if X64 conn = new FdoConnection("OSGeo.ODBC", "ConnectionString=\"Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};Dbq=" + file + "\""); #else conn = new FdoConnection("OSGeo.ODBC", "ConnectionString=\"Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + file + "\""); #endif } catch (Exception ex) { LoggingService.Error("Failed to load connection", ex); return; } string name = namer.GetDefaultConnectionName(conn.Provider, System.IO.Path.GetFileNameWithoutExtension(file)); connMgr.AddConnection(name, conn); }
/// <summary> /// Creates the connection. /// </summary> /// <param name="provider">The provider.</param> /// <param name="connStr">The connection string.</param> /// <param name="configPath">The configuration path</param> /// <param name="name">The name that will be assigned to the connection.</param> /// <returns></returns> protected override FdoConnection CreateConnection(string provider, string connStr, string configPath, ref string name) { IFdoConnectionManager connMgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); //Try to find by name first FdoConnection conn = null; conn = connMgr.GetConnection(name); //Named connection matches all the details if (conn != null) { if (conn.Provider == provider && conn.ConnectionString == connStr) { return(conn); } } //Then to find matching open connection foreach (string connName in connMgr.GetConnectionNames()) { FdoConnection c = connMgr.GetConnection(connName); if (c.Provider == provider && c.ConnectionString == connStr) { name = connName; return(c); } } //Make a new connection LoggingService.Info(ResourceService.GetString("INFO_REFERENCED_CONNECTION_NOT_FOUND")); conn = new FdoConnection(provider, connStr); if (!string.IsNullOrEmpty(configPath) && System.IO.File.Exists(configPath)) { conn.SetConfiguration(configPath); } connMgr.AddConnection(name, conn); return(conn); }
public bool Connect() { if (string.IsNullOrEmpty(_view.ConnectionName)) { _view.ShowMessage(null, "Name required"); return(false); } FdoConnection conn = new FdoConnection("OSGeo.ODBC", string.Format("ConnectionString=\"{0}\"", _view.BuilderObject.ToConnectionString())); if (FileService.FileExists(_view.ConfigurationFile)) { conn.SetConfiguration(_view.ConfigurationFile); } if (conn.Open() == FdoConnectionState.Open) { IFdoConnectionManager mgr = ServiceManager.Instance.GetService <IFdoConnectionManager>(); mgr.AddConnection(_view.ConnectionName, conn); return(true); } _view.ShowMessage(null, "Connection test failed"); return(false); }
public CreateRdbmsPresenter(ICreateRdbmsView view, IFdoConnectionManager connMgr) { _view = view; _connMgr = connMgr; }
public FdoCreateDataStorePresenter(IFdoCreateDataStoreView view, IFdoConnectionManager manager) { _view = view; _manager = manager; }
public CopySpatialContextsCtlPresenter(ICopySpatialContextsView view, string sourceConnName, IFdoConnectionManager connMgr) { _view = view; _view.SourceConnectionName = sourceConnName; _connMgr = connMgr; }
public FdoConnectCtlPresenter(IFdoConnectView view, IFdoConnectionManager connMgr) { _view = view; _manager = connMgr; }