An event argument object passed when a connection is about to be renamed
Inheritance: CancelEventArgs
Ejemplo n.º 1
0
        /// <summary>
        /// Removes all connections
        /// </summary>
        public void Clear()
        {
            List <string> names = new List <string>(GetConnectionNames());

            foreach (string name in names)
            {
                //Yes we're inlining RemoveConnection(), but we want any cancel action to cancel
                //the Clear() method
                if (_ConnectionDict.ContainsKey(name))
                {
                    ConnectionBeforeRemoveEventArgs e = new ConnectionBeforeRemoveEventArgs(name);
                    this.BeforeConnectionRemove(this, e);
                    if (e.Cancel)
                    {
                        return;
                    }

                    FdoConnection conn = _ConnectionDict[name];
                    conn.Close();
                    _ConnectionDict.Remove(name);
                    conn.Dispose();
                    if (this.ConnectionRemoved != null)
                    {
                        this.ConnectionRemoved(this, new EventArgs <string>(name));
                    }
                }
            }
        }
        void OnBeforeConnectionRemove(object sender, ConnectionBeforeRemoveEventArgs e)
        {
            foreach (var name in _taskMgr.GetTaskNames())
            {
                var task = _taskMgr.GetTask(name);
                if (typeof(FdoBulkCopy).IsAssignableFrom(task.GetType()))
                {
                    var bcp = (FdoBulkCopy)task;
                    var names = new List<string>(bcp.Options.ConnectionNames);
                    if (names.Contains(e.ConnectionName))
                    {
                        MessageService.ShowMessage("Cannot remove connection as the task (" + name + ") depends on this connection");
                        e.Cancel = true;
                        return;
                    }
                }
                else if (typeof(FdoJoin).IsAssignableFrom(task.GetType()))
                {
                    var join = (FdoJoin)task;
                    var conn = _connMgr.GetConnection(e.ConnectionName);

                    var opts = join.Options;
                    if (opts.Left.Connection == conn ||
                        opts.Right.Connection == conn ||
                        opts.Target.Connection == conn)
                    {
                        MessageService.ShowMessage("Cannot remove connection as the task (" + name + ") depends on this connection");
                        e.Cancel = true;
                        return;
                    }
                }
            }
        }
Ejemplo n.º 3
0
 protected override void OnBeforeConnectionRemove(object sender, ConnectionBeforeRemoveEventArgs e)
 {
     if (this.SelectedLeftConnection.Equals(e.ConnectionName) ||
         this.SelectedRightConnection.Equals(e.ConnectionName) ||
         this.SelectedTargetConnection.Equals(e.ConnectionName))
     {
         MessageService.ShowMessage("Cannot remove connection " + e.ConnectionName + " as this join task depends on it");
         e.Cancel = true;
     }
 }
Ejemplo n.º 4
0
 protected override void OnBeforeConnectionRemove(object sender, ConnectionBeforeRemoveEventArgs e)
 {
     if (ConnectionAdded(e.ConnectionName))
     {
         //TODO: Prompt to remove the referenced connection and any copy tasks that use
         //this connection
         MessageService.ShowMessage("This bulk copy task depends on the current connection");
         e.Cancel = true;
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Removes the connection.
        /// </summary>
        /// <param name="name">The name of the connection.</param>
        public void RemoveConnection(string name)
        {
            if (_ConnectionDict.ContainsKey(name))
            {
                ConnectionBeforeRemoveEventArgs e = new ConnectionBeforeRemoveEventArgs(name);
                this.BeforeConnectionRemove(this, e);
                if (e.Cancel)
                {
                    return;
                }

                FdoConnection conn = _ConnectionDict[name];
                conn.Close();
                _ConnectionDict.Remove(name);
                conn.Dispose();
                if (this.ConnectionRemoved != null)
                {
                    this.ConnectionRemoved(this, new EventArgs <string>(name));
                }
            }
        }
        /// <summary>
        /// Removes all connections
        /// </summary>
        public void Clear()
        {
            List<string> names = new List<string>(GetConnectionNames());
            foreach (string name in names)
            {
                //Yes we're inlining RemoveConnection(), but we want any cancel action to cancel
                //the Clear() method
                if (_ConnectionDict.ContainsKey(name))
                {
                    ConnectionBeforeRemoveEventArgs e = new ConnectionBeforeRemoveEventArgs(name);
                    this.BeforeConnectionRemove(this, e);
                    if (e.Cancel)
                        return;

                    FdoConnection conn = _ConnectionDict[name];
                    conn.Close();
                    _ConnectionDict.Remove(name);
                    conn.Dispose();
                    if (this.ConnectionRemoved != null)
                        this.ConnectionRemoved(this, new EventArgs<string>(name));
                }
            }
        }
Ejemplo n.º 7
0
 void OnBeforeRemoveConnection(object sender, ConnectionBeforeRemoveEventArgs e)
 {
     FdoConnection conn = connMgr.GetConnection(e.ConnectionName);
     //Get all views that depend on connection
     List<IConnectionDependentView> matches = _tabs.FindAll(delegate(IConnectionDependentView c) { return c.DependsOnConnection(conn); });
     if (matches.Count > 0)
     {
         //Don't close then cancel
         if (!MessageService.AskQuestion(ResourceService.GetStringFormatted("QUESTION_CLOSE_TABS", e.ConnectionName)))
         {
             e.Cancel = true;
             return;
         }
         else //Otherwise remove from watch list and close the view
         {
             foreach (IConnectionDependentView view in matches)
             {
                 _tabs.Remove(view);
                 view.Close();
             }
         }
     }
 }
Ejemplo n.º 8
0
        void OnBeforeRemoveConnection(object sender, ConnectionBeforeRemoveEventArgs e)
        {
            FdoConnection conn = connMgr.GetConnection(e.ConnectionName);
            //Get all views that depend on connection
            List <IConnectionDependentView> matches = _tabs.FindAll(delegate(IConnectionDependentView c) { return(c.DependsOnConnection(conn)); });

            if (matches.Count > 0)
            {
                //Don't close then cancel
                if (!MessageService.AskQuestion(ResourceService.GetStringFormatted("QUESTION_CLOSE_TABS", e.ConnectionName)))
                {
                    e.Cancel = true;
                    return;
                }
                else //Otherwise remove from watch list and close the view
                {
                    foreach (IConnectionDependentView view in matches)
                    {
                        _tabs.Remove(view);
                        view.Close();
                    }
                }
            }
        }
        /// <summary>
        /// Removes the connection.
        /// </summary>
        /// <param name="name">The name of the connection.</param>
        public void RemoveConnection(string name)
        {
            if (_ConnectionDict.ContainsKey(name))
            {
                ConnectionBeforeRemoveEventArgs e = new ConnectionBeforeRemoveEventArgs(name);
                this.BeforeConnectionRemove(this, e);
                if (e.Cancel)
                    return;

                FdoConnection conn = _ConnectionDict[name];
                conn.Close();
                _ConnectionDict.Remove(name);
                conn.Dispose();
                if (this.ConnectionRemoved != null)
                    this.ConnectionRemoved(this, new EventArgs<string>(name));
            }
        }
Ejemplo n.º 10
0
 protected virtual void OnBeforeConnectionRemove(object sender, ConnectionBeforeRemoveEventArgs e) { }